I have a G3 iBook and a dual G4 PowerMac. Both are running the latest version of OS X (10.4.5) However, this line:
tell application "System Events" to set this_user to (name of current user)
works just fine on the G3 iBook, but results in this error on the PowerMac:
“System Events got an error: Can’t make name of current user into type reference.”
This is for a backup script I am working on to keep fresh copies of selected folders from both machines on a single flash drive. Each machine has 3 users, and each user has different “precious” folders of data. I want the user name to name the folder on the flash drive where all the backup files will be written. I used it last night on the 3 users at home on the iBook, and it worked famously. I am trying to get it to function on the on the PowerMac today.
FWIW, Craig, works a treat on my G5 (10.4.5), but just as an experiment, try inserting more parentheses:
tell application "System Events" to set this_user to (name of (current user))
Thanks, Adam, still no go. The really bad news is that it works fabulously on the other users on the same machine, just not on the primary user. I am thinking I am in some trouble; I bought this machine used about 3 years ago, but never wiped the drive; I only erased everything and gave the primary user a new screen name and password. I cannot even pronounce the user name: bhuricomepeerayos. I have been reading off and on over the past 2 years about going in via Terminal to fix the whole thing, but I am pretty nervous about actually doing it.
That it works for other users on the same machine says that it is not the system, so it might be a permissions problem for your user. Have you tried the standard trouble-shooting stuff?
Not yet, I am thinking about running a fix permissions session later on, after I back up the whole system.