[英]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.