AppleScript

From Processing

Jump to: navigation, search
Versions: 1.0+
Contributors: sojamo
Started: 2008-04-22


This snippet shows how to make AppleScript calls from Processing using the cocoa.foundation implementation. Obviously this is Mac OS X only.

NOTE: This snippet is not working.

Source Code

/**
applescript taken from http://wiki.processing.org/index.php/AppleScript
@author sojamo
*/
import com.apple.cocoa.foundation.*;
 
void setup() {
  size(400,400);
}
 
void keyPressed() {
  // applescript example: ask the finder so say something.
  String script = "tell application \"Finder\" to say \"Hello world how are you.\"";
  executeScript(script);
}
 
void draw() {}
 
void executeScript(String script) {
  NSAppleScript myScript = new NSAppleScript(script);
  NSMutableDictionary errors = new NSMutableDictionary();
  myScript.execute(errors);  
}

Downloads

Related Links

Using Cocoa Discourse forum

Personal tools