Skip to content

Instantly share code, notes, and snippets.

@soh335
Created March 15, 2010 13:54
Show Gist options
  • Save soh335/332850 to your computer and use it in GitHub Desktop.
Save soh335/332850 to your computer and use it in GitHub Desktop.
use strict;
use warnings;
my $str;
my $time = $#ARGV > -1 ? pop : 5;
while (<DATA>) {
chomp;
s/^\s+//;
$str .= sprintf ' -e "%s"', $_;
}
my $command = sprintf '/usr/bin/osascript %s', $str;
while ( 1 ) {
sleep $time;
unless ( `ps ax | grep java` =~ /processing\.core\.PApplet/ ) {
system $command;
print localtime(time) . " execute $command\n";
}
}
__DATA__
tell application \"Processing\"
activate
end tell
tell application \"System Events\"
if UI elements enabled then
key down command
keystroke \"r\"
key up command
end if
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment