嘿傢伙我的Applescript沒有做我期望的。 我的錯誤在哪裏?Apple腳本如果發佈
try
set NAS to do shell script "ping -c 1 192.168.222.5"
if NAS contains "100.0% packet loss" then repeat until NAS contains "0% packet loss"
do shell script "python /Users/Selim/Desktop/wol2.0.sh"
set NAS to do shell script "ping -c 1 192.168.222.5"
end repeat
delay 20
tell application "Terminal" to activate
end try
我想ping到我的NAS,當我沒有得到響應我想喚醒他,但我的腳本停止發送ping後沒有響應。 任何想法我做錯了什麼? 我想發送數據包直到NAS喚醒。
我已經改變了代碼
try
do shell script "ping -c 1 192.168.222.5"
on error
set NAS to "100% packet loss"
repeat while NAS contains "100% packet loss"
do shell script "python /Users/Selim/Desktop/wol2.0.sh"
set NAS to do shell script "ping -c 1 192.168.222.5"
if NAS contains "0% packet loss" then exit repeat
end repeat
say "Server startet, 20 sek"
delay 20
end try
tell application "Terminal" to activate
現在我不知道我是怎麼循環的錯誤命令至極與工作,我從平
請把你的工作的代碼作爲一個答案,並將其標誌「正確的」。 – 2015-04-04 13:40:32