[texworks] Scripting: Get permissions for scripts

Henrik Skov Midtiby henrikmidtiby at gmail.com
Mon Jul 2 10:39:13 CEST 2012


Hi Stefan

> Well, the typical use case would be to try to run the command, and if
> that fails with SystemAccess_PermissionDenied, display the message and exit.
This is a fine solution that is now used in the autocomplete script [1].

Thanks for the input
Henrik

[1] https://github.com/henrikmidtiby/TeXworks-scripts/tree/master/autocomplete



On 1 July 2012 17:35, Stefan Löffler <st.loeffler at gmail.com> wrote:
> Hi,
>
> On 2012-06-22 10:48, Henrik Skov Midtiby wrote:
>> Hi
>>
>> In the TeXworks preferences dialog -> Scripts, it is possible to set
>> different permissions related to script execution.
>>
>> Is it possible to get information about which of these permissions
>> that are granted to a running script?
>
> Yes, and no. There are no dedicated functions to query the permissions
> for a script (that can be called from within the script). Partly, this
> is due to the fact that reading and writing is context-sensitive (e.g.,
> scripts are allowed to read files in the scripts/ folder, but may not be
> allowed to read other files).
> However, the respective functions that require special permissions will
> fail with a special return code (SystemAccess_PermissionDenied=2) in
> case permissions are insufficient.
>
>> Ideally I would like to present users with a message like "Grant
>> permission to run system commands for enabling filename completion" if
>> a certain permission is not set.
>
> Well, the typical use case would be to try to run the command, and if
> that fails with SystemAccess_PermissionDenied, display the message and exit.
>
> HTH
> Stefan



More information about the texworks mailing list