Created
March 15, 2010 13:54
-
-
Save soh335/332850 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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