Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: exp_jstalk
Fetching contributors…

Cannot retrieve contributors at this time

46 lines (34 sloc) 1.245 kb
// "T" is a global dictionary, which is used to pass (serialized) values back and forth between apps.
// We can pretend it stands for "transport" or something like that. Idealy, we could get rid of it.
T.pngPath = "/tmp/bob.png";
// The code block for JTalk is sent to Acorn over a CFMessagePort, and it runs it in
// it's own JavaScript instance, using the cocoa bridge.
x = JSTalk("Acorn") {
App.activate()
// changing the variable, just to test that it gets sent back.
T.pngPath = "/tmp/sam.png"
doc = App.open("/Volumes/srv/Users/gus/Desktop/sortme/ridge.acorn");
doc.windowController().callFilterWithName("CIGaussianBlur")
doc.dataOfType("public.png").writeToFile(T.pngPath);
doc.undoManager().undo()
//doc.close();
return true;
}
if (x) {
// JSApp uses the scripting bridge, so all those apple events you have exposed can
// be put to good use.
QT = JSApp("QuickTime Player");
QT.open(T.pngPath)
QT.activate()
print("All done.")
}
else {
print("Not a good response from Acorn...");
}
// get rid of the image.
jsc.system("rm " + T.pngPath);
/*
This would control iTunes... neat huh?
iTunes = JSApp("iTunes");
iTunes.playpause();
*/
Jump to Line
Something went wrong with that request. Please try again.