Hi all,
Since I use a lot of applescript in combination with LiveCode, I developed a method to reuse applescripts and feed them parameters with a standardized lc-script. It has taken the form of a masterlibary for scripts to be inserted into a custompropertyset of other stacks. I’ll include the stack in the message. It’s been in use for some 15 years with numerous updates. This year I took some time to make it accessible for others. Hope it will be of use to anybody.
The basic function is as follows:
Use the library to insert a command in the stackscript to execute applescripts. Call the command with the applescript-handlername and the applescript-parameters. The script will lookup the applescript in a custompropertieset of the stack and pass the parameter-values to it.
The command and custompropertiesets are self-contained, they do not need the library.
The AppleScriptLib stack functions as a masterLibrary for applescripts.
Insert scripts from the library into other stacks or update them to the latest version.
The library stack provides the interface to edit the scripts and parameters.
The script-versions are stored in the custompropertiesets 'scriptLib' and 'scriptLibVersion'.
The inserted command is called with:
performAscript scriptName,parameter1, parameter2,etc.
OR:
performAscript scriptName, parameterArray (where the keys of the array are the parameternames)
Besides ‘do as applescript’ there are several other methods included to execute the scripts using the same function. Especially usefull for scripts (e.g. using ObjC) that need to compile to run. One of them saves the script as a tempory compiled scriptfile executed by shell osascript. There are some experimental or not fully developed functions in the stack. Hope to hear what works and what doesn’t!
Regards,
Chris Heidecker
Applescript library
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Applescript library
- Attachments
-
- AppleScriptLib.livecode.zip
- (146.34 KiB) Downloaded 9 times
Re: Applescript library
Hi Chris,
very cool, saved for later use!
Best
Klaus
very cool, saved for later use!
Best
Klaus