Guest User

Untitled

a guest
May 24th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. (*
  2. Open & Run Generative Programming IDE
  3. Author: VoQn
  4.  
  5. Usase:
  6. ex Processing
  7. $osascript openAndRunSketch.applescript Processing ~/Documents/Processing/sketch/sketch.pde
  8. ex NodeBox
  9. $osascript openAndRunSketch.applescript NodeBox ~/Documents/NodeBox/sketch.py
  10.  
  11. Last Update: 2010/05/03
  12. *)
  13.  
  14. on run argv
  15. global ARG_ERR
  16. global FILE_NOT_FOUND
  17.  
  18. set ARG_ERR to "Argument Error :: this script need 2 arguments -> ${ApplicationName} ${SketchFilePath}"
  19. set FILE_NOT_FOUND to "File not found"
  20.  
  21. try
  22. set appName to item 1 of argv
  23. set filePath to item 2 of argv
  24. on error
  25. return ARG_ERR
  26. end try
  27.  
  28. -- open sketch file
  29. tell application appName
  30. activate
  31. try
  32. open (filePath as POSIX file)
  33. on error
  34. return FILE_NOT_FOUND
  35. end try
  36. end tell
  37.  
  38. -- run sketch
  39. tell application "System Events"
  40. tell application process appName
  41. key down command
  42. keystroke "r"
  43. key up command
  44. end tell
  45. end tell
  46.  
  47. end run
Add Comment
Please, Sign In to add comment