Apple: AppleScript In Panther

“Mac OS X v10.3 contains one of the most significant releases of AppleScript in the last decade. AppleScript in Panther includes dramatic changes to existing AppleScript tools, and introduces powerful new features and applications.” …

Whowww… Too dramatic! A bit of commercial s*it in AS’s main page, but great stuff coming in the release notes (which you posted in another thread). Here a brief abstract, if you hate reading long release notes:
Script/app bundles (recent request, coooool!)
Support for “embedded” scripting additions in bundles (lots of years waiting for this, cooool!!!)
Enhacements to choose files/folders (lots of years waiting for this)
Idle and delay accepts a real number (finally, break the 1 second limit!)
“The display dialog command now supports Unicode and can now display more than 255 characters” (protohistoric need)
“The path to command now has a folder creation parameter” (walk folders?)
Enhacements to osacompile and osascript. Good.

Bug fixes: lots of fixes related to text handling and maths. Specially relevant (for me), all fixes involving stack overflow and TIDs.

"The offset command now ignores case by default " (bad for me, more hand-coding)
typeText, typeCString, and typePString, are all deprecated as of AppleScript 1.9.2 (I will miss them soooooo much)
I think this is a very serious update, I’d really pay the 500 bucks only for it! Do you know if this will be available as a separate download for Jaguar folks?
I’m only waiting for a serious and free clone of 24u’s Appearance (the new tandem DD/DS?), and I will trash definitivelly my copy of AS-Studio. It has lots of potential, sure, such as drag & drop, tables, etc, but I hate when I spend 15 minutes creating the real code and waste several days working in the interface. Grrrr. Perhaps I will ship only handlers and vanilla stuff from now, and interfaces as a separate product. :rolleyes:

Thanks for the pointer, Rob. This release has a lot of interesting, useful, and often-requested features. It seems one or two of my favourite techniques could soon be rendered redundant… :wink:

According to the release notes, it requires OS 10.3 or later.

JJ check out Pashua 0.6.1, it’s a freeware for adding interfaces to a dialog window for Applescript and many other scripting languages.

AppleScript in Panther is a very significant release. As you’ve noted it addresses many old issues while introducing powerful new features. Personally, Image Events and URL Protocol support are two favorites and have tremendous potential.


Sal Soghoian
AppleScript Product Manager

Sal, will there be a upgrade version of AppleScript and the Script Editor for Jaguar?

Based on the release notes, this looks like the most significant AppleScript release since I started using Macs (when the release of System 7 was big news). I don’t have Panther, and it will likely be quite some time until I am able to afford it, but I can hardly wait based simply on the changes to AppleScript. I’m in pain! :wink:

Kudos to Sal and the entire AppleScript/AppleScript Studio team!

– Rob

Much of the work done with AppleScript this release is directly tied to the Panther code base and can’t be ported to earlier versions of the OS, even Jaguar.

However, in recognition that some scripters may work in environments requiring editing scripts in Mac OS X v10.2, a beta-version of the Script Editor application for Jaguar is posted at this hidden link:

It’s the same beta we released this year.[/url]

I look at URL Protocol Scripting as a great thing too. The potential is fantastic, and I wish it were in place and acting properly right now. The biggest complaint so far is that special characters aren’t recognized. (High Ascii), for instance the continuation character ¬ or any of the commonly used AppleScript key combos will bomb, or create a blank Script Editor window. Also, in forums such as this, it takes special care to get URL Protocol Messaging to work.

Click This

But if I add an ‘option + the ell key’ “¬” combo it dies, eg.,

display dialog "Hello! ¬

Not a practical example, but a simple one.

The above code for 'Click This" is…


But if I were to follow Apples guidlines the code would look something like this…

applescript:// dialog %22Hello!%22

In essence, the code posted above is altogether different from the suggested code format at Apple’s URL Protocol Messaging web site.

URL Protocol Messaging has great potential only If we could figure out a way of getting past the special character issue, then we’d be groovin’ for sure. But for now it seems as though we’ve hit a dead end, and a lot of folks just won’t give in to losing a lot of things in order to gain one thing.

If you download the formatting script from Apple “The Encoding Script”, here’s what you’ll get for the above code…


The above code may render in a specialized html page, but it will most certainly not work here.

OK, I’m confused and missing something obvious here. Why doesn’t this become a clickable link? Is it becasue the PHP routines are looking for http://?

Click Here

No encasing quotes around script code:
Click Here

No encasing quotes and a slash after scripteditor:
Click Here

Encasing quotes and slash after scripteditor:
Click Here

I think the problem is in the PHP routines generating URLs placed in messages.

Image Script

Encode space characters:
Image Script


Problem: forum encoder does not accept spaces in urls
Answer: Edit the encoding script from the Apple website to remove the space character from the list of acceptable characters. The space character was counted as acceptable to reduce the length of encoded URLs. It works encoded or not.

Problem: forum encoder needs forward slash after domain declaration
Answer: add forward slash after domain declaration as in:


As for high ASCII problem. Sorry about that. It crept in late in the development process. It will be fixed. Until then, avoid using curley quotes and new line characters.

You can add this line to the encoding script to auto-generate a link style for this forum (be sure to also remove the space character from the string of acceptable characters):

set this_text to my encode_text(this_text)
set this_text to "[url=applescript://" & this_text & "]click for script[/url]"

set the clipboard to this_text

I’ll post a version of the encoding script on the URL Protocol page that generates the Macscripter style link.

My script, Convert Script to Markup Code can create AS URLs for entire scripts in Script Editor. It generates the straight HTML necessary for the URL but not the BBCode–a light modification can fix this. There is still the error Greg mentioned about high-Mac ASCII characters, however.


The only problems is not “high-ascii” characters, but every-browser-passing-those-characters-to-the-script-editor.

I worked some time ago in a little script called “Run ASCRIPT”, which did the same that the script editor is actually trying to do (with some more options): “run/copy/save to disk” applescript code.

There is not a definitive solution, unless you design the app to work only with text passed by a single browser (eg, Safari), except for a very complex work with javascript: (if browser is x then set carriage-returns to y, else if browser is x then set carriage-returns to y, else…).

The text passed from differents browsers does not use allways the same encoding. Also, it is not the same pass code from a regular link than pass code from a form (after clicking a button).

I think the only solution is url-encoding every character different than [:alnum:] chars, and pass such string to the script editor/whatever GURLGURL handler, which will decode the entire chain. As in:

property safeChars : "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_."

set theScript to "set x to "Sample string with special cháracterërs"
display dialog x"
set ASLink to "applescript://" & my encodeText(theScript)

on encodeText(k)
	set finalText to {}
	repeat with i in k
		if i is not in contents of safeChars then set i to "%" & my encodeChar(i)
		set finalText's end to i as Unicode text
	end repeat
	return "" & finalText
end encodeText
on encodeChar(this_char)
		((last character of ({{coercionTrick:this_char as Unicode text}} as string)) as C string) * 5
	on error msg
		return text from character 22 of msg to character 23 of msg
	end try
end encodeChar

Nicely done! Thank you for contributing this to the community.

URL Protocol Support in the Panther Scripte Editor is designed to work with Safari. Other browsers or apps may or may not have a problem with the extended URLs.

Here’s a version of the encoding script that creates a link for use here at

encoding script

I’ve updated my Convert Script to Markup Code scripts to handle the modifications to the AS URL for posting as BBCode on this BBS. I’ve also added two new scripts for converting Project Builder or Xcode AppleScript as well. The scripts can be directly downloaded from [url=][/url] and will be on ScriptBuilder’s shortly. (The Script Debugger version, sadly, is still included but has not been updated as I wrote it using the demo version of the app and my demo has expired. If someone would like to update it, by all means, go ahead.)

Thanks for the compliment, Sal. You know, a few months ago I left you a private message on this board announcing these scripts and offering to have Apple post them (the offer still stands). It looks like you’ve got a new user name so perhaps you didn’t check that account.


Thanks for all the great tips and scripts Sal and Jon. Jon it looks like your script leaves the ampersands around the filename variable in the text…
Open the AppleScript &str-hex.scpt& in a new Script Editor window.

[This script was automatically tagged for color coded syntax by Script to Markup Code]

Good catch, Greg. I’ve got a fix on the way. If you can take down the previous upload to ScriptBuilders, a new version will be posted within the hour.


Will do. I deleted v2.1.6, so you can use the same name for the next upload as the 2.1.6 version no longer exists in the db.