Skip to content

Instantly share code, notes, and snippets.

@VoQn
Created May 4, 2010 06:12
Show Gist options
  • Save VoQn/389022 to your computer and use it in GitHub Desktop.
Save VoQn/389022 to your computer and use it in GitHub Desktop.
(*
Open & Run Generative Programming IDE
Author: VoQn
Usase:
ex Processing
$osascript openAndRunSketch.applescript Processing ~/Documents/Processing/sketch/sketch.pde
ex NodeBox
$osascript openAndRunSketch.applescript NodeBox ~/Documents/NodeBox/sketch.py
Last Update: 2010/05/03
*)
on run argv
global ARG_ERR
global FILE_NOT_FOUND
set ARG_ERR to "Argument Error :: this script need 2 arguments -> ${ApplicationName} ${SketchFilePath}"
set FILE_NOT_FOUND to "File not found"
try
set appName to item 1 of argv
set filePath to item 2 of argv
on error
return ARG_ERR
end try
-- open sketch file
tell application appName
activate
try
open (filePath as POSIX file)
on error
return FILE_NOT_FOUND
end try
end tell
-- run sketch
tell application "System Events"
tell application process appName
key down command
keystroke "r"
key up command
end tell
end tell
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment