I’m working on a script to automate the creation of a set series of folders using the filename of the file dropped on the droplet:
- An jpeg file is dropped on droplet
- Script gets the file’s name (only the name without the extension)
- Script creates a new folder with the extracted name in a fixed location
- Script creates 2 new folders inside the previous folder. Folder have fixed names.
- Set folder view options
There are a few ways I can accomplish this series. I’ve got a script started now but this could be accomplished (partly) with an Automator workflow.
I can get 1,3-5 to work on my own. My problems are:
a) I can’t get it to determine the dropped file’s name without the extension.
b) I can’t get it to work if more than one file is dropped on the droplet (AppleScript app)
I have searched AutomatorWorld.com and here and none of the ‘get file name’ solutions seems to work for me.
Here’s psudo-code for what I have so far:
on open imagename
tell application "Finder"
-- code determine file name here
make new folder at *location* with property {name: extracted_name} -- Parent folder
make new folder at *location inside parent folder* with property {name: "full-size"} -- Subfolder
make new folder at *location inside parent folder* with property {name: "thumbnails"} -- Subfolder
-- code to set folder views here
set combined_name to extracted_name & ".jpg"
move file combined_name of *location 1* to *full-size in folder I created above*
move file combined_name of *location 2* to *thumbnails in folder I created above*
end tell
end open
I can get everything else to work fine but I can’t seem to solve the ‘get file name’ problem.
Any ideas? Thanks for your help!
Model: iMac DV SE (Summer 2001); OS X 10.4.6
AppleScript: 1.10.6
Browser: Safari 417.9.3
Operating System: Mac OS X (10.4)