[TxMt] AppleScript to save TextMate file with path

Patrick James pj002 at mac.com
Wed Sep 3 11:34:20 UTC 2008


Hi

I've been trying to write an AppleScript to save any open TextMate  
file into a specific folder with a filename constructed out of the  
current date and time.

There is no problem creating the filename but I can't work out how to  
get the path and filename into the TextMate file to be saved.

In the script below I've left out the bit that creates the file_name.  
as that bit works fine. The problem is the line "save to file  
file_path" which doesn't work :(

It does work with that other text editor for the Mac but of course I  
don't use that one anymore :)

Thank you for any assistance you can give.

set file_path to "Macintosh HD:Users:patrick:Temporary:" & file_name

tell application "TextMate"
	activate
	if document 1 exists then
		tell document 1
			save to file file_path
		end tell
	else
		display dialog "No open file"
	end if
end tell


Patrick

http://www.patrickjames.co.uk



More information about the textmate mailing list