Hi René,
I was holding back before replying this time so that I could try more thoroughly your bundle. So far, the compiled version of refresh_viewer.scpt seems to be playing nicely. I haven't found any issues, TeXShop doesn't open after successive LaTeX compiles. I've installed your bundle according to your instructions in the previous email, and I made sure that the default LaTeX version is unselected, no other versions of LaTeX are present and that your bundle is cloned from Github in the Avian directory. So far, things are looking good with this LaTeX bundle!

Cheers,
Angelo

René Schwaiger wrote:
Hi,

first: Thanks for all the helpful advice and sorry for the late response.

I looked a little bit further into the matter and it seems that AppleScripts launches Applications “hidden” since OS X 10.5 [1]. I believe this “silent” launching is the behaviour that I encountered when describing the growing and shrinking of my Dock when `texmate`  called (the uncompiled script) `refresh_viewer.scpt`.

[1]: https://developer.apple.com/library/mac/releasenotes/AppleScript/RN-AppleScript/RN-10_5/RN-10_5.html

I do not get this behaviour at all when `texmate` uses the compiled version of the script [2]. This could be because either the compiled version is much faster, or as pointed out by the Stack Overflow article mentioned by Jim [3], that compiled version of AppleScripts do not open Applications if they do not need to.

[2]: https://github.com/textmate/latex.tmbundle/blob/master/Support/bin/refresh_viewer.scpt
[3]: http://stackoverflow.com/questions/12431811/how-to-make-applescript-not-automatically-open-applications-in-tell-blocks

Angelo: You mentioned that your problems have been gone after you used the compiled version of the script. Is this still the case?

Jim: You said that the problem continues but you still could open `refresh_viewer.scpt` inside `Support/bin` after the changes. Could you please try to remove all LaTeX bundles and then clone the one from GitHub (again). After that, if the problem continues, please try to open `refresh_viewer.scpt` inside `Support/bin` with “Script Editor”. If that works, then it seems something overwrites the bundles content. If it does not, then I guess I have to come up with better solution to fix the command.

On 09 Jan 2015, at 19:40 , Matt Neuburg <matt@tidbits.com> wrote:

If an AppleScript script uses any terminology from an application, it must be resolved by looking in the application's dictionary. If I remember correctly (which may not be the case - it's been a long time), this is one of the thing the "using terms from" block was supposed to help with:

https://developer.apple.com/library/mac/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_control_statements.html

Thanks for the helpful resource. I guess this will be the next thing I will check out if the current compiled version of the script does not work.

On 09 Jan 2015, at 4:45 , Allan Odgaard <mailinglist@textmate.org> wrote:

No, this is just because it has recorded that the LaTeX bundle is installed in the local index and/or the bundle is present on disk (a newer version). TextMate isn’t able to tell if the one on disk is one that TextMate itself put there.

— especially since the preferences showed that the cloned bundle was updated 14 years [sic] ago.
The “14 years” would (sort of) verify that it’s the custom bundle, since TextMate lack the proper “last updated” meta-data.

Thanks for the clarification.

I’m jumping into the middle of this, so I might have missed some, but uncompiled AppleScripts are problematic because the system needs to compile them before it’s able to execute them, and for that, it need the scripting dictionaries of all programs referenced. If the user lack one of the programs, it will fail to compile.

Oh. It honestly did not know that. It seems that running scripts without installing all the referenced Application seems to work nowadays tough. If I remove “TeXShop”, open “Skim” and then run the `refresh_viewer.scpt Skim some.pdf`, where `refresh_viewer` is the uncompiled AppleScript I get no error. 

If I run `refresh_viewer.scpt TeXShop some.pdf` the script returns with the expected error status and prints “./refresh_viewer.scpt:786:796: execution error: The variable refreshpdf is not defined. (-2753)”. The behaviour seems to be pretty much the one a programmer that has little to no knowledge of AppleScript — like myself — would expect.

I suggest dropping the external AppleScript and making two branches in the Python script instead, which each use: osascript -e 'tell app "…" to …'

This was actually the old behaviour. I did change it to fix the quoting of filenames with special characters [4]. Using an external script was an easy solution to get the proper filename trough to the AppleScript command.

[4]: https://github.com/textmate/latex.tmbundle/commit/d7e9a3916311af1849932f04aa43ed26d6646288

Kind regards,
  René

_______________________________________________
textmate mailing list
textmate@lists.macromates.com
http://lists.macromates.com/listinfo/textmate