[英]Apple Script to turn File Sharing off & on in one script
我正在努力寫一個腳本,該腳本在10.8中進行以下操作。 :
-取消選中“共享”控制面板中的“文件共享”
-檢查“共享”控制面板中的“文件共享”
-確保在腳本完成時選中它
為什么我要這樣做? 因為10.8中有一個錯誤。 使用Samba(無法從另一台計算機進行smb登錄)時,如果啟動時關閉了文件共享功能,則一切正常。
有人可以幫助我嗎……? 對你們來說應該很容易:-)
預先非常感謝,最好-Ph!L!pp
此代碼應切換共享首選項,等待1秒鍾,然后再次切換它們。
tell application "System Preferences"
activate
end tell
tell application "System Events"
tell process "System Preferences"
click menu item "Sharing" of menu "View" of menu bar 1
delay 2
tell window "Sharing"
click checkbox 1 of row 3 of table 1 of scroll area 1 of group 1
delay 1
if (exists sheet 1) then
if (exists button "Turn AirPort On" of sheet 1) then
click button "Turn AirPort On" of sheet 1
delay 1
end if
click button "Start" of sheet 1
end if
end tell
end tell
end tell
delay 1
tell application "System Events"
tell process "System Preferences"
click menu item "Sharing" of menu "View" of menu bar 1
delay 2
tell window "Sharing"
click checkbox 1 of row 3 of table 1 of scroll area 1 of group 1
delay 1
if (exists sheet 1) then
if (exists button "Turn AirPort On" of sheet 1) then
click button "Turn AirPort On" of sheet 1
delay 1
end if
click button "Start" of sheet 1
end if
end tell
end tell
end tell
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.