Re: How to Create Finder Folders from BBEdit Text List

2019-01-23 Thread Chad Myers
As an alternative to changing IFS, you can quote or escape the spaces in 
the text file normally and then use eval to run the output through the 
shell parser again before mkdir executes.

dirs.txt:
dir2
dir 3
dir\ 4
dir5
"dir 6 7"

eval mkdir `cat dirs.txt`  # or eval mkdir $(cat dirs.txt), depending on 
your preference for `` or $()

Results in:
drwxr-xr-x  2 cmyers  wheel  68 Jan 23 14:29 3/
drwxr-xr-x  2 cmyers  wheel  68 Jan 23 14:29 dir/
drwxr-xr-x  2 cmyers  wheel  68 Jan 23 14:29 dir 4/
drwxr-xr-x  2 cmyers  wheel  68 Jan 23 14:29 dir 6 7/
drwxr-xr-x  2 cmyers  wheel  68 Jan 23 14:29 dir2/
drwxr-xr-x  2 cmyers  wheel  68 Jan 23 14:29 dir5/

3 and dir were created since the "dir 3" line didn't have the embedded 
space quoted / escaped, but all of the others were created as expected.

Cheers!

-Chad

On Wednesday, January 16, 2019 at 2:33:22 PM UTC-5, Christopher Stone wrote:
>
> On 01/16/2019, at 08:56, Dave > wrote:
>
> I have a correction to make. I don't think there's actually any way to 
> escape the spaces or quote the folder names in list like this, so if you 
> need to use folder names with spaces (something I avoid, btw) what you need 
> to do is to remove the space charater from the $IFS environment variable, 
> e.g.
>
> --
>
> Hey Dave,
>
> Something like this will work:
>
> oldIFS=$IFS; IFS=$'\n'; mkdir `cat ~/Downloads/test.txt`; IFS=$oldIFS
>
> --
> Take Care,
> Chris
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to Create Finder Folders from BBEdit Text List

2019-01-23 Thread Chad Myers
As an alternative to changing IFS, you can quote or escape the spaces in 
the text file normally and then use eval to run the output through the 
shell parser again before mkdir executes.

dirs.txt:
dir2
dir 3
dir\ 4
dir5
"dir 6 7"

eval mkdir `cat dirs.txt`  # or eval mkdir $(cat dirs.txt), depending on 
your preference for `` or $()

Results in:
drwxr-xr-x  2 cmyers  wheel  68 Jan 23 14:29 dir 4/
drwxr-xr-x  2 cmyers  wheel  68 Jan 23 14:29 dir 6 7/
drwxr-xr-x  2 cmyers  wheel  68 Jan 23 14:29 dir1/
drwxr-xr-x  2 cmyers  wheel  68 Jan 23 14:29 dir2/
drwxr-xr-x  2 cmyers  wheel  68 Jan 23 14:29 dir5/

Cheers!

-Chad

On Friday, January 18, 2019 at 7:10:55 PM UTC-5, Christopher Stone wrote:
>
> On 01/16/2019, at 19:03, Dave > wrote:
>
> Thanks, Chris. I've always used that literal newline inside single quotes 
> in scripts and the command-line, but people think there's something wrong 
> when they see that continuation prompt. 
>
> --
>
> Hey Dave,
>
> The specific point is that the script does everything.  The user only has 
> to provide the text file with the directory list.
>
> On the other hand I *do* prefer to use a token for a newline character, 
> because it reads more clearly for me.
>
> oldIFS=$IFS; IFS=$'\n'; mkdir `cat ~/Downloads/test.txt`; IFS=$oldIFS
>
> In this case Bash 4.4.23 on macOS Sierra 10.12.6 won't convert a 
> double-quoted string into a newline for the IFS parameter, so I had to 
> resort to using a C string.
>
> --
> Take Care,
> Chris
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to Create Finder Folders from BBEdit Text List

2019-01-18 Thread Christopher Stone
On 01/16/2019, at 19:03, Dave mailto:dave.live...@gmail.com>> wrote:
> Thanks, Chris. I've always used that literal newline inside single quotes in 
> scripts and the command-line, but people think there's something wrong when 
> they see that continuation prompt. 


Hey Dave,

The specific point is that the script does everything.  The user only has to 
provide the text file with the directory list.

On the other hand I do prefer to use a token for a newline character, because 
it reads more clearly for me.

oldIFS=$IFS; IFS=$'\n'; mkdir `cat ~/Downloads/test.txt`; IFS=$oldIFS

In this case Bash 4.4.23 on macOS Sierra 10.12.6 won't convert a double-quoted 
string into a newline for the IFS parameter, so I had to resort to using a C 
string.

--
Take Care,
Chris

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to Create Finder Folders from BBEdit Text List

2019-01-16 Thread Dave
Thanks, Chris. I've always used that literal newline inside sigle quotes in 
scripts and the command-line, but people think there's something wrong when 
they see that continuation prompt. 

On Wednesday, January 16, 2019 at 2:33:22 PM UTC-5, Christopher Stone wrote:
>
> Hey Dave,
>
> Something like this will work:
>
> oldIFS=$IFS; IFS=$'\n'; mkdir `cat ~/Downloads/test.txt`; IFS=$oldIFS
>
> --
> Take Care,
> Chris
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to Create Finder Folders from BBEdit Text List

2019-01-16 Thread Christopher Stone
On 01/16/2019, at 08:56, Dave mailto:dave.live...@gmail.com>> wrote:
> I have a correction to make. I don't think there's actually any way to escape 
> the spaces or quote the folder names in list like this, so if you need to use 
> folder names with spaces (something I avoid, btw) what you need to do is to 
> remove the space charater from the $IFS environment variable, e.g.


Hey Dave,

Something like this will work:

oldIFS=$IFS; IFS=$'\n'; mkdir `cat ~/Downloads/test.txt`; IFS=$oldIFS

--
Take Care,
Chris

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to Create Finder Folders from BBEdit Text List

2019-01-16 Thread Dave
I have a correction to make. I don't think there's actually any way to 
escape the spaces or quote the folder names in list like this, so if you 
need to use folder names with spaces (something I avoid, btw) what you need 
to do is to remove the space charater from the $IFS environment variable, 
e.g.
IFS='
'

Then run the mkdir `cat foldernames.txt` command.
You can either reset $IFS to its default value () or 
close your session as further operations that depend on $IFS may yield 
unexpected results.

On Tuesday, January 15, 2019 at 11:10:49 PM UTC-5, Dave wrote:
>
> If you have a space in a folder name, you’ll get two folders unless you 
> quote it. Not what I’d call “blowing up.” 
>
> I only tried it with 330 names. I’m sure there’s a limit, but I don’t know 
> what it is. If you need more folders, make more lists. Or use a loop if it 
> makes you happy. 

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to Create Finder Folders from BBEdit Text List

2019-01-16 Thread Bucky Junior
I suppose we may all have different keyboards. I have an “enter” key over by 
the number pad while “return” is closer to the letters. Control-Return must be 
mapped to “enter.”
Bucky

> On Jan 15, 2019, at 8:30 AM, ThePorgie  wrote:
> 
> According to the manual "Control-Return" should be used.

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to Create Finder Folders from BBEdit Text List

2019-01-16 Thread Sam Hathaway
I generally like to give examples that are as bulletproof as is practical, 
because I don't know how folks are going to apply them.


On January 15, 2019 11:10:54 PM Dave  wrote:

If you have a space in a folder name, you’ll get two folders unless you 
quote it. Not what I’d call “blowing up.”


I only tried it with 330 names. I’m sure there’s a limit, but I don’t know 
what it is. If you need more folders, make more lists. Or use a loop if it 
makes you happy.


--
This is the BBEdit Talk public discussion group. If you have a
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
---
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 bbedit+unsubscr...@googlegroups.com.

To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.




--
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email

"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to Create Finder Folders from BBEdit Text List

2019-01-15 Thread Dave
If you have a space in a folder name, you’ll get two folders unless you quote 
it. Not what I’d call “blowing up.”

I only tried it with 330 names. I’m sure there’s a limit, but I don’t know what 
it is. If you need more folders, make more lists. Or use a loop if it makes you 
happy. 

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to Create Finder Folders from BBEdit Text List

2019-01-15 Thread ThePorgie
I couldn't get this to workSo as an absolute last resort I peeked at 
the manual. ;-). According to the manual "Control-Return" should be used. 
That worked like a charm for me.

On Wednesday, January 9, 2019 at 8:54:54 PM UTC-5, jajls wrote:
>
> On 2019 Jan 9, at 20:27, Bill Kochman > 
> wrote:
>
>
> 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
>
>
>
> Instead of a script, you could use a Shell Worksheet. File > New > Shell 
> Worksheet
>
> Copy your list into the worksheet, then use   Text > Prefix/Suffix Lines… 
>   to prefix each line with "mkdir ". (Be sure to include the space after 
> mkdir.)
> Now change to the container folder: Type on a new line "cd ", then drag 
> the outer folder and drop it so that the line reads, e.g.,
>
>cd ~/Desktop/theOuterFolder
>
> Select that line and type ⌘-Return.
>
> Now select all the mkdir lines (i.e., your list with the added prefixes), 
> and again type ⌘-Return.
>
> Done.
>

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to Create Finder Folders from BBEdit Text List

2019-01-15 Thread Sam Hathaway

On 15 Jan 2019, at 8:04, Dave wrote:

mkdir accepts multiple arguments, so assuming you have a list of names 
called “foldernames.txt,” you can just enter:

mkdir `cat foldernames.txt`
instead of using a loop.


This will blow up if your list of folder names is too long, or if your 
folder names contain spaces.


--
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email

"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to Create Finder Folders from BBEdit Text List

2019-01-11 Thread Bill Kochman
Chris, okay. my next request should be pretty easy, and probably only requires 
some minor modifications to the script that you already sent me.

I am creating a new section on my website consisting of 300 HTML documents.

I have a current HTML document which I want to duplicate 300 times. However, 
with each new document that is made from the original, I want to change the 
name to something else that is included in a name list, similar to the current 
script. Once the 300 new documents are made from the original HTML document, I 
will then edit their contents.

Easy to do?

Kind regards,

Bill

> On Jan 12, 2019, at 5:51 AM, Christopher Stone  
> wrote:
> 
> On 01/11/2019, at 01:18, Bill Kochman  > wrote:
>> Are you saying that I need to paste in a long list of the folder names in 
>> that variable? If so, do I need to separate that by commas, or spaces, or 
>> one name per line, or what?
> 
> 
> Hey Bill,
> 
> See how I've placed the folder names 1 per line here:
> 
> set folderNameList to paragraphs 2 thru -2 of "
> Folder 01
> Folder 02
> Folder 03
> "
> 
> I'm doing all the work for you by transforming a text list into an 
> AppleScript list.
> 
> So all you have to do is paste your list into the variable in place of the 
> current 3 item list.
> 
> Run my script as is from the Applescript Editor and see how it works.
> 
> Change a couple of the names and try that.
> 
> You should then have a feel for how the script works.
> 
> On the other hand – if you want to send me your complete name list I can 
> write you a working script.
> 
> --
> Best Regards,
> Chris
> 
> 
> -- 
> This is the BBEdit Talk public discussion group. If you have a 
> feature request or need technical support, please email
> "supp...@barebones.com" rather than posting to the group.
> Follow @bbedit on Twitter:  >
> --- 
> 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 bbedit+unsubscr...@googlegroups.com 
> .
> To post to this group, send email to bbedit@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/bbedit 
> .

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to Create Finder Folders from BBEdit Text List

2019-01-11 Thread Bill Kochman
Thank you Christopher. I figured it out. I’m just a little slow when it comes 
to understanding these things. :)
 

> On Jan 12, 2019, at 5:51 AM, Christopher Stone  
> wrote:
> 
> On 01/11/2019, at 01:18, Bill Kochman  > wrote:
>> Are you saying that I need to paste in a long list of the folder names in 
>> that variable? If so, do I need to separate that by commas, or spaces, or 
>> one name per line, or what?
> 
> 
> Hey Bill,
> 
> See how I've placed the folder names 1 per line here:
> 
> set folderNameList to paragraphs 2 thru -2 of "
> Folder 01
> Folder 02
> Folder 03
> "
> 
> I'm doing all the work for you by transforming a text list into an 
> AppleScript list.
> 
> So all you have to do is paste your list into the variable in place of the 
> current 3 item list.
> 
> Run my script as is from the Applescript Editor and see how it works.
> 
> Change a couple of the names and try that.
> 
> You should then have a feel for how the script works.
> 
> On the other hand – if you want to send me your complete name list I can 
> write you a working script.
> 
> --
> Best Regards,
> Chris
> 
> 
> -- 
> This is the BBEdit Talk public discussion group. If you have a 
> feature request or need technical support, please email
> "supp...@barebones.com" rather than posting to the group.
> Follow @bbedit on Twitter:  >
> --- 
> 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 bbedit+unsubscr...@googlegroups.com 
> .
> To post to this group, send email to bbedit@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/bbedit 
> .

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to Create Finder Folders from BBEdit Text List

2019-01-11 Thread Christopher Stone
On 01/11/2019, at 01:18, Bill Kochman mailto:wordweaver...@gmail.com>> wrote:
> Are you saying that I need to paste in a long list of the folder names in 
> that variable? If so, do I need to separate that by commas, or spaces, or one 
> name per line, or what?


Hey Bill,

See how I've placed the folder names 1 per line here:

set folderNameList to paragraphs 2 thru -2 of "
Folder 01
Folder 02
Folder 03
"

I'm doing all the work for you by transforming a text list into an AppleScript 
list.

So all you have to do is paste your list into the variable in place of the 
current 3 item list.

Run my script as is from the Applescript Editor and see how it works.

Change a couple of the names and try that.

You should then have a feel for how the script works.

On the other hand – if you want to send me your complete name list I can write 
you a working script.

--
Best Regards,
Chris

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to Create Finder Folders from BBEdit Text List

2019-01-10 Thread Bill Kochman
Hello Christopher,

I apologize for the delay in acknowledging your message, but I have been really 
busy here. I understand how to make AppleScripts in the AppleScript Editor. 
However I don’t quite understand you where you say "Place your folder name list 
in the variable folderNameList”.

Are you saying that I need to paste in a long list of the folder names in that 
variable? If so, do I need to separate that by commas, or spaces, or one name 
per line, or what?

Or are you saying that I need to enter a path to a BBEdit text file on my hard 
drive which contains the list of folder names?

Or do I just run the script from the “Scripts” menu with the actual folder name 
list file open in BBEdit?

Sorry, but it is just not clear to me.

Thanks!

Kind regards,

Bill



> On Jan 10, 2019, at 1:59 PM, Christopher Stone  
> wrote:
> 
> On 01/09/2019, at 19:27, Bill Kochman  > 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
> "supp...@barebones.com" rather than posting to the group.
> Follow @bbedit on Twitter:  >
> --- 
> 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 bbedit+unsubscr...@googlegroups.com 
> .
> To post to this group, send email to bbedit@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/bbedit 
> .

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to Create Finder Folders from BBEdit Text List

2019-01-09 Thread Christopher Stone
On 01/09/2019, at 19:27, Bill Kochman mailto:wordweaver...@gmail.com>> 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
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to Create Finder Folders from BBEdit Text List

2019-01-09 Thread Bill Kochman
Thank you for your input, Jeffrey. I will try both your and Sam’s suggestions a 
bit later today after I finish working on the HTML end of things.

> On Jan 10, 2019, at 11:51 AM, 'Jeffrey Jones' via BBEdit Talk 
>  wrote:
> 
> On 2019 Jan 9, at 20:27, Bill Kochman  > wrote:
>> 
>> 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
> 
> 
> 
> Instead of a script, you could use a Shell Worksheet. File > New > Shell 
> Worksheet
> 
> Copy your list into the worksheet, then use   Text > Prefix/Suffix Lines…   
> to prefix each line with "mkdir ". (Be sure to include the space after mkdir.)
> Now change to the container folder: Type on a new line "cd ", then drag the 
> outer folder and drop it so that the line reads, e.g.,
> 
>cd ~/Desktop/theOuterFolder
> 
> Select that line and type ⌘-Return.
> 
> Now select all the mkdir lines (i.e., your list with the added prefixes), and 
> again type ⌘-Return.
> 
> Done.
> 
> -- 
> This is the BBEdit Talk public discussion group. If you have a 
> feature request or need technical support, please email
> "supp...@barebones.com" rather than posting to the group.
> Follow @bbedit on Twitter:  >
> --- 
> 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 bbedit+unsubscr...@googlegroups.com 
> .
> To post to this group, send email to bbedit@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/bbedit 
> .

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to Create Finder Folders from BBEdit Text List

2019-01-09 Thread 'Jeffrey Jones' via BBEdit Talk
On 2019 Jan 9, at 20:27, Bill Kochman  wrote:
> 
> 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



Instead of a script, you could use a Shell Worksheet. File > New > Shell 
Worksheet

Copy your list into the worksheet, then use   Text > Prefix/Suffix Lines…   to 
prefix each line with "mkdir ". (Be sure to include the space after mkdir.)
Now change to the container folder: Type on a new line "cd ", then drag the 
outer folder and drop it so that the line reads, e.g.,

   cd ~/Desktop/theOuterFolder

Select that line and type ⌘-Return.

Now select all the mkdir lines (i.e., your list with the added prefixes), and 
again type ⌘-Return.

Done.

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to Create Finder Folders from BBEdit Text List

2019-01-09 Thread Sam Hathaway
BBEdit might make this unnecessarily complicated. A shell one-liner would 
suffice. In the terminal:


cd /path/to/base/folder
cat /path/to/foldernames.txt | while read; do mkdir "$REPLY"; done

You can drag your base folder and text file into the terminal window 
instead of typing the full paths.


Hope this helps.
-sam

On January 9, 2019 8:27:54 PM Bill Kochman  wrote:


Hello. I know that it is possible to do this. I am just not an Applescript
or Python expert. So, if someone can help me, I'd really appreciate it.
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. I am assuming that once I have
such a script, I would place it in " ~/Library/Application
Support/BBEdit/Scripts". Thank you in advance to anyone who can help me
with this.

--
This is the BBEdit Talk public discussion group. If you have a
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
---
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 bbedit+unsubscr...@googlegroups.com.

To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.




--
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email

"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.