苹果脚本将文件共享关闭在一个脚本

问题描述:

我拉我的头发写一个脚本,在10.8做以下。 :苹果脚本将文件共享关闭在一个脚本

-uncheck在“共享”中的“共享”“文件共享” ControlPanel控制

- 检查“文件共享” ControlPanel控制

- 确保当脚本完成

检查

为什么我想这样做?因为在10.8中有一个错误。与桑巴(不能从另一台机器smb登录),如果启动时文件共享关闭了一切,一切都很好。

任何人都可以帮我解决这个问题吗?应该是一个容易为你们:-)

非常感谢你提前,BEST-博士!升!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 
+0

Thanx,很快!但是,这是否也确保脚本结束时文件共享处于打开状态? Best- – user3752662

+0

我编辑了代码,现在它会切换两次首选项。这意味着,为了在脚本完成时让文件共享,在运行脚本之前,您将需要它。 –

+0

再次感谢!我想,延迟1 3(..?)点击是需要关闭和回...无论如何,它得到它的工作now.thx再次&最好 - – user3752662