embedding AppleScript for renaming subfolders

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

I am looking for a solution to the following problem:

filename on desktop is "Word1 Word2 Word3.txt"

I hope to use an embedded Applescript to create a subfolder with a name corresponding to the second word (i.e., Word2) of the original filename. Is this possible?

My initial thought is:
1. add a line to the Hazel rule to "Run AppleScript"
2. Specify the custom attributes imported (Name) and exported (subfolderName) by the embedded AppleScript.
3. set CurrentName to item 1 of inputAttributes
4. set folderName to second word of CurrentName
5. return {hazelOutputAttributes:{subfolderName}}
6. add a line to the Hazel rule to "Sort into subfolder" with the custom pattern "subfolderName"

I know there are steps missing here but not sure how to move forward with this automation.
rtrumbower
 
Posts: 1
Joined: Mon Jul 19, 2021 10:52 am

I believe you emailed in about this. Please only post or email to one place and not both. I replied to you there but in short, lok up "match patterns" in the manual.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support