我希望用补充文字来改变我角的地址。 因此,我写了一幅将自动做的文字,但是,在建立议会地址方面存在着问题。
set ipAddress to "192.168.110.48"
tell application "System Preferences"
activate
set current pane to pane id "com.apple.preference.network"
end tell
tell application "System Events"
tell process "System Preferences"
click checkbox "Click the lock to make changes." of window "Network"
tell application "System Events" to keystroke "p"
tell application "System Events" to keystroke "a"
tell application "System Events" to keystroke "s"
tell application "System Events" to keystroke "s"
tell application "System Events" to keystroke "w"
tell application "System Events" to keystroke "o"
tell application "System Events" to keystroke return
click button 11 of window "Network"
tell window "Network"
tell sheet 1
tell tab group 1
click radio button "TCP/IP"
set contents of text field 2 to ipAddress
end tell
end tell
end tell
end tell
end tell
Everything executes fine except for this statement
"set contents of text field 2 to ipAddress"
我正在犯以下错误:
error "System Events got an error: Can’t set contents of text field 2 of tab group 1 of sheet 1 of window "Network" of process "System Preferences" to "192.168.110.48"." number -10006 from contents of text field 2 of tab group 1 of sheet 1 of window "Network" of process "System Preferences" I checked the UI elements using UIBrowser so i am sure that i am using the correct elements. What is causing the problem? and Also can u tell a better way to write the same thing?