Dunce needs help with reall basic folder renaming problem!

Hi all.

I used to use applescript a lot under os 9, I have recently returned to it and I find that a lot of the scripts I used to rely on don’t work under os X. To give you an example:

on open theList
tell application “Finder”
activate
display dialog “Pupil Name?” default answer “” buttons {“OK”} default button 1

	set PupilName to the text returned of the result
	get month of (current date)
	set todays_month to month of (current date)
	set todays_day to day of (current date)
	set todays_year to year of (current date)
	
	set name of selection to PupilName & todays_day & todays_month & todays_year as text
	
end tell

end open

This is supposed to ask me for someones name and rename anything I drop on it with that name and a date. A common thread in my problems is renaming a file or folder, or more specifically I think, just getting applescript to point at it.
Another problem I have is that I want to copy an item to a folder that has a name that has just been created by an applescript or automator. The name of the target folder has today’s date in it and so it is alway different so I can’t just pick the target folder in automator. Any help would be great.

Nick.

Your script is very close, however you have to change a couple of items. The variable that is “theList” in your on open statement is a list of items (if I’m not mistaken) and you need to loop through those items dropped on your application. Just to make sure you are aware of this, this needs to be saved as an application for it to work. When you loop through the items in “theList” then you can target different folders/files. You may need more code if you need to target a specific folder/file for each pupil. This should get you started.

on open theList
	tell application "Finder"
		activate
		repeat with anItem in theList
			display dialog "Pupil Name?" default answer "" buttons {"OK"} default button 1
			set PupilName to the text returned of the result
			get month of (current date)
			set todays_month to month of (current date)
			set todays_day to day of (current date)
			set todays_year to year of (current date)
			set name of anItem to PupilName & todays_day & todays_month & todays_year as text
		end repeat
	end tell
end open

PreTech

Great! Thanks for your help there pretech.

Nick