[TxMt] Open Document(s) in Running Browser - Does Nothing

Ben Edwards ben.lists at widemedia.com
Tue Feb 6 13:47:00 UTC 2007


On 5 Feb 2007, at 07:02, Chip Cullen wrote:

> well, i don't know what to do with getting textmate to work with
> safari. am i the only one who is running into this problem? i feel
> like it can't just be me.

Hi Chip,

I thought I'd have a little dig around, as I am experiencing the same  
problem. First, I tested the code that appears in the bundle item,  
and got the following error;

129:130: syntax error: No user interaction allowed. (-1713)

This usually means that the applescript code in the osascript call is  
trying to do something like display a dialog, which it can't do when  
it is called as a shell command.

So, I took the osascript calls and turned them in to a standard  
applescript in script editor. When I tried to compile, it asked me to  
locate the app 'Webkit' on my machine. This is where I'm not sure  
what should happen: as Webkit is a framework rather than an app,  
surely it can't be called with a 'tell app' applescript command?

Anyway, editing the osascript calls in the bundle item to remove the  
Webkit related items is a workaround. If you open the bundle item,  
select the 'Open Document in Running Browsers' command and replace  
the block of code below the line that says:

##Safari or Webkit

with this:

[[ $(ps -xc|grep Safari) ]] && osascript -e 'tell app "System  
Events"' -e 'set proclist to name of every application process'  -e  
'if proclist contains "Safari" then' -e 'tell app "Safari"' -e  
activate -e "make new document" -e "set the URL of document 1 to  
\"$activeURL\"" -e 'end tell' -e 'end if' -e 'end tell'

...then the preview command will work correctly. It will also work  
for Firefox and the other browsers listed - the reason it wasn't  
before was because of the error in this block of code, which was  
preventing the rest of the preview code from being executed.

Perhaps someone more knowledgeable could chime in with why the Webkit  
bit isn't working & whether it needs to be there before we submit a  
patch to the bundle.

cheers
Ben





More information about the textmate mailing list