[OS X TeX] applescript in TS
Claus Gerhardt
gerhardt at math.uni-heidelberg.de
Sat Sep 18 12:49:38 EDT 2010
Herb,
In the script there is line
set findString to "%SourceDoc "
which then has to be replaced by "% !TEX root ="
However, thereafter the whole line starting with findString is found and analyzed to get the path of the root file. This is done by stopping at the first space " " and assuming that the rest is the path:
repeat while i < (n + 1)
if character i of foundText is equal to " " then
set k to i
exit repeat
else
set i to (i + 1)
end if
end repeat
In your case you should replace " " by "=" provided that the rest of the line represents the path, i.e., there should no space after "=" otherwise you have to define k by
set k to (i+1)
Claus
Claus
On Sep 18, 2010, at 15:24, Herbert Schulz wrote:
>
> On Sep 18, 2010, at 7:52 AM, Claus Gerhardt wrote:
>
>> Below is a more general script that can also be used when the root file is typeset but the front most tex window is that of a slave (chapter) file.
>>
>> Note that the relative path to the root file has be given in the form
>>
>> %SourceDoc relative path
>>
>> near the beginning of the slave file.
>>
>> Claus
>> <refreshpdfroot.scpt.zip>
>>
>> On Sep 17, 2010, at 23:14, Claus Gerhardt wrote:
>>
>>> The refreshpdf script below, when copied as a macro, runs directly.
>>>
>>> Claus
>>>
>>>
>>> <refreshpdf.scpt.zip>
>>> On Sep 17, 2010, at 22:57, Herbert Schulz wrote:
>>>
>>>>
>>>> On Sep 17, 2010, at 3:30 PM, Themis Matsoukas wrote:
>>>>
>>>>> Every time you run an applescript in TS, it first launches a little ScriptRunner app which then runs the script. This causes a small delay in the execution of the script that can be annoying, especially if the script is meant to do something quick, like Claus' script that removes the red circle from the pdf. Wouldn't things be faster if that script stayed open during a TS session? I could not get ScriptRunner.app to stay open, though.
>>>>>
>>>>> Themis
>>>>
>>>> Howdy,
>>>>
>>>> The OS should cache that extra app and be able to reuse it quickly; at least after the first run.
>>>>
>>>> However, if the script has a heading
>>>>
>>>> --Applescript direct
>>>>
>>>> TeXShop doesn't seem to run ScriptRunner. That didn't seem to work with Claus' script but others I have use it and ScriptRunner is not invoked. I don't know what properties the Applescipt has to have to be able to run without ScriptRunner.
>>>>
>>>> See `Applescript Macros' in TeXShop's Help Panel for more of an explanation.
>>>>
>>>> Good Luck,
>>>>
>>>> Herb Schulz
>>>> (herbs at wideopenwest dot com)
>>>>
>>
>
> Howdy,
>
> Can I simply change `%SourceDoc' to TeXShop's `% !TEX root =' and still have it work? The rest is the relative (or absolute) path to the root file so you can figure out which pdf to refresh.
>
> This seems to get better and better. Thanks again.
>
> Good Luck,
>
> Herb Schulz
> (herbs at wideopenwest dot com)
>
>
>
> ----------- Please Consult the Following Before Posting -----------
> TeX FAQ: http://www.tex.ac.uk/faq
> List Reminders and Etiquette: http://email.esm.psu.edu/mac-tex/
> List Archive: http://tug.org/pipermail/macostex-archives/
> TeX on Mac OS X Website: http://mactex-wiki.tug.org/
> List Info: http://email.esm.psu.edu/mailman/listinfo/macosx-tex
>
More information about the MacOSX-TeX
mailing list