Setting the computer name
Setting the computer name
- Subject: Setting the computer name
- From: email@hidden
- Date: Tue, 13 Sep 2005 15:03:51 -0600
- Priority: normal
Greetings, all.
Long-time lurker, first time poster....
I'm trying to develop a script that will, among other things, set the
name of a computer in System Preferences -> Sharing. I've started with a
modified version of Gabe Lucero's inventory script (same basic task I'm
trying to accomplish).
My code:
set result to display dialog "What is the student's login?" default
answer ""
set theLogin to text returned of result
set result to display dialog "Student's grade?" default answer "8"
set theGrade to text returned of result
set result to display dialog "Tag number?" default answer ""
set theTag to text returned of result
set compName to "045-ST" & theGrade & "-x4-" & theLogin & "-" & theTag
display dialog compName
Everything works fine to this point.
tell application "System Preferences" to activate
tell application "System Preferences to set current pane to pane
"com.apple.preferences.sharing
tell application "System Events"
set value of text field 1 of window "Sharing" to compName
end tell
display dialog "Finished"
Using UI Browser, I'm told that the name of the computer is held in text
field 1 of standard window "Sharing." Further, UI Browser offers the
AppleScript of "set value of text field 1 of window "Sharing" to
"<string>" but I still get the System Events error
"NSReceiverEvaluationScriptError: 4. Googling that tells me that's what
AS throws when the field doesn't exist but UI Browser tells me that's
what it's called.
I'm stumped and stuck and would appreciate a shove in the right direction.
Jamey Osborne
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden