On 12 févr. 05, at 02:46, Eric Hsu wrote:
At 11:41 PM +0100 2/11/05, fatal wrote:
You beat me to it Eric,
Well, heck if I'd known you were working on it, I wouldn't have bothered! :) (I'm not supposed to be working on this non-work kind of stuff...) Maybe next time we should write to the list and reserve a request. I personally would rather other people write these gadgets for me!
Well, in fact, I was not supposed to play with this neither. I'm far from being a shell script guru, but if I can help...
(Hey, Chris Thomas, weren't you going to write an Icon Chooser? Don't make me do it...)
There are a few more CMs that I was thinking should be written. Basically all the ones aimed at BBEdit at the OMC site could be altered for TM. Also, a simple 'Edit this Selected Text in TM'. I found myself in Equation Service trying to write some LaTeX and missing a decent editor... but Equation Service doesn't (wait for it) support Services. Oh well. I also had this visionary idea of having a 'Edit Filenames in TM' CM. I often have annoying rename tasks (like chop off a leading word and add an extension) that would take 3 seconds in TM but forever either in the Finder or an annoying amount of time getting a shell script loop right. But if I could just select a bunch of files, send it to TM and edit them there... ahhh. It wasn't obvious to me how to deal with cases where someone deleted a lines, etc. I told you it was visionary.
I'll take a look at the command aimed at BBEdit. 'Edit Filenames in TM' can be more tricky, I guess.
The command opens a dialog asking for a name for the new file and I used "open -a" instead of "tm" CLI command ". IMO, the advantage is that the Syntax highlight is selected according to the extension you gave to the file name. Plus, with the tm CLI, the file doesn't "exists" until you save it and you have to "Saves as" to give it a proper name.
I thought that was a feature of my version. :) Seriously, I didn't want to deal with name collisions etc etc. But maybe if it turns out people want that feature, I'll put your version in the svn repository...
I didn't mean my version was better or anything, its just the way I wanted it. My script is really basic, but there's no real danger with name collisions, except changing the file's date. It just "touch" then "open" the file. (I'll had a comment about the date change in case of filenames already in use.) Please, tell me if you see other caveats in this approach.
And I made it in Ruby cause I'm lazy. ;) (Maybe Eric could make it in shell?)
How do you do it in Ruby? Do you have OMC just call the Ruby script, or can it support Ruby inline?
As of v. 1.6.1 OnMyCommand has "Full support for shell scripts. Finally you can use perl, python or other scripting language directly in your command."
You just have to write the proper shebang line before the script, then:
"This execution mode creates a temporary script file: /tmp/OMC/OMC_temp_script_XXX and then "exec /tmp/OMC/OMC_temp_script_XXX" is called."
Much easier when you have to share the command with others.
-- Fred
P.S:I realize I didn't use my usual email address in my previous message this thread, sorry.