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.
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