Applescript in TS

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Applescript in TS

Themis Matsoukas-6
I am using this applescript to run Excalibur on the front window of TS:

-- Applescript direct

tell application "TeXShop"
        activate
        get path of document of window 1
        set fileName to result
        save fileName
end tell
do shell script "open -a " & "/Applications/TeX//Excalibur-4.0.7/Excalibur.app " & quoted form of fileName

I want applescript to save the TS file before running excalibur, otherwise excalibur will use the last saved copy. My problem is that the naive "save fileName” which I added right before "end tell”  does not do the job (although the script runs without errors). Can someone tell me what is the correct way to save the file?

Thanks,

Themis
----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
Reply | Threaded
Open this post in threaded view
|

Re: Applescript in TS

Herbert Schulz
> On Aug 9, 2018, at 7:19 AM, Themis Matsoukas <[hidden email]> wrote:

>
> I am using this applescript to run Excalibur on the front window of TS:
>
> -- Applescript direct
>
> tell application "TeXShop"
> activate
> get path of document of window 1
> set fileName to result
> save fileName
> end tell
> do shell script "open -a " & "/Applications/TeX//Excalibur-4.0.7/Excalibur.app " & quoted form of fileName
>
> I want applescript to save the TS file before running excalibur, otherwise excalibur will use the last saved copy. My problem is that the naive "save fileName” which I added right before "end tell”  does not do the job (although the script runs without errors). Can someone tell me what is the correct way to save the file?
>
> Thanks,
>
> Themis
Howdy,

A while ago Micheal Sharpe wrote a macro that saves the file (to make sure the latest version of the file is spell checked), runs Excalibur on the file and, after Excalibur quits, re-opens the file in TeXShop so you automatically replace the edited file with the update. It uses a shell script to do the command line processing. I enclose the macro .plist file and shell script.

To install the macro open the Macro Editor (Macros->Open Macro Editor…) which also adds the Macros->Add macros from file… menu item to the Macros menu. Click on that menu item and drag and drop the enclosed ExcaliburSpellcheck.plist file onto the dialog box and press Open to add it to the bottom of the macro list on the left side of the editor. You can then move it in the menu to a desired location.

The xcalb script is placed in ~/Library/TeXShop/bin. You can use the TeXShop->Open ~/Library/TeXShop menu item and then simply drop the script into the bin folder.

Again... thanks go to Micheal Sharpe for this macro.




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: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex

Excalibur Macro.zip (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Applescript in TS

Themis Matsoukas-6
> On Aug 9, 2018, at 8:54 AM, Herbert Schulz <[hidden email]> wrote:
>
>> To install the macro open the Macro Editor (Macros->Open Macro Editor…) which also adds the Macros->Add macros from file… menu item to the Macros menu. Click on that menu item and drag and drop the enclosed ExcaliburSpellcheck.plist file onto the dialog box and press Open to add it to the bottom of the macro list on the left side of the editor. You can then move it in the menu to a desired location.


It didn’t work for me. I put the script is in my Macros menu but when I click it nothing happens.

Themis
----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
Reply | Threaded
Open this post in threaded view
|

Re: Applescript in TS

Herbert Schulz
> On Aug 9, 2018, at 8:29 AM, Themis Matsoukas <[hidden email]> wrote:
>
>> On Aug 9, 2018, at 8:54 AM, Herbert Schulz <[hidden email]> wrote:
>>
>>> To install the macro open the Macro Editor (Macros->Open Macro Editor…) which also adds the Macros->Add macros from file… menu item to the Macros menu. Click on that menu item and drag and drop the enclosed ExcaliburSpellcheck.plist file onto the dialog box and press Open to add it to the bottom of the macro list on the left side of the editor. You can then move it in the menu to a desired location.
>
>
> It didn’t work for me. I put the script is in my Macros menu but when I click it nothing happens.
>
> Themis

Howdy,

Did you put the script in ~/Library/TeXShop/bin?

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: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
Reply | Threaded
Open this post in threaded view
|

Re: Applescript in TS

Themis Matsoukas-6
On Aug 9, 2018, at 9:37 AM, Herbert Schulz <[hidden email]> wrote:

Did you put the script in ~/Library/TeXShop/bin?


I used Macros>Add macros from file … . The script is in the macros menu.




----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
Reply | Threaded
Open this post in threaded view
|

Re: Applescript in TS

Herbert Schulz
> On Aug 9, 2018, at 8:42 AM, Themis Matsoukas <[hidden email]> wrote:
>
>> On Aug 9, 2018, at 9:37 AM, Herbert Schulz <[hidden email]> wrote:
>>
>> Did you put the script in ~/Library/TeXShop/bin?
>>
>
> I used Macros>Add macros from file … . The script is in the macros menu.
>
> <PastedGraphic-1.tiff>

Howdy,

No, you must install the xcalb script, that was in the folder along with the Macro file, in ~/Library/TeXShop/bin. See the next paragraph in my original email for instructions on how to do that. I.e., there are two items to install.

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: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
Reply | Threaded
Open this post in threaded view
|

Re: Applescript in TS

Themis Matsoukas-6
> On Aug 9, 2018, at 9:58 AM, Herbert Schulz <[hidden email]> wrote:
>
> No, you must install the xcalb script, that was in the folder along with the Macro file, in ~/Library/TeXShop/bin. See the next paragraph in my original email for instructions on how to do that. I.e., there are two items to install.


Thanks, it works now.

Still, I would like to know how I need to modify my script to save the TS window before calling excalibur.

Themis
----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
Reply | Threaded
Open this post in threaded view
|

Re: Applescript in TS

Herbert Schulz
> On Aug 9, 2018, at 9:52 AM, Themis Matsoukas <[hidden email]> wrote:
>
>> On Aug 9, 2018, at 9:58 AM, Herbert Schulz <[hidden email]> wrote:
>>
>> No, you must install the xcalb script, that was in the folder along with the Macro file, in ~/Library/TeXShop/bin. See the next paragraph in my original email for instructions on how to do that. I.e., there are two items to install.
>
>
> Thanks, it works now.
>
> Still, I would like to know how I need to modify my script to save the TS window before calling excalibur.
>
> Themis

Howdy,

Take a look at the Macro script to see how Micheal Sharpe does it.

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: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex