I have just downloaded TextMate for a try before buy and because I write a lot of AppleScripts, wanted to open and compile my text in my Script Editor of choice: Script Debugger 4 (set as my default). TM defaults to Apple's Script Editor. How do I change that?
Adam Bell
On 15. Nov 2006, at 15:15, Adam Bell wrote:
I have just downloaded TextMate for a try before buy and because I write a lot of AppleScripts, wanted to open and compile my text in my Script Editor of choice: Script Debugger 4 (set as my default). TM defaults to Apple's Script Editor. How do I change that?
If you select Bundles → Bundle Editor → Edit Commands and unfold the AppleScript item, you will see the source for the Compile in Script editor.
You would need to change that to address your preferred tool instead of Script Editor.
Thanks, but that's an osascript targeted at the Script Editor. Unfortunately, Script Debugger 4 (an OS X upgrade) is not yet scriptable, so it's not on, I guess - the osascript will just bomb (A failing of SD4, clearly, not TextMate, but reduces the value of TextMate to me and it's around $60 Cdn). TextMate isn't very scriptable, but I'll try to write a copy/paste routine to get there.
Adam
At 6:11 PM +0100 11/15/06, Allan Odgaard wrote:
On 15. Nov 2006, at 15:15, Adam Bell wrote:
I have just downloaded TextMate for a try before buy and because I write a lot of AppleScripts, wanted to open and compile my text in my Script Editor of choice: Script Debugger 4 (set as my default). TM defaults to Apple's Script Editor. How do I change that?
If you select Bundles Å® Bundle Editor Å® Edit Commands and unfold the AppleScript item, you will see the source for the Compile in Script editor.
You would need to change that to address your preferred tool instead of Script Editor.
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Since Script Debugger 4 is (I believe) a Cocoa Application, if you install edit in textmate(bundles > textmate > install edit in textmate) you can open your files in Script Debugger then use edit in textmate from there(edit > edit in textmate (^⌘E by default) when you save your file the contents are sent back to the field you edit it from; closing it returns focus to the original window. This works with the default script editor and all other Cocoa Applications, and is freeken sweet.
William
On Nov 15, 2006, at 12:38 PM, Adam Bell wrote:
Thanks, but that's an osascript targeted at the Script Editor. Unfortunately, Script Debugger 4 (an OS X upgrade) is not yet scriptable, so it's not on, I guess - the osascript will just bomb (A failing of SD4, clearly, not TextMate, but reduces the value of TextMate to me and it's around $60 Cdn). TextMate isn't very scriptable, but I'll try to write a copy/paste routine to get there.
Adam
At 6:11 PM +0100 11/15/06, Allan Odgaard wrote:
On 15. Nov 2006, at 15:15, Adam Bell wrote:
I have just downloaded TextMate for a try before buy and because I write a lot of AppleScripts, wanted to open and compile my text in my Script Editor of choice: Script Debugger 4 (set as my default). TM defaults to Apple's Script Editor. How do I change that?
If you select Bundles Å® Bundle Editor Å® Edit Commands and unfold the AppleScript item, you will see the source for the Compile in Script editor.
You would need to change that to address your preferred tool instead of Script Editor.
_ For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
=
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Thanks for that William;
I'll give it a go.
Adam
At 1:19 PM -0500 11/15/06, William Sherer wrote:
Since Script Debugger 4 is (I believe) a Cocoa Application, if you install edit in textmate(bundles > textmate > install edit in textmate) you can open your files in Script Debugger then use edit in textmate from there(edit > edit in textmate (^E by default) when you save your file the contents are sent back to the field you edit it from; closing it returns focus to the original window. This works with the default script editor and all other Cocoa Applications, and is freeken sweet.
William
On Nov 15, 2006, at 12:38 PM, Adam Bell wrote:
Thanks, but that's an osascript targeted at the Script Editor. Unfortunately, Script Debugger 4 (an OS X upgrade) is not yet scriptable, so it's not on, I guess - the osascript will just bomb (A failing of SD4, clearly, not TextMate, but reduces the value of TextMate to me and it's around $60 Cdn). TextMate isn't very scriptable, but I'll try to write a copy/paste routine to get there.
Adam
Adam Bell wrote:
Allan Odgaard wrote:
You would need to change that to address your preferred tool instead of Script Editor.
Thanks, but that's an osascript targeted at the Script Editor. Unfortunately, Script Debugger 4 (an OS X upgrade) is not yet scriptable, so it's not on, I guess - the osascript will just bomb (A failing of SD4, clearly, not TextMate,
Kinda ironic, eh?
but reduces the value of TextMate to me and it's around $60 Cdn).
Hmm, I hope this doesn't end up preventing you from using TextMate. I'm sure we can work around things. I made the applescript bundle, and personally don't find the "compile in script editor" command very useful, as Script Editor is kinda limited, and I can just run all my scripts from within TextMate.
But if you're interested in this, I'm positive we could get it working in Script Debugger using UI scripting. If you can't figure it out, I'm willing to lend a hand.
Otherwise, the Edit in TextMate input manager is really nice.
Until TM 2.0, editing applescripts using TextMate isn't really ideal, because AppleScript is too stupid to understand UTF-8 *.applescript files. So to actually use the scripts you make with TM, you either have to dump them into Script Editor (or SD or whatever) and save a compiled script (recommended for several reasons, including that AppleScript compiles scripts incredibly slowly, and needs to open all referenced applications to do so), or else either convert things to macroman before running them, or just avoid non-ascii characters (like ¬).
For TextMate 2.0, we should be able to pass things like *.scpt files through a filter on the way into and out of TextMate, which can convert compiled scripts ↔ text. At that point, Script Editor can be taken completely out of the workflow.
TextMate isn't very scriptable, but I'll try to write a copy/paste routine to get there.
Hmm, what exactly is your purpose here? I can't really recommend trying to use AppleScript from within TM, unless it's for scripting other apps. You are much better off using a TextMate command, which also puts any language on the system at your fingertips (python, ruby, perl, bash, etc.).[^1]
Anyway, If you want to make a TextMate command which runs an applescript, that is quite possible too. I'm going to make a screencast hopefully soon that shows this in action.
* * *
Anyway, I do hope you'll stick with TextMate. Once you get into the snippets/commands, and the scopes/scope selectors system, I think you'll find it's the most ingenious, intuitive, and easily hackable text editor on the market.
If you have suggestions for improvements to the AppleScript bundle, I'm all ears. I only use AppleScript when I'm forced to (e.g. to interact with random apps on the system), and though I like to think I understand the language pretty well from reading all the way through the docs that Apple has posted online, I'm definitely not a seasoned expert. TextMate so far hasn't really had too many AppleScripters using it, as far as I know, and there wasn't any bundle for it at all for the first year and a half TextMate existed. So picking up some people who actually know what they're doing can only be good for the bundle, assuming they're willing to contribute ideas, and preferably code too.
I tried to take a look at Script Debugger at some point, but I can't really get into the mental model of the app. But that's true of AppleScript stuff in general... :) If there are any particular problems solved by features of Script Debugger which we should try to solve in TextMate, please speak up.
-Jacob Rus
[^1]: The only downside to TextMate's lack of scriptability that I can see is that it makes it harder for other apps to tell TM to do things. But if/when TextMate does become truly scriptable in this way, I sure hope it's not AppleScript that's the scripting language used ;).
At 9:32 AM -0500 11/16/06, Jacob Rus wrote:
Adam Bell wrote:
Allan Odgaard wrote:
You would need to change that to address your preferred tool instead of Script Editor.
Thanks, but that's an osascript targeted at the Script Editor. Unfortunately, Script Debugger 4 (an OS X upgrade) is not yet scriptable, so it's not on, I guess - the osascript will just bomb (A failing of SD4, clearly, not TextMate,
Kinda ironic, eh?
It is indeed. In the pre-OS X versions it was extremely scriptable, but hasn't caught up.
but reduces the value of TextMate to me and it's around $60 Cdn).
Hmm, I hope this doesn't end up preventing you from using TextMate. I'm sure we can work around things. I made the applescript bundle, and personally don't find the "compile in script editor" command very useful, as Script Editor is kinda limited, and I can just run all my scripts from within TextMate.
What attracted me to TextMate in the first place was its extensibility, and the fact that BBEdit is getting a bit long in the tooth. It seemed to me that I could substantially automate several things I do with it in a much more direct fashion than is possible with SD4. I've also been interested in Cameron Hayne's development of ASH (AppleScriptShell); http://www.hayne.net/MacDev/Ash/ and noting that TextMate uses a lot of bash scripts in its bundles, there might be a marriage there.
But what makes Script Debugger so powerful is the amount of information about what's going on that it reveals, and it's very handy palettes. According to the developer, SD4 is a mixed app - "Script Debugger 4 is a Cocoa application. It does make use of many Carbon services, but the user interface and text editor are all based on Cocoa."
But if you're interested in this, I'm positive we could get it working in Script Debugger using UI scripting. If you can't figure it out, I'm willing to lend a hand.
Otherwise, the Edit in TextMate input manager is really nice.
Until TM 2.0, editing applescripts using TextMate isn't really ideal, because AppleScript is too stupid to understand UTF-8 *.applescript files. So to actually use the scripts you make with TM, you either have to dump them into Script Editor (or SD or whatever) and save a compiled script (recommended for several reasons, including that AppleScript compiles scripts incredibly slowly, and needs to open all referenced applications to do so), or else either convert things to macroman before running them, or just avoid non-ascii characters (like ¬).
¬ is an acceptable character in the Script Editor and SD4.
For TextMate 2.0, we should be able to pass things like *.scpt files through a filter on the way into and out of TextMate, which can convert compiled scripts °Í text. At that point, Script Editor can be taken completely out of the workflow.
TextMate isn't very scriptable, but I'll try to write a copy/paste routine to get there.
Hmm, what exactly is your purpose here? I can't really recommend trying to use AppleScript from within TM, unless it's for scripting other apps. You are much better off using a TextMate command, which also puts any language on the system at your fingertips (python, ruby, perl, bash, etc.).[^1]
My purpose isn't very clear to me either. TextMate seems very powerful and flexible and I wanted to explore what it could do. I didn't even know it supported AppleScript until I first ran it; I was more interested in formatting a series of articles for the web that contain embedded AppleScripts (I edit the cover of http://macscripter.net), and was curious whether I could do a better job of formatting the AS than the tag engine on the site does (MacScripter and its forum understand [applescript], [/applescript] tags and format the script with a link that will download it directly to the user's default script editor).
Ahh, but I'm an amateur - a retired Dean of Engineering so I don't know any of those except a smattering of bash. I did teach for a bunch of years in your neighborhood, though - Just down Mass Ave at MIT - left to come here in Admin.
Anyway, If you want to make a TextMate command which runs an applescript, that is quite possible too. I'm going to make a screencast hopefully soon that shows this in action.
Look forward to it.
Anyway, I do hope you'll stick with TextMate. Once you get into the snippets/commands, and the scopes/scope selectors system, I think you'll find it's the most ingenious, intuitive, and easily hackable text editor on the market.
I've got 28 more days to play - hopefully I'll get time to explore.
If you have suggestions for improvements to the AppleScript bundle, I'm all ears. I only use AppleScript when I'm forced to (e.g. to interact with random apps on the system), and though I like to think I understand the language pretty well from reading all the way through the docs that Apple has posted online, I'm definitely not a seasoned expert. TextMate so far hasn't really had too many AppleScripters using it, as far as I know, and there wasn't any bundle for it at all for the first year and a half TextMate existed. So picking up some people who actually know what they're doing can only be good for the bundle, assuming they're willing to contribute ideas, and preferably code too.
Haven't studied it, but will.
I tried to take a look at Script Debugger at some point, but I can't really get into the mental model of the app. But that's true of AppleScript stuff in general... :) If there are any particular problems solved by features of Script Debugger which we should try to solve in TextMate, please speak up.
-Jacob Rus
[^1]: The only downside to TextMate's lack of scriptability that I can see is that it makes it harder for other apps to tell TM to do things. But if/when TextMate does become truly scriptable in this way, I sure hope it's not AppleScript that's the scripting language used ;).
Thanks for the extended response.
Adam
Adam Bell wrote:
It seemed to me that I could substantially automate several things I do with it in a much more direct fashion than is possible with SD4.
Yes indeed. The problem with SD, as with most language-specific editors, is that they by their nature cannot allow as much interesting general behavior as all-purpose editors. Which is why most people use all-purpose editors most of the time. Having the same powerful tools available in every language is really nice. That's not to say that specific editors can't be useful, of course.
interested in Cameron Hayne's development of ASH (AppleScriptShell); http://www.hayne.net/MacDev/Ash/
I'm not sure whether this makes me want to puke, or whether I think it's really cool. Maybe some of each :p. The idea of using applescript interactively, through a perl script, that does some weird voodoo, and has a few of its own odd extensions, is a bit unsettling. Maybe I'll feel ambitious enough to try this out sometime. One of the real problems is that given AppleScript's dependence on bizarre scope-specific stuff, interpreting AppleScript real-time is not really possible. But I sure do wish that Apple had tried to make their language usable interactively. The interactive shell in python is often very useful for testing out ideas.
But what makes Script Debugger so powerful is the amount of information about what's going on that it reveals, and it's very handy palettes.
Hmm, is there anything here you think we should try to steal? What's handy in the palettes? Have you tried any TextMate snippets? The applescript bundle has some cool ones. When I get around to a screencast showing it off, I'll try to show how they work.
because AppleScript is too stupid to understand UTF-8 *.applescript files. [...] or else either convert things to macroman before running them, or just avoid non-ascii characters (like ¬).
¬ is an acceptable character in the Script Editor and SD4.
Yes, but it's not ascii, so if you save a utf-8 *.applescript file with a ¬ in it, and then try to run it with osascript, you'll get a big fat error.
My purpose isn't very clear to me either. TextMate seems very powerful and flexible and I wanted to explore what it could do. I didn't even know it supported AppleScript until I first ran it; I was more interested in formatting a series of articles for the web that contain embedded AppleScripts (I edit the cover of http://macscripter.net), and was curious whether I could do a better job of formatting the AS than the tag engine on the site does (MacScripter and its forum understand [applescript], [/applescript] tags and format the script with a link that will download it directly to the user's default script editor).
Well, you should be able to make a grammar for that forum that can correctly apply syntax highlighting to things in [applescript] tags (and let you use all the handy applescript snippets, etc.) then. If it's just bbcode otherwise, you could easily extend the existing bbcode grammar to do this (or we could even put it in everyone's bbcode bundle, as I doubt anyone else uses [applescript] to mean something different).
Ahh, but I'm an amateur - a retired Dean of Engineering so I don't know any of those except a smattering of bash. I did teach for a bunch of years in your neighborhood, though - Just down Mass Ave at MIT - left to come here in Admin.
You still live around here? [off-topic: If there are other boston-area TM users, it would be neat to do a meetup sometime.]
I've got 28 more days to play - hopefully I'll get time to explore.
Let's hope longer than that!
-Jacob
At 1:26 PM -0500 11/16/06, Jacob Rus wrote:
Adam Bell wrote: -- Snip --
interested in Cameron Hayne's development of ASH (AppleScriptShell); http://www.hayne.net/MacDev/Ash/
-- snip -- The interactive shell in python is often very useful for testing out ideas.
Visit http://freespace.virgin.net/hamish.sanderson/, and click on appscript or rb-appscript for an attempt at combining Python's virtues with application scripting support - a substitute for AppleScript.
But what makes Script Debugger so powerful is the amount of information about what's going on that it reveals, and it's very handy palettes.
Hmm, is there anything here you think we should try to steal? What's handy in the palettes? Have you tried any TextMate snippets? The applescript bundle has some cool ones. When I get around to a screencast showing it off, I'll try to show how they work.
-- snip --
Well, you should be able to make a grammar for that forum that can correctly apply syntax highlighting to things in [applescript] tags (and let you use all the handy applescript snippets, etc.) then. If it's just bbcode otherwise, you could easily extend the existing bbcode grammar to do this (or we could even put it in everyone's bbcode bundle, as I doubt anyone else uses [applescript] to mean something different).
I think it's done in PHP using bbCode bits and pieces - I'll have to get a copy of it from the Ray Barber, and then see if I can interpret figure it out.
-- snip --
You still live around here? [off-topic: If there are other boston-area TM users, it would be neat to do a meetup sometime.]
No, I'm retired to Halifax, Nova Scotia, where my wife and ancestors came from.
Adam