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
On 3 Sep 2008, at 13:34, Patrick James wrote:
I've been trying to write an AppleScript to save any open TextMate file into a specific folder [...]
Sorry, but TextMate doesn’t really do AppleScript.
Does this need to be invoked from outside TextMate? Otherwise a command can do this.
On 3 Sep 2008, at 17:19, Allan Odgaard wrote:
On 3 Sep 2008, at 13:34, Patrick James wrote:
I've been trying to write an AppleScript to save any open TextMate file into a specific folder [...]
Sorry, but TextMate doesn’t really do AppleScript.
Does this need to be invoked from outside TextMate? Otherwise a command can do this.
Hi
It doesn't need to be invoked from outside TextMate and a command would be excellent :)
The date format I would like to name the files to be saved is:
yyyy-mm-dd-hh-mm-ss
These all go to one folder so the path is always constant, I can just put that into a variable in the script.
I don't know anything about Ruby or command line but I have got learning Ruby on my list of things "to do" :)
This ability to save a file with date and time is something I miss very much from when I was using that other editor. I used it all the time because it means that any text or html code or what-have-you can be put into a file and then saved at the click of a menu item. It means that I can work on it knowing that if the computer crashes it is okay. Then when finished I take the text/html/whatever and put it into the thing it is intended for.
Patrick