on loadLocalUsers()
set my localUsersAndGroupsData to {}
log (length of localUsersAndGroupsData as text)
try
set theRawLocalUsers to do shell script "/usr/bin/dscl . -list /Users UniqueID"
set theRawLocalUsers to every paragraph of theRawLocalUsers
repeat with x in theRawLocalUsers
--log (contents of x as text)
set theTextItems to every word of x
if (item 2 of theTextItems as integer) ≥ 500 then
log (theTextItems as text)
set the end of my localUsersAndGroupsData to {userName:(item 1 of theTextItems), userID:(item 2 of theTextItems), isUser:"User"}
end if
end repeat
log (length of localUsersAndGroupsData as text)
set theRawLocalGroups to do shell script "/usr/bin/dscl . -list /Groups PrimaryGroupID" --get local groups
set theRawLocalGroups to every paragraph of theRawLocalGroups
repeat with x in theRawLocalGroups
set theTextItems to every word of x
if (item 2 of theTextItems as integer) ≥ 500 then
log (theTextItems as text)
set the end of my localUsersAndGroupsData to {userName:(item 1 of theTextItems), userID:(item 2 of theTextItems), isUser:"Group"}
end if
end repeat
log (length of localUsersAndGroupsData as text)
tell theArrayController --load data into the table
removeObjects_(arrangedObjects())
addObjects_(localUsersAndGroupsData)
end tell
--log (length of localUsersAndGroupsData as text)
on error errorMessage number errorNumber
display dialog errorMessage & " " & (errorNumber as text)
end try
end loadLocalUsers