I'm trying to get a command set up in Textmate to open the current file in FTPeel in order to invoke the Magic Mirror command (uploads the file to the appropriate directory on the appropriate server automatically). I found this script to do it in VIM:
" FTPeel fun! MagicMirrorIt() let path = substitute(expand("%:p"), '/', ":", "g") let nice_path = substitute(path, "^:", "", "") execute('!osascript -e "tell application "FTPeel" to open "' . nice_path . '""') endfun
map :call MagicMirrorIt()
Basically, it's as easy as calling an Applescript with the command
'tell application "FTPeel" open $TM_FILEPATH'
except FTPeel has a bug with converting the unix filepath to a "mac" filepath (users:toby:home:sites:file) because it leaves the initial / in the mac path...i guess what the VIM command above does is remove the first / (i think)...how would I go about doing this as a Textmate command?
Thanks for your help!
Toby
On Nov 17, 2004, at 9:11 PM, Toby Sterrett wrote:
'tell application "FTPeel" open $TM_FILEPATH'
except FTPeel has a bug with converting the unix filepath to a "mac" filepath (users:toby:home:sites:file) because it leaves the initial / in the mac path...i guess what the VIM command above does is remove the first / (i think)...how would I go about doing this as a Textmate command?
Try this: osascript -e "tell application "FTPeel" open `echo ${TM_FILEPATH:1}|tr / :`"
On Nov 17, 2004, at 9:35 PM, Allan Odgaard wrote:
Try this: osascript -e "tell application "FTPeel" open `echo ${TM_FILEPATH:1}|tr / :`"
I forget the 'to'. I.e. "tell app "FTPPeel" to open `...
Regarding environment variables, one can write: ${var:offset[:length]} to get a substring. So I cut the first / by using the :1.
One can also do ${var/ptrn/replace} to replace in an environment variable. This only does a single replace, to make it global do ${var//ptrn/replace}. I figured these things may be handy when needing to modify the TM variables to suit other programs requirements.
On Nov 17, 2004, at 12:44 PM, Allan Odgaard wrote:
Try this: osascript -e "tell application "FTPeel" open `echo ${TM_FILEPATH:1}|tr / :`"
I forget the 'to'. I.e. "tell app "FTPPeel" to open `...
Hi Alan, thanks for helping out with this so quick. I tried the following as the command:
osascript -e "tell application "FTPeel" to open `echo ${TM_FILEPATH:1}|tr / :`"
and it gives me this error: 34:40: syntax error: A “:” can't go after this identifier. (-2740)
Any ideas? Thanks.
On Nov 17, 2004, at 10:56 PM, Toby Sterrett wrote:
Hi Alan, thanks for helping out with this so quick. I tried the
following as the command:
osascript -e "tell application "FTPeel" to open `echo
${TM_FILEPATH:1}|tr / :`"
and it gives me this error: 34:40: syntax error: A “:” can't go after
this identifier. (-2740)
Ah yes, the file path also needs to be quoted: osascript -e "tell application "FTPeel" to open "`echo ${TM_FILEPATH:1}|tr / :`""
I don't have FTPeel, but I tried with TextEdit, and here it does now open the file.
On Nov 17, 2004, at 2:23 PM, Allan Odgaard wrote:
Ah yes, the file path also needs to be quoted: osascript -e "tell application "FTPeel" to open "`echo ${TM_FILEPATH:1}|tr / :`""
I don't have FTPeel, but I tried with TextEdit, and here it does now open the file.
It worked! Thank you very very much. This will make working with FTP much nicer as this command will use FTPeel's "magic mirror" feature to essentially upload any file being worked on in Textmate to it's proper home on the server... It's kind of like an inverted "edit with external editor" function in Textmate now.
Just curious what happened to the Lance LaTeX command that was so very useful. Can it please return.
Thanks
Robert Ullrey
On Nov 18, 2004, at 12:43 AM, Mr. Robert Ullrey wrote:
Just curious what happened to the Lance LaTeX command that was so very useful. Can it please return.
If you are referring to the beta versions not shipping with all the bundles, the bundles will be back in the "release" version.
But if you installed the LaTeX bundle, the command should stay, even if you updated to latest beta.
So I'm not really sure why you've apparently lost it!?!