Reading Script Text


Is there a way to read the script text mainly for compiled scripts? If there’s a way to read the bundled ones or even apps then even better.

I am trying to search scripts because they are getting hard to find.

Edited: I’ve never scripted the script editor, but maybe something like this:
text of front document
I was hoping that there might be another way rather than opening the script editor.


Just checked the resource fork and it’s still there. I’m thinking that it only contains the main info like file type and creator type though.

Osadecompile to read compiled scripts as text, osacompile to write them back out.


There is no need to convert the scripts to text or anything for searching really, if what you are searching for is a single word, and not all occurences of say a variable.

Then I just enter “kind: osa mysearchterm” in the Spotlight Bar. I realize that I may have an upper hand here, since Script Debugger comes with a preview plugin, so that I can preview my code in the Spotlight Window. I don’t find it unrealistic that some other entity, has made a similiar plugin that they provide for free. At least there was a free Spotlight plugin for AppleScript before Apple Provided one.

Hi alastor933,

Oh yeah. :slight_smile:

Thanks a lot,

Hi McUsr,

Yes, that doesn’t work here without the plug-in. I’m wondering how long it would take to decompile all the scripts. Need to reread the man page.

Thanks anyway,

So far, the osadecompile is working great! Searched for .scpt, .scptd, .applescript, …

i haven’t tried any of these, and why should I since I have paid for Script Debugger?

But try this google query: quick look plugin applescript, and you’ll see that there are numerous free solutions out there, that lets you live a whole lot more comfortable… :slight_smile: (Sometimes I think using osadecompile to be a good solution though, maybe after a spotlight query.)

Hi McUsr,

I was thinking of saving the script text with osadecompile as key value pairs where the keys are the posix paths to the script. Then I just search all keys for values that contain the search text. THere’s so many ways to do this (e.g. database, xml, applescript, sqlite3 and who knows what else. Earlier, I was thinking about storing the text in Notes. Need to look at this again tomorrow.

Have a good day,

ps. Hope I can sleep. :slight_smile:


Just getting references to the files took too long.

set scpt_scripts to (do shell script "find ~ -name *.scpt")
set c to count (paragraphs of scpt_scripts)

Not a good sign. :frowning: Now, really need to store all the text.

Maybe you should take a peek at ScriptLight.


I am sure that ScriptLight is a good application to have, but personally, I swear to having a quicklook plugin, that I pereuse the results I get in the Spotlight Window.

Given that the first match in the google query I specifed first works, then I think you should try the free option, and see if it works for you. :slight_smile: