Applescript Service

I am not a programmer and have been trying to find a way to write an applescript (I would accept javascript - whatever works) to help me with a task I do hundreds of times a day. I will provide as much detail as I can:


When creating a new job we assign the job a Name followed by a letter ID (like D or T) which RARELY would be two letters, followed by a 7 digit number.

Examples:

Name D 1526986

Name Two DK 1526963


I have a set of folders for each kind of project with blank forms, empty folders, etc.

For example, the blank folder "Client Supplied Work" will have:

empty "Proofs" folder

blank " proof" PDF file (inside "Proofs" folder)

empty "786_" folder

empty "Client Supplied" folder


I will copy the "Client Supplied Work" folder into a "Job" folder.

Rename "Client Supplied Work" folder to "Name D 1526986" folder

Enter "Name D 1526986" folder

Rename "786_" folder to "786_Name" folder

Enter "Proofs" folder

Rename " proofs" PDF file to "Name proofs" PDF file


Is it possible to have applescript do this for me? I am not incredibly worried about the jobs with two ID letters. The job names (which are the important information here) can have up to 4 words. I have so far:


tell application "Finder" to set theName to name of item 1 of (get selection)


set the clipboard totheName


I am not sure how to proceed - how to go into the current selected folder (Name D 1526986) to find the "786_" folder and rename using the clipboard, but removing the ID letters and numbers

OS X El Capitan (10.11.6)

Posted on Oct 18, 2018 9:51 AM

Reply

Similar questions

1 reply

Oct 30, 2018 7:16 AM in response to chezarey

tell application "Finder"


activate



--SET JOB FOLDER NAME

set theFile to selection as text

set JobFolderName to name of (theFile as alias)


-- SET JOB NAME

set JobName to ((characters 1 thru -11 of JobFolderName) as string)



--SEARCHES SELECTED JOB FOLDER FOR 144 FOLDER AND SELECTS IT

set target of window 1 to folder "144_" of foldertheFile



--NAME 144 FOLDER

set theFile to selection as text

set TheName to name of (theFile as alias)

set ArtFolderName to ("144_" & JobName)

set name of foldertheFile to ArtFolderName



--SELECT JOB FOLDER

set theFile to selection as text

set target of window 1 to container of foldertheFile


delay 0.1


--SELECT PROOF FOLDER

set theFile to selection as text

set target of window 1 to folder "Proofs" of foldertheFile


--SELECT PROOF PDF


selectfile " proof.pdf" of folder "Proofs" of foldertheFile


delay 0.1



--NAME PROOF PDF

set theFile to selection as text

set TheName to name of (theFile as alias)

set ProofName to (JobName & TheName)

set name of filetheFile to ProofName

end tell


This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Applescript Service

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.