[TxMt] Running an AppleScript

Tim Mansour tim at neologica.com.au
Sat Mar 31 00:53:10 UTC 2007

So, my copy of JEG2's TextMate book has arrived down under, and I'm  
really enjoying getting a better understanding of TextMate.

Being an avid AppleScripter, this was my first attempt at a bundle  
command--to look up a selection in a FileMaker database:

osascript <<-ENDSCRIPT
set title to "${TM_SELECTED_TEXT}"
if title ­ "" then
	tell application "FileMaker Pro Advanced"
		if not (exists window "HachetteTitles") then open alias  
		set cell "_Search" of layout "Titles" to title
		do script "Search For Title"
		set href to cell "_Search" of layout "Titles"
		set img to cell "_thumb" of layout "Titles"
	end tell
	if href ­ "" then set title to img & href
end if
return title

I know this script method works fine outside of TextMate, but no  
matter what I do I get errors running it inside TextMate:

31:32: syntax error: Expected ÒthenÓ, etc. but found unknown token.  

I'd certainly appreciate any help diagnosing this one.

Tim Mansour <tim at neologica.com.au>

More information about the textmate mailing list