'elo,
I just finished up my little program, and it works nicely. My code is rather crude, so I was hoping someone might clean it up for me so I can start building better coding habbits. Mucho thanxo.
It’s not terribly long, so here it is:
on awake from nib theObject
delete every menu item of menu of popup button "myButton" of window "myWindow"
set myData to parse()
repeat with anItem in XML contents of myData
if XML tag of anItem is "profile" then
set current_item to (|name| of XML attributes of anItem as string)
make new menu item at end of menu of popup button "myButton" of window "myWindow" with properties {title:current_item, enabled:true}
end if
end repeat
end awake from nib
on clicked theObject
set myData to parse()
set mySelection to the title of current menu item of popup button "myButton" of window "myWindow"
set myLogin to extract(mySelection, myData) as string
with timeout of 15 seconds
try
mount volume ("afp:/at/aadxserve/" & myLogin) as user name myLogin
tell current application
quit
end tell
on error errText number errNum
if errNum = -1028 then
display dialog errText & "
Server cannot be reached. Try again in a few moments."
else
display dialog errText
end if
end try
end timeout
end clicked
on parse()
set xml_source to ((path to desktop) as string) & "login.xml"
set xml_data to parse XML (read file xml_source)
return xml_data
end parse
on extract(user_name, xml_data)
repeat with anItem in XML contents of xml_data
if XML tag of anItem is "profile" and |name| of XML attributes of anItem is user_name then
set myLogin to (account of XML attributes of anItem as string)
end if
end repeat
return myLogin
end extract