Script is running out of sequence

Hi all,
Bruce Phillips was a tremedous help in creating this script but I failed to notice an odd behavior and I am hoping someone can point out to me what the problem might be.

The Idea is that when a user logs in they are prompted for the year they graduate and thier username then the finder will look on an already mounted smb volume for the folder named after thier graduation year and then for a sub folder named after a user name. When found the finder adds and alias to the sidebar.

All is good except the finder is adding the folder smb:// graduation year instead of smb:// graduation year/username

It is like the system events is firing to soon or at the wrong point.

Odd note. If I remove the graduation year folder from the finder sidebar and run the script again, without logging out and back in - it will add the UserName folder to the sidebar.

Does anyone have any ideas why this may be?

tell application "Finder"
	activate
	
	display dialog "Please enter the year you graduate:" default answer "" with icon 1
	set GraduateYear to the text returned of result
	
	display dialog "Please enter your username:" default answer "" with icon 1
	set UserName to the text returned of result
	
	reveal ("MER_STUDENTHOME:" & GraduateYear & ":" & UserName & ":")
end tell

tell application "System Events"
	launch
	keystroke "t" using command down
end tell

tell application "Finder" to close front Finder window

Just a thought. you could try delaying System Events:

tell application "System Events"
	launch
	delay 5 -- seconds
	keystroke "t" using command down
end tell

So the exact same thing is happening with the delay.

Now I can actually see that the finder opens the graduation year folder - the name of the graduation year folder is at the top of the finder window- and for five seconds I can see the various folders named for user names then it adds the graduation year folder to the sidebar.

It dosen’t seem to be making it all the way down to the username folder.

I wonder if it is a permissions issue…on the windows server all studnets have permission to read the contents of thier graduation year folders (in order to be able to reach thier username folder) but on the username folders only thier personal account has permissons.
They log onto the mac using their Active Directory account and they can open their username folder with the finder so the permissions are being understood by Tiger… I just thought that maybe the script was being tripped up by that?

Jim.

I believe “reveal” should open the year folder and have the student folder selected.

Hmm.
Is there some instruction similar to reveal that will actually open the student folder?

Does Ctrl+T add the selected folder to the finder sidebar or the currently opened folder?

Jim

Problem Solved.

the student usernames have a prefix that is capitalized. I didn’t realize that as Windows usernames are not case sensitive - and the finder seems to be.

If a student types thier username with the prefix capitalized and the remainder lowercase, the script works perfectly.

Thanks Bruce.

I’ll start another thread to see if applescript can change the prefix to capital letters.

Kjmeyer