On 01/09/2019, at 19:27, Bill Kochman <[email protected]
<mailto:[email protected]>> wrote:
> Basically, I have a BBEdit text file with a list of about 300 folder names
> alphabetically listed in it, one name per line. I need a script which will
> take those 300 names, and create actual folders with those exact names on my
> hard drive in a folder on my desktop.
Hey Bill,
I'm assuming you want to be able to reuse this at need, so I think a
self-contained script is the way to go.
Here's how to do that with AppleScript.
Place your folder name list in the variable folderNameList, run the script, and
go-to-town.
Save it as an AppleScript using the Applescript Editor to this folder:
~/Library/Application Support/BBEdit/Scripts/
Run it from the script menu or give it a handy keyboard shortcut.
--
Best Regards,
Chris
----------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2019/01/09 21:50
# dMod: 2019/01/09 21:50
# Appl: Finder
# Task: Create a new folder-set on the Desktop from a Name List.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Finder, @Create, @Folder-set, @Set, @Desktop,
@Name, @List
----------------------------------------------------------------
try
set desktopFolderName to "New Folder Set"
set folderNameList to paragraphs 2 thru -2 of "
Folder 01
Folder 02
Folder 03
"
tell application "Finder"
if folder desktopFolderName of desktop exists then
error "Folder " & desktopFolderName & "already exists on the
Desktop!"
else
set newFolder to (make new folder at desktop with properties
{name:desktopFolderName}) as alias
repeat with i in folderNameList
make new folder at newFolder with properties {name:i}
end repeat
activate
reveal newFolder
end if
end tell
on error e number n
set e to e & return & return & "Num: " & n
if n ≠ -128 then
try
tell application (path to frontmost application as text) to set
ddButton to button returned of ¬
(display dialog e with title "ERROR!" buttons {"Copy Error
Message", "Cancel", "OK"} ¬
default button "OK" giving up after 30)
if ddButton = "Copy Error Message" then set the clipboard to e
end try
end if
end try
----------------------------------------------------------------
--
This is the BBEdit Talk public discussion group. If you have a
feature request or need technical support, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <https://www.twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/bbedit.