Changes won't Stick in SysPrefs
Changes won't Stick in SysPrefs
- Subject: Changes won't Stick in SysPrefs
- From: Stephen Ragalevsky <email@hidden>
- Date: Thu, 17 Apr 2003 15:49:33 -0400
I'm trying to build a script that will drop the serial number into the
Sharing control panel as the computer name and Rendezvous name, as well
as in the remote desktop as one of the info lines.
The script drops the right info in, but the changes don't stick. After
System Preferences is quit those changes are lost.
Is there something I'm missing?
thanks
steve
--get serial number
set serial to do shell script "system_profiler | awk '/serial number/ {
print $4 }'"
--remove -s from serial number
set serial to replace_chars(serial, "-", "")
--trim the end of the serial number (to remove unnecessary characters)
set serial to (characters 1 thru -5 of serial) as string
--place the serial number in ComputerName, RendezvousName and in Remote
Desktop info
tell application "System Preferences"
activate
end tell
--note must use system events
tell application "System Events"
tell process "System Preferences"
click menu item "Remote Desktop" of menu "View" of menu bar 1
delay 3
click text field 1 of group 1 of window "Remote Desktop"
set value of text field 1 of group 1 of window "Remote Desktop" to
serial
click button "Show All" of tool bar 1 of window "Remote Desktop"
end tell
tell process "System Preferences"
click menu item "Sharing" of menu "View" of menu bar 1
delay 3
--set computer name
set value of text field 1 of window "Sharing" to serial
--set rendezvous name
set value of text field 2 of window "Sharing" to serial
click button "Show All" of tool bar 1 of window "Sharing"
end tell
end tell
--replace object form apple.com
on replace_chars(this_text, search_string, replacement_string)
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
return this_text
end replace_chars
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.