[NTG-context] For the Mac users: AppleScript to launch ConTeXt in a flexile way

Thomas Floeren thfl at mac.com
Fri Jul 18 02:59:59 CEST 2014



On 17 Jul 2014, at 22:47, Otared Kavian <otared at gmail.com> wrote:

> Hi Thomas,
> 
> Thanks for sharing your nice script. You have had a very nice intitiative and I am sure it is going to be very useful for many people.
> 
> I did some testing of the script, after having edited some parametrers inside the script. For your information, I am running Mac OS X 10.9.4 on a Mac Book Pro.
> As a first feedback, I should say that I didn’t know how to create a « service » with an Applescript (shame on me…). Finally I found an application named FastScript which allows to create a shortcut for any Applescript, and then I could run your script on a TeX file. Maybe one could add some indications as to how create a « service » with your script.
> 
> Strangely the script gives the expected result the first time it is run on a file from within an application such as TeXShop or Smultron, but the second time I call the script, I get a notification saying that something i sgoing on, but then no PDF is created nor a log file. 
> 
> However the update part works fine and it is very handy: maybe this part could be made into a small application with XCode, like the application written by Gerben Wierda in order to install a TeX tree some 10 or 15 years ago. 
> 
> I’ll do some more testing and then let you know.
> 
> Thanks again: OK
> 

Hi,

thanks for your feedback!

> after having edited some parametrers inside the script.

Basically there should be no need to edit parameters in the script to make it run (except rare cases like strange ctx install locations). The script for example is (or should be) capable to find the "setuptex" files of your Ctx Minimals automatically on first launch. Most other parameters are configurable from the main options screen, that appears when you launch the script with the ctrl-key down. What was it that you had to edit in the script?

> I am running Mac OS X 10.9.4

That should be fine. Same version here.

> I didn’t know how to create a « service » with an Applescript

No need to do this. In the Extras folder you'll find some premade service workflows to launch the script. In the description I tried to explain how to install the services and how to assign hotkeys ("Installation for usage with hotkey and modifier keys" > "Service workflows"). Did you see this?

The current version of the script has a rather long delay of 0.6 seconds, that means it isn't even necessary to install a service for each modifier key combination. You can launch the script with just your standard hotkey and then (up to 0.6s afterwards) hold down the desired modifier key, if needed. For example you launch the script with cmd-F7 and then you quickly hold down ctrl in order to open the main options screen.

> I get a notification saying that something i sgoing on, but then no PDF is created nor a log file.

What does the notification say? 

You can try to pass the typesetting to the terminal (by default is is executed in the non-interactive (non visible) shell). To do this you can either mark the setting in the main options screen ("Run Typesetting in Terminal") or hold down opt-shift while (or quickly after) launching the script. Maybe this way it becomes more obvious what is going wrong.

> However the update part works fine and it is very handy: maybe this part could be made into a small application with Xcode

Well, this is one of the easier parts of the script. It would probably be overkill to rewrite this as Cocoa app, especially because it won't benefit from being native (the time-consuming processes in that part are archiving, download and making formats). However, I just started learning Swift, so maybe it would be a good exercise ;-)

Best wishes

Thomas


More information about the ntg-context mailing list