[TxMt] Re: Changing the Script Editor

Jacob Rus jrus at hcs.harvard.edu
Thu Nov 16 14:32:58 UTC 2006


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 ;).




More information about the textmate mailing list