Beginner needs help

I’m a really new beginner, and I’m trying to help my manager troubleshoot a script he has written.
I know this is probably child’s play for the experts here, and I have tried doing a search.

His script takes an InDesign document, packages it and puts it into a new folder of the same file name (droppedItems).

The problem is that when it comes to renaming the folder the script attempts to rename the folder with the whole file path of the original droppedItem.
How do you tell the script to append only the original file name and not the name of the whole path? I’m sure it’s a variant of ‘droppedItems’.

Thank you for your help. :slight_smile:

on run
	display dialog "Whoa Dude, I'm a Droplet so drop an InDesign file on me"
end run

on open draggedItems
	tell application "Finder"
		make new folder at alias "WIP_GRG:Staging_GRG:" with properties {name:"_Folder"}
	end tell
	set folderPath to "WIP_GRG:Staging_GRG:_Folder:"
	repeat with currentFile in draggedItems
		tell application "Adobe InDesign CS3"
			set openedfile to open (currentFile as alias)
			set theDoc to (document 1)
			tell document 1
				package to folderPath copying fonts yes copying linked graphics yes copying profiles no updating graphics yes ignore preflight errors yes creating report yes
				set fileName to (name of theDoc)
				set filepath to folderPath & fileName & ".pdf"
				export openedfile format "Adobe PDF" to filepath using "Smallest File Size"
				close openedfile
			end tell
			tell application "Finder"
				set theFile to draggedItems as text
				set theFolder to name of ("WIP_GRG:Staging_GRG:_Folder" as alias)
				set NewName to (theFile & "_Folder")
				set name of theFolder to NewName
			end tell
		end tell
	end repeat
end open


you probably mean

tell application "Finder"
	set NewName to fileName & "_Folder"
	set name of folder folderPath to NewName
end tell

You’re creating the folder once at the beginning of the open handler.
I guess you want to create a new folder for each dropped file,
so you have to move these lines into the repeat loop

I don’t think this will help me with my ‘file tries to save the entire path name’ issue, will it?

It will, use only these two lines inside the Finder tell block

Yay! It works!

Thank you, so much!