This is a work in progress, I will be... Full Story
By Manny Fernandez
May 3, 2020
My Jobs Script and How to Automate It
For years and years, I would create a folder for a customer, then I would create a sub folder for a job and then inside of that sub folder, I would throw files. No rhyme or reason. I would have folders named Docs
or Doc
or docs
or doc
and there was no consistency. One day probably in 2004, I said to my self, “Self, you are going to fix this insanity today come hell or high water” Thus began my addiction to all things Workflow
.
Since then, many people have asked me how I keep my files organized. Here is what I do.
Explanation of my script
- When in
Finder
i type ⌘ 8 (Command 8) - The script asks me the
Job Name
, here I can type something likeDC Firewall Deployment
and hit enter. - Then it prompts me for the
Customer Name
- Then I am prompted for today’s date.
- Next it prompts me for the location I want to save the folder.
- It then creates my folder structure in the location I gave it
- And lastly, it creates a new Evernote Note containing the
Company Name-Project Name
and then the path to where the file is located.
This scripts was created when I was doing more delivery of services where sometimes I had 12 projects going at the same time. The script included prompt to have it create a OmniFocus project where it would look for a text file and every new line was considered a Task
and was added to my task manager as such. However that is NOT the case anymore so I removed it.
The Script
Here is the AppleScript that gets run when I hit the shortcut keys of ⌘ 8
on run {input, parameters} -- Sets up the JobName, CustomerName and location by asking the user set JobName to text returned of (display dialog "Please enter Job Name:" default answer "Job_Name") set Customer to text returned of (display dialog "Customer Name:" default answer "Customer") set DateNow to text returned of (display dialog "Please enter Date:" default answer "Now") set loc to choose folder "Choose Parent Folder Location" -- Sets the filename to be used concatinated with date set newfoldername to DateNow & "-" & JobName set customer2 to Customer & "-" & JobName tell application "Finder" --Parent Directory Structure set dir_1 to make new folder at loc with properties {name:newfoldername} set dir_2 to make new folder at dir_1 with properties {name:"Caps"} set dir_3 to make new folder at dir_1 with properties {name:"Configs"} set dir_4 to make new folder at dir_1 with properties {name:"Diagrams"} set dir_5 to make new folder at dir_1 with properties {name:"Documents"} set dir_6 to make new folder at dir_1 with properties {name:"Scripts"} -- Sub-Folder structure set sub_3_1 to make new folder at dir_3 with properties {name:"Backups"} set sub_3_2 to make new folder at dir_3 with properties {name:"Logs"} set sub_3_3 to make new folder at dir_3 with properties {name:"Sites"} set sub_3_4 to make new folder at dir_3 with properties {name:"Worksheets"} set sub_4_1 to make new folder at dir_4 with properties {name:"Logos"} set sub_4_2 to make new folder at dir_4 with properties {name:"Screenshots"} set sub_4_3 to make new folder at dir_4 with properties {name:"Network Diagrams"} set sub_5_1 to make new folder at dir_5 with properties {name:"Customer"} set sub_5_2 to make new folder at dir_5 with properties {name:"Deliverable"} set sub_5_3 to make new folder at dir_5 with properties {name:"License"} set sub_5_4 to make new folder at dir_5 with properties {name:"Certificates"} set sub_5_5 to make new folder at dir_5 with properties {name:"Fortinet"} set sub_5_6 to make new folder at dir_5 with properties {name:"Validation"} set sub_5_7 to make new folder at dir_5 with properties {name:"Scripts"} -- Creates sub-folders under \Modcomp set sub2_5_1 to make new folder at sub_5_5 with properties {name:"BoMs"} set sub2_5_2 to make new folder at sub_5_5 with properties {name:"Quotes"} set sub2_5_3 to make new folder at sub_5_5 with properties {name:"Private"} set sub2_5_4 to make new folder at sub_5_5 with properties {name:"SoW"} set sub2_5_5 to make new folder at sub_5_5 with properties {name:"Project Docs"} set sub2_5_6 to make new folder at sub_5_5 with properties {name:"Standard"} set sub2_5_7 to make new folder at sub_5_5 with properties {name:"Worksheet"} -- Set variable to be used by Evernote set custfldr to the loc as text end tell tell application "Finder" set the clipboard to the loc as text end tell tell application id "com.evernote.Evernote" create note with text custfldr title customer2 notebook "Inbox" end tell return input end run
Creating the Action
Now I will show you how I automate the scripts. First launch Automator
on the macOS box.
Once you launch Automator
choose Quick Action
and then Choose
Once you get to the following screen, change the Workflow receives
to no input
in any application
. Then scroll down on the middle column until you find Run AppleScript
and drag that over to the right underneath the no input
section.
You will need to replace all the text in the Run AppleScript
section with my script (above)
You will see that the text appears in purple. Click the little hammer icon and it will test your script and debug it. Once complete, you will see the color change. Save it with a name. I chose Workflow11
Creating a Shortcut
Now that we have created the Quick Action
and added the AppleScript
we can now create a keyboard shortcut.
Go to System Preferences
then choose Keyboard
- Choose
Shortcuts
on the top tabs. - Then choose
Services
on the left - Scroll down to the name you saved it as
Workflow11
in my case. - Assign a keystroke. In my case ⌘ 8
Now you can open Finder
and type your keystroke you assigned.
Hope this helps
Recent posts
-
-
I have been playing with the free version of... Full Story
-
In my day job, I am on a lot... Full Story