Wednesday, July 30, 2014

#1 2013-05-01 04:13:52 am

rosedani
Member
Registered: 2013-04-30
Posts: 2

Script for automatically creating a file structure

Hi all,

Sorry this is my first post on this forum so I apologise if it's in the wrong place!

I've been trying to create a script using Applescript/Automator in OSX 10.8.2 that automatically creates a set of files that I use on a regular basis for my client work.

The file structure I want is as follows:

-----------------------------------------------------------------------------------------------

- Job Number_Job Title/ - 01. Artwork
                                      - 02. PDF Proofs
                                      - 02. Cutters
                                      - 04. Visuals
                                      - 05. OUTPUT/ - 01. To Print
                                                             - 02. To Proto
                                                             - 03. To 3D

-----------------------------------------------------------------------------------------------

Ideally I would love it if this could be set up as a simple script that could be double clicked to activate and then the script would automatically create the above folder structure in whatever finder window I have open at the time.

Thanks in advance for your assistance.

Offline

 

#2 2013-05-01 04:42:24 am

StefanK
Member
From: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 10458
Website

Re: Script for automatically creating a file structure

Hi,

welcome to MacScripter.

This post belongs more to AppleScript | OS X than to AppleScript Studio which is an outdated environment of Apple's developer tools.

Try this, save the script as application, save it somewhere, and drag the application icon next to the search field in a opened Finder window

Applescript:



tell application "Finder" to set targetFolder to target of Finder window 1 as text
set jobNumber to getParameter for "Enter Job Number"
set jobTitle to getParameter for "Enter Job Title"
set folderStructure to "/{'01. Artwork','02. PDF Proofs','03. Cutters','04. Visuals','05. OUTPUT'/{'01. To Print','02. To Proto','03. To 3D'}}"
do shell script "/bin/mkdir -p " & quoted form of POSIX path of targetFolder & "/" & quoted form of (jobNumber & "_" & jobTitle) & folderStructure

on getParameter for prompt
   repeat
       display dialog prompt default answer ""
       set parameter to text returned of result
       if result is not "" then return parameter
   end repeat
end getParameter

Last edited by StefanK (2013-05-01 04:44:13 am)


regards

Stefan

Offline

 

#3 2013-05-01 08:36:42 am

rosedani
Member
Registered: 2013-04-30
Posts: 2

Re: Script for automatically creating a file structure

That is exactly what I was looking for! Thank you so much for your speedy response!

Offline

 

#4 2013-09-02 05:57:48 pm

KentuckyMegachurch
Member
Registered: 2013-09-02
Posts: 1

Re: Script for automatically creating a file structure

Hi!  This is great!  How hard would it be to edit this to include the job name into each subfolder title?

Offline

 

#5 2013-09-04 08:55:31 am

StefanK
Member
From: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 10458
Website

Re: Script for automatically creating a file structure

KentuckyMegachurch wrote:

Hi!  This is great!  How hard would it be to edit this to include the job name into each subfolder title?

At which position?


regards

Stefan

Offline

 

Board footer

Powered by FluxBB

[ Generated in 0.061 seconds, 10 queries executed ]

RSS (new topics) RSS (active topics)