[TxMt] Re: LaTeX bundle wont stop opening TeXShop

Allan Odgaard mailinglist at textmate.org
Sun Jan 18 12:52:08 UTC 2015


On 12 Jan 2015, at 22:41, René Schwaiger wrote:

>> 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.

I see — you might have the external script issues sorted out by now, 
but another alternative (where we do not have to consider 
AppleScript’s string quoting rules embedded into a shell string) would 
be to use an environment variable, for example:

     import pipes
     import subprocess

     path = "That's an \"environment\" variable!"
     cmd = "PDF={} osascript -e 'tell app \"TextMate\" to display alert 
(system attribute \"PDF\")'".format(pipes.quote(path))
     subprocess.call(cmd, shell=True)


More information about the textmate mailing list