Hello all.
Im trying to make a user build script to simplify building consistant molithic diskimages within our lab.
In the script below, Im asking the user to select from a list of users enabled on the system - so far so good. The script gets the list of all the enabled users, from which Im able to access the properties. The properties for each user however have nested properties, and I just cant seem to figure out how to get at them.
The script looks like this so far:
property theUsers : null
property user_name : null
set superUser to "root" as string
set usersList to {}
tell application "System Events"
set user_name to name of current user as text
set theUsers to every user
if user_name is not superUser then
--display alert "You are not running this as Super User so we will quit now"
--quit
end if
if user_name is superUser then
--display alert "we ARE running as root"
end if
end tell
--
repeat with theUser in theUsers
set temp to the properties of theUser
if the name of temp is not "Guest" then
copy the name of temp to the end of usersList
end if
end repeat
log usersList
set selectedUser to choose from list usersList
repeat with theUser in theUsers
set temp to the properties of theUser
if the name of temp is selectedUser as string then
display alert "Found: " & selectedUser
set homePath to home directory
end if
end repeat
log homePath
At the moment the properties of the userList contain entries that look like this:
get properties of user "test"
--> {name:"test", picture path:missing value, full name:"a.test", class:user, home directory:file "Macintosh HD:Users:test:"}
Im trying to access the value of the “home directory:file” attribute to pass into a varriable to use later. Its here that I seem to be stuck - can anyone give me a nudge in the right direction?
many thanks in advance