Loading...
Logo
Processing Forum
Just thought this may come handy to some...

I'm using Sublime Text 2 as my main editor and was annoyed by the extra clicks I had to go through every time I wanted to run the sketch in Processing. So instead I'm using a very simple Autohotkey script to find the correct Processing window and send ctrl-r. Trivial, but it really saves some clicks and avoids having to deal with the command line... 

here's the script:
Copy code
  1. #b::
  2. SetTitleMatchMode, 2
  3. ;assuming we're in the editor right now
  4. WinGetActiveTitle, st2

  5. ; title contains filename and some extra bits. trim from right to cut of editor name and file extension from title (21 characters in this case)
  6. StringTrimRight, st2trim, st2, 21

  7. ; we only want the last part of the filename
  8. StringSplit, arr, st2trim,\
  9. f := arr%arr0%

  10. ; open the Processing window and send ctrl-r to run
  11. WinActivate,%f% | Processing 1.5.1
  12. send ^r

Hope it's of use to someone...

Michael

Replies(3)

Thanks for sharing.
But when you just send Ctrl+R to Processing, you run the sketch which is loaded, not the one you just edited?
I have to click to the Open button of the toolbar, and navigate through the menu of sketches to go to the current one to reload it. I still wait for a "reload current sketch" shortcut in the PDE (or an auto-detection of changes when PDE regains the focus). Did I miss it?
When you have the "external editor" option checked in the PDE preferences, it automatically reloads the sketch before running it.
Ah, OK. I never use this mode, because sometime I paste small code from this forum, not wanting to save it. It would be a hassle to switch between modes.