Urgently need help for getting short user name

hello everyone…

i’m trying to write a script that get the full path untill a folder i want … my problem is that every machine has a different users… so this is what i came up with


set x to ((system info)'s short user name)
display dialog "HD:Users:"&x&":Desktop:test:"

this script works perfectly when i run in on tiger with script editor Version 2.1 (80), apple script 1.10
but and error message will pop when i run in under panther with script editor Version 2.0 (v43), apple script 1.9.3 . the error is “Syntax Error, Expected “,” but found identifier.” and it select info in my code…

can anyone help?
this is really urgent any help would be greatly appretiated…

thanks,
Psycho-ed

You should check the ‘System Events’ Dictionary on the Panther Mac. To see how it works with that version.

tell application "System Events" to set _name to name of current user as string

or

tell application "Finder"
	set _Path to (path to desktop folder) & ("test") as string
end tell

I was originally going to suggest that, by using the path to command to determine a base path, you could even avoid the need to explicitly get the user’s name altogether ” but I see that you’ve now caught that in your edit, Mark. :slight_smile:

Note that the Finder call isn’t really required ” and that it’s usually better to use the command’s as parameter to return the result in the required form (and then concatenate any further text), rather than to create a list and coerce that to text:


display dialog (path to desktop as Unicode text) & "test:"


thanks a lot kai… it worked… that’s what i needed…
psycho-ed