appleScript execute an apple script

part of wslib


String.appleScript


Execute an apple script using the osascript unix command.


(

"tell application \"Finder\"

activate

reveal POSIX file %

 end tell".format( String.scDir.quote ).appleScript;

)


String.asAppleScriptCmd


Creates a valid unix command from an apple script.


(

"tell application \"Finder\"

activate

reveal POSIX file %

 end tell".format( String.scDir.quote ).asAppleScriptCmd.postln.unixCmd;

)




String.keyStroke( mod, app )


Types a keystroke into an application, using an appleScript and "System Events.app". The mod argument adds a mod key, in the form of a String or ( \shift, \cmd, etc). The app argument defines the application to talk to. By default this is SuperCollider.