• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Help with retrofitting folder applescript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with retrofitting folder applescript


  • Subject: Re: Help with retrofitting folder applescript
  • From: Lachlan Deck <email@hidden>
  • Date: Thu, 23 May 2002 11:43:17 +1000

Hi Tim,

here's a much easier version (below) to maintain - let me know if it helps.

It's a Mac OS X version only. (As it utilises the shell)
It could obviously be updated to be backward compatible.

Cheers

Tim Watson,
Creative Director/Owner
----------------------------------------------------------------------------
Visual Inventor Ltd. Co.
http://www.visual-inventor.com
1.877.842.6768 | 405.842.6768

with regards,

--
Lachlan Deck
email@hidden

========Script==========
property subFolders : ,
{"_Photoshop", "_Photoshop/nav", "_Photoshop/main", "_Photoshop/interior-pages", "_Photoshop/headers", ,
"_Updates", "_Flash", "_Comps", "_Multimeda", "_Freehand_files", "_Assets_from_client", ,
"htmlfolder", "htmlfolder/admin", "htmlfolder/templates", "htmlfolder/includes", "htmlfolder/multimedia", ,
"htmlfolder/mainsite", "htmlfolder/mainsite/nav", "htmlfolder/mainsite/images", ,
"htmlfolder/coming-soon", "htmlfolder/coming-soon/images", ,
"online-presentation", "online-presentation/images"} -- the folder structure
property symlinks : ,
{{"_Photoshop/comps", "_Comps"}} -- list of symbolic links to create {{link,target},{link,target}...}

on chooseFolder()
set folderPath to ((choose folder with prompt "Locate the JOBS folder on the server, select it and hit choose.") as string)
set theName to text returned of ,
(display dialog "The Name the new folder?" buttons {"Cancel", "Create..."} default answer "" default button 2) as string
if theName is not equal to "" then
return (folderPath & theName)
else
return null
end if
end chooseFolder

on makeFolders(theFolder)
try
do shell script "mkdir " & theFolder
set theFolder to theFolder & "/"
set theNum to the number of items in subFolders
repeat with i from 1 to theNum
set this_folder to (item i of subFolders)
do shell script ("mkdir " & theFolder & this_folder)
end repeat
return sym_links(theFolder)
on error the_message
display dialog the_message
return false
end try
end makeFolders

on sym_links(theFolder)
try
set theNum to the number of items in symlinks
repeat with i from 1 to theNum
set this_pair to item i of symlinks
set theLink to (theFolder & (item 1 of this_pair))
set theSource to (theFolder & (item 2 of this_pair))
do shell script ("ln -s " & theSource & " " & theLink)
end repeat
return true
on error the_message
display dialog the_message
return false
end try
end sym_links

on run
set theResult to chooseFolder()
if theResult is not equal to null then
if (makeFolders(POSIX path of (theResult)) is equal to true) then
tell application "Finder"
activate
open folder theResult
end tell
end if
else
display dialog "Sorry - no folder was created (Bad Name!)" giving up after 10
end if
end run
======================
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
  • Prev by Date: OS X: Confirming Administrators PassWord
  • Next by Date: Re: Beginner here
  • Previous by thread: Help with retrofitting folder applescript
  • Next by thread: Beginner here
  • Index(es):
    • Date
    • Thread