update: 2015/05/28
A. 撰寫 AppleScript:
1. 開啟 Automator:
on run {input, parameters}
(* Your script goes here *)
return input
end run
5. 修改如下:
on run {input, parameters}
tell application "System Events"
set ProcessList to name of every process
if "APP_client" is in ProcessList then
set ThePID to unix id of process "APP_client"
do shell script "kill -KILL " & ThePID
end if
if "APP_server" is in ProcessList then
set ThePID to unix id of process "APP_server"
do shell script "kill -KILL " & ThePID
end if
end tell
tell application "Finder"
restart
end tell
return input
end run
6. 檔案 > 儲存:
/Lanli/RD/myScript.app
-----------------------------------------------------------------------------------------------
B. 開啟 Processing 撰寫程式如下:
void setup() {
size(200, 200);
}
void draw() {
// draw() must be present for mousePressed() to work
}
void mousePressed() {
open("/Lanli/RD/myScript.app");
exit();
}