Re: Where Are Prefs for Open Windows in "Windows" Palette Saved?

2021-03-18 Thread Bill Kochman
Hello Kerri,

Okay, I am a little confused here. Over the many years that I have used BBEdit, 
and participated on this list, I have seen a lot of discussions where list 
members ask questions and get answers and solutions from other list members. 
Certain members here have been very generous with their time, and with their 
particular skills. They have donated free scripts, provided different methods 
for getting things done, taught new users how to use certain BBEdit features, 
etc.

So, if these aren’t the kinds of things which we are supposed to be discussing 
here, then exactly what is permissible on this list, and what isn’t allowed? It 
seems to me that the lines have become rather blurred.

I started this discussion thread with a simple question: Where is the list of 
open BBEdit windows stored on my hard drive?

That is all I need to know. I assumed — perhaps erroneously so — that someone 
with a more thorough knowledge of BBEdit’s folder and file hierarchy would 
provide me with a quick, short answer. But apparently, no one seems to know 
where this information is stored.

I am not making a feature request; and in my view, neither do I need expansive 
technical support. I simply need an answer to that one simple question. Thus, I 
did not see the need to bother Rich and Patrick with it, when I am sure that 
they are busy with much more important matters. However, if no one here can 
answer my question, then, yes, I will write directly to them.

Kind regards,

Bill Kochman, Administrator
Bill’s Bible Basics / Christian Social Network
wordweaver...@gmail.com
https://www.billkochman.com
https://www.csnet.live


> On Mar 18, 2021, at 11:42 PM, Kerri Hicks  wrote:
> 
> Maybe it's time to reiterate what a few of us have mentioned so far:



> --Kerri


-- 
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 here. 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/91C1A7B3-C774-4633-A50A-65A7C7366F4E%40gmail.com.


Re: Where Are Prefs for Open Windows in "Windows" Palette Saved?

2021-03-18 Thread Patrick Woolsey
Hi Bill,

For reference, the Windows palette does nothing more (and nothing less :-) than 
list all the documents & windows currently open within BBEdit, but plays no 
part in managing the latter.

Thus, if BBEdit occasionally does not reopen all the documents that you 
expected, _this_ is the actual issue and it is therefore time to contact tech 
support. :-)

Regards,

 Patrick Woolsey
==
Bare Bones Software, Inc. 



> On Mar 18, 2021, at 09:36, Bill Kochman  wrote:
> 
> Thanks for the suggestion, but what you describe is actually a lot more 
> complicated than what I need. In fact, what I need is ALREADY present on the 
> “Windows” palette on the far right side of my screen. I don’t really need to 
> set up a new system of projects as you describe.
> 
> [...]
> As I have already stated, my singular concern is simply preserving the 
> displayed list of windows in the palette, when they are unexpectedly lost due 
> to one of these unanticipated — and forced — system reboots. There is a lot 
> going on, on my machine on any given day, so I don’t even mess with trying to 
> figure out why these reboots occasionally occur.
> 

[ ... remainder elided ... ]

-- 
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 here. 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/77E435E1-055A-4AB2-9637-760B956B604D%40barebones.com.


Re: Where Are Prefs for Open Windows in "Windows" Palette Saved?

2021-03-18 Thread Bill Kochman
Hi Bruce,

Thanks for the suggestion, but what you describe is actually a lot more 
complicated than what I need. In fact, what I need is ALREADY present on the 
“Windows” palette on the far right side of my screen. I don’t really need to 
set up a new system of projects as you describe.

Basically, I use the “Windows” palette as a huge pasteboard to copy and paste 
snippets of data, or even entire document templates, into new text and HTML 
documents, into my blog posts, into my social media posts, etc. I use a 
separate pasteboard app in my menubar for regular copying and pasting of small 
strings of text. But when it comes to larger things, BBEdit’s “Windows” palette 
works perfectly fine for me, and I use it many times throughout the day, and 
everyday.

As I have already stated, my singular concern is simply preserving the 
displayed list of windows in the palette, when they are unexpectedly lost due 
to one of these unanticipated — and forced — system reboots. There is a lot 
going on, on my machine on any given day, so I don’t even mess with trying to 
figure out why these reboots occasionally occur.

Kind regards,

Bill Kochman, Administrator
Bill’s Bible Basics / Christian Social Network
wordweaver...@gmail.com
https://www.billkochman.com
https://www.csnet.live

> On Mar 18, 2021, at 11:29 AM, Bruce Van Allen  wrote:
> 
> Hi Bill,
> 
> On 17 Mar 2021, at 16:12, Bill Kochman wrote:
> 
>> … So my preferred approach would be to make a backup copy of that file, and 
>> then to replace the current file with it, whenever I face this problem of 
>> windows disappearing from the “Windows” palette due to an unanticipated 
>> system reboot.
>> 
>> So again I ask, does anyone know where that list of open BBEdit windows is 
>> stored?
> 
> Not that file, but isn’t your goal in effect what a BBEdit Project provides?
> 
> I have several work projects going, each with many files that I have to move 
> among while working on that project. They’re often not all in the same 
> folder, sometimes not even on the same disk.
> 
> So for each of my work projects, I create a BBEdit Project (File -> New -> 
> Project…), and use the ‘+’ button lower left to add all the files and 
> directories I need together for that one of my projects. They all show in the 
> left sidebar, and the open ones have a little indicator, which highlights if 
> there are unsaved changes in that file. Directories can be clicked closed 
> when there are so many files that the sidebar has to be scrolled. (Some of my 
> projects have hundreds of files.)
> 
> I’m fortunate to have a large monitor, so I have plenty of screen space for a 
> wide BBEdit window with the sidebar showing the project files.
> 
> Opening the project is one click on the icon, or pick one line from Recent 
> Files.
> 
> Zat get you what you want?
> 
> Thanks,
> 
>- Bruce
> 
> _bruce__van_allen__santa_cruz__ca
> 
> -- 
> 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 here. 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/1222F8C4-0663-40DD-9348-869690CD95B6%40cruzio.com.

-- 
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 here. 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/B4193E99-C628-4C44-92DB-2D956000D357%40gmail.com.


Re: Where Are Prefs for Open Windows in "Windows" Palette Saved?

2021-03-18 Thread Kerri Hicks
Maybe it's time to reiterate what a few of us have mentioned so far:

[image: Screen Shot 2021-03-18 at 9.41.27 AM.png]

--Kerri


On Thu, Mar 18, 2021 at 9:37 AM Bill Kochman 
wrote:

> Hi Bruce,
>
> Thanks for the suggestion, but what you describe is actually a lot more
> complicated than what I need. In fact, what I need is ALREADY present on
> the “Windows” palette on the far right side of my screen. I don’t really
> need to set up a new system of projects as you describe.
>
> Basically, I use the “Windows” palette as a huge pasteboard to copy and
> paste snippets of data, or even entire document templates, into new text
> and HTML documents, into my blog posts, into my social media posts, etc. I
> use a separate pasteboard app in my menubar for regular copying and pasting
> of small strings of text. But when it comes to larger things, BBEdit’s
> “Windows” palette works perfectly fine for me, and I use it many times
> throughout the day, and everyday.
>
> As I have already stated, my singular concern is simply preserving the
> displayed list of windows in the palette, when they are unexpectedly lost
> due to one of these unanticipated — and forced — system reboots. There is a
> lot going on, on my machine on any given day, so I don’t even mess with
> trying to figure out why these reboots occasionally occur.
>
> Kind regards,
>
> Bill Kochman, Administrator
> Bill’s Bible Basics / Christian Social Network
> wordweaver...@gmail.com
> https://www.billkochman.com
> https://www.csnet.live
>
> On Mar 18, 2021, at 11:29 AM, Bruce Van Allen  wrote:
>
> Hi Bill,
>
> On 17 Mar 2021, at 16:12, Bill Kochman wrote:
>
> … So my preferred approach would be to make a backup copy of that file,
> and then to replace the current file with it, whenever I face this problem
> of windows disappearing from the “Windows” palette due to an unanticipated
> system reboot.
>
> So again I ask, does anyone know where that list of open BBEdit windows is
> stored?
>
>
> Not that file, but isn’t your goal in effect what a BBEdit Project
> provides?
>
> I have several work projects going, each with many files that I have to
> move among while working on that project. They’re often not all in the same
> folder, sometimes not even on the same disk.
>
> So for each of my work projects, I create a BBEdit Project (File -> New ->
> Project…), and use the ‘+’ button lower left to add all the files and
> directories I need together for that one of my projects. They all show in
> the left sidebar, and the open ones have a little indicator, which
> highlights if there are unsaved changes in that file. Directories can be
> clicked closed when there are so many files that the sidebar has to be
> scrolled. (Some of my projects have hundreds of files.)
>
> I’m fortunate to have a large monitor, so I have plenty of screen space
> for a wide BBEdit window with the sidebar showing the project files.
>
> Opening the project is one click on the icon, or pick one line from Recent
> Files.
>
> Zat get you what you want?
>
> Thanks,
>
>- Bruce
>
> _bruce__van_allen__santa_cruz__ca
>
> --
> 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 here. Follow @bbedit on Twitter: <
> https://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 bbedit+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/bbedit/1222F8C4-0663-40DD-9348-869690CD95B6%40cruzio.com
> .
>
>
> --
> 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 here. Follow @bbedit on Twitter: <
> https://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 bbedit+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/bbedit/B4193E99-C628-4C44-92DB-2D956000D357%40gmail.com
> 
> .
>

-- 
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 here. 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 view this discussion on the web visit 

Re: Where Are Prefs for Open Windows in "Windows" Palette Saved?

2021-03-18 Thread Sam Hathaway

On 18 Mar 2021, at 10:10, Bill Kochman wrote:

I started this discussion thread with a simple question: Where is the 
list of open BBEdit windows stored on my hard drive?


If you’ll only be satisfied with a direct answer to your exact 
question, then here:


`~/Library/BBEdit/Saved Application State-{Some GUID}.appstate`

But I doubt you’ll be able to do anything with it.

路‍♀️
-sam

--
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 here. 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/E89EE80B-C960-4A4D-B8CB-DD589F43C32A%40munkynet.org.


Re: Where Are Prefs for Open Windows in "Windows" Palette Saved?

2021-03-18 Thread Bill Kochman
Hello Sam,

Thanks for your response. Actually, that is EXACTLY the answer that I needed. 
In fact, only minutes after you responded to me, Rich wrote to me privately and 
pointed me to the very same file. :)

So for now, until I can figure out why my machine periodically crashes and 
wipes out the open windows data in BBEdit, I will be keeping a backup copy of 
both ~/Library/BBEdit and also ~/Library/Application Support/.

Kind regards,

Bill Kochman, Administrator
Bill’s Bible Basics / Christian Social Network
wordweaver...@gmail.com
https://www.billkochman.com
https://www.csnet.live

> On Mar 19, 2021, at 4:04 AM, Sam Hathaway  wrote:
> 
> On 18 Mar 2021, at 10:10, Bill Kochman wrote:
> 
> I started this discussion thread with a simple question: Where is the list of 
> open BBEdit windows stored on my hard drive?
> 
> If you’ll only be satisfied with a direct answer to your exact question, then 
> here:
> 
> ~/Library/BBEdit/Saved Application State-{Some GUID}.appstate
> 
> But I doubt you’ll be able to do anything with it.
> 
> 路‍♀️
> -sam
> 

-- 
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 here. 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/7460EB2F-E9FF-4850-8AB8-3D462EE92A7C%40gmail.com.


Re: Where Are Prefs for Open Windows in "Windows" Palette Saved?

2021-03-18 Thread Christopher Stone




-- 
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 here. 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 view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/5CBA1103-5ECF-40CA-A6FB-2B8393E60E90%40gmail.com.
<>
On 03/17/2021, at 18:41, Bill Kochman  wrote:So, I must ask you then. Does the fact that you are taking interest in this mean that there is not just one file somewhere in BBEdit’s folder and file hierarchy where this information is stored?Hey Bill,Sam showed you where the file was.  It seems my memory was faulty, or it dates back to before the saved-state file existed...  :-)Personally I would not depend upon the saved-state file, as it's mutable and will change right at the moment you don't want it to.Even if you saved various versions of it, you still have to parse it, extract the file-URLs, convert them into a usable format, and open them.The attached script will create a date-stamped folder of aliases to all files open in BBEdit at the time the script is run.Give it a keyboard shortcut like Control-S, and you can create a new save-state on demand.To open the files go to the saved-state folder, select all the aliases, and hit Cmd-O in the Finder.It wouldn't be hard to write a script to open the last saved-state, or even one to provide a list of saved-states to pick from.There are other ways to do this of course, but let's start here.--Best Regards,Chris# Auth: Christopher Stone # dCre: 2021/03/18 19:06# dMod: 2021/03/18 19:06 # Appl: BBEdit, Finder# Task: Create Aliases of All Files Open in BBEdit in a Date-Stamped Folder.# Libs: None# Osax: None# Tags: @Applescript, @Script, @ASObjC, @BBEdit, @Finder, @Saved, @Stateuse AppleScript version "2.4" --» Yosemite or lateruse framework "Foundation"use scripting additions--» USER SETTING -- Saved State Locationset bbeditSavedStateFolderPath to "~/Documents/BBEdit Saved-State/"set bbeditSavedStateFolderPath to my expandTildeInPath:bbeditSavedStateFolderPathif itemExists(bbeditSavedStateFolderPath) = false then    my createDirectoryAtPathWithIntermediates:bbeditSavedStateFolderPathend ifset dateStr to my dateStamp(current date)set newFolderName to "BBEdit Saved State – " & dateStrtell application "BBEdit"    set AppleScript's text item delimiters to linefeed    set fList to (file of documents whose on disk is true)end telltell application "Finder"    set destFldr to (make new folder at (POSIX file bbeditSavedStateFolderPath) with properties {name:newFolderName}) as alias    repeat with i in fList        make new alias file at destFldr to i    end repeatend tell--» HANDLERSon createDirectoryAtPathWithIntermediates:thePath    set {theResult, theError} to current application's NSFileManager's defaultManager()'s createDirectoryAtPath:thePath ¬        withIntermediateDirectories:true attributes:(missing value) |error|:(reference)    if not (theResult as boolean) then        set errorMsg to theError's localizedDescription() as text        error errorMsg    end ifend createDirectoryAtPathWithIntermediates:on dateStamp(theDate)    set dateDelim to "-"    set timeDelim to "."    tell theDate as «class isot» as string to ¬        set {, mm, dd, hh, mm, ss} to ¬            {its text 1 thru 4, its text 6 thru 7, its text 9 thru 10, its text 12 thru 13, its text 15 thru 16, its text 18 thru 19}    return  & dateDelim & mm & dateDelim & dd & space & hh & timeDelim & mm & timeDelim & ssend dateStampon expandTildeInPath:tildeBasedPath    set expandedPath to (current application's NSString's stringWithString:tildeBasedPath)'s stringByExpandingTildeInPath    return expandedPath as textend expandTildeInPath:on itemExists(posixPath) --> Boolean output    set posixPath to (current application's NSString's stringWithString:posixPath)'s stringByExpandingTildeInPath    set myNSURL to current application's |NSURL|'s fileURLWithPath:posixPath    set itemExistsBool to (myNSURL's checkResourceIsReachableAndReturnError:(missing value)) as boolean    return itemExistsBoolend 

Re: Where Are Prefs for Open Windows in "Windows" Palette Saved?

2021-03-18 Thread Bill Kochman
Hello Chris,

It seems that you and I were thinking along the very same lines. In fact, nine 
hours ago, I informed Rich via private email that I had basically done the same 
thing as what you accomplish in this script, but manually, being as I am no 
AppleScript expert. In other words, I manually made aliases of all 81 open 
docs, and put them in a folder on my desktop. As you suggest in your message, I 
then use command-o followed by option-command-m to minimize the open documents 
to the Dock.

But, of course, your script has the added advantage of saving me time, and 
allowing me to create an up-to-date list of the aliases on the spot, so thank 
you for that. I appreciate all of your contributions to myself, and to everyone 
else on this list as well. :)

Kind regards,

Bill Kochman, Administrator
Bill’s Bible Basics / Christian Social Network
wordweaver...@gmail.com
https://www.billkochman.com
https://www.csnet.live

> On Mar 19, 2021, at 11:23 AM, Christopher Stone  
> wrote:
> 
> 
> -- 
> 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 here. 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/5CBA1103-5ECF-40CA-A6FB-2B8393E60E90%40gmail.com
>  
> .
>  Folder.scptd.zip>

-- 
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 here. 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/9BD76BEB-2865-4E0F-A00A-39F224A84168%40gmail.com.


Re: Where Are Prefs for Open Windows in "Windows" Palette Saved?

2021-03-18 Thread Christopher Stone




-- 
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 here. 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 view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/7376020C-4DEF-4C0E-AFD0-3DD74F458BE3%40gmail.com.
<>
On 03/18/2021, at 13:04, Sam Hathaway  wrote:On 18 Mar 2021, at 10:10, Bill Kochman wrote:I started this discussion thread with a simple question: Where is the list of open BBEdit windows stored on my hard drive?If you’ll only be satisfied with a direct answer to your exact question, then here:~/Library/BBEdit/Saved Application State-{Some GUID}.appstateBut I doubt you’ll be able to do anything with it.Hey Sam,I'll take that challenge.  It wasn't simple by any means, but it wasn't especially difficult either.I'm naming the document in BBEdit but saving it is left to the user.  If I was doing this for myself I'd auto-save the file to a specific location on my hard drive, but I'm done for the day.--Best Regards,Chris# Auth: Christopher Stone # dCre: 2021/03/18 21:10# dMod: 2021/03/18 21:27# Appl: BBEdit, Finder, System Events# Task: Parse the BBEdit Saved-State File for Open File Paths.# Libs: None# Osax: None# Tags: @Applescript, @Script, @ASObjC, @Finder, @System_Events, @Parse, @BBEdit, @Saved-Stateuse framework "Foundation"use scripting additionsset bbeditLibFolderAlias to ((path to library folder from user domain as text) & "BBEdit") as aliasset tempDirAlias to (path to temporary items from user domain)tell application "Finder"    set bbeditSavedStateFile to (files of bbeditLibFolderAlias whose name starts with "Saved Application State") as alias list        if length of bbeditSavedStateFile = 1 then        set {bbeditSavedStateFile} to bbeditSavedStateFile    else        error "Too many saved-state files were found!"    end if        set tempSavedStateFile to (duplicate bbeditSavedStateFile to tempDirAlias with replacing) as alias    end tellset tempSavedStateFilePath to POSIX path of tempSavedStateFileset fileURLList to {}tell application "System Events"    tell property list file tempSavedStateFilePath        tell property list item "OpenDocuments"            set itemList to (get property list items's value)            repeat with i in itemList                try                    set urlString to i's |Location|'s |FileURLString|                    tell AppleScript                        set posixPath to (current application's class "NSURL"'s URLWithString:urlString)'s |path|() as text                        set end of fileURLList to posixPath                    end tell                end try            end repeat        end tell    end tellend tellset {oldTIDS, AppleScript's text item delimiters} to {AppleScript's text item delimiters, linefeed}set fileURLList to fileURLList as textset AppleScript's text item delimiters to oldTIDSset newDocName to "BBEdit Open Files – " & dateStamp(current date) & ".txt"tell application "BBEdit"    activate    make new document with properties {name:newDocName, text:fileURLList, bounds:{303, 45, 1617, 1196}}end tell--» HANDLERSon dateStamp(theDate)    set dateDelim to "-"    set timeDelim to "."    tell theDate as «class isot» as string to ¬        set {, mm, dd, hh, mm, ss} to ¬            {its text 1 thru 4, its text 6 thru 7, its text 9 thru 10, its text 12 thru 13, its text 15 thru 16, its text 18 thru 19}    return  & dateDelim & mm & dateDelim & dd & space & hh & timeDelim & mm & timeDelim & ssend dateStamp



-- 
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 here. 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 view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/7376020C-4DEF-4C0E-AFD0-3DD74F458BE3%40gmail.com.


Re: Where Are Prefs for Open Windows in "Windows" Palette Saved?

2021-03-18 Thread Christopher Stone
On 03/18/2021, at 13:04, Sam Hathaway mailto:list.bbe...@munkynet.org>> wrote:
> On 18 Mar 2021, at 10:10, Bill Kochman wrote:
> 
> I started this discussion thread with a simple question: Where is the list of 
> open BBEdit windows stored on my hard drive?
> 
> If you’ll only be satisfied with a direct answer to your exact question, then 
> here:
> 
> ~/Library/BBEdit/Saved Application State-{Some GUID}.appstate
> 
> But I doubt you’ll be able to do anything with it.
> 


It looks like Google Groups ate my text, since the attachment was at the top of 
my email, so I'm resending the body.


Hey Sam,

I'll take that challenge.  

It wasn't simple by any means, but it wasn't especially difficult either.

I'm naming the document in BBEdit but saving it is left to the user.  If I was 
doing this for myself I'd auto-save the file to a specific location on my hard 
drive, but I'm done for the day.

--
Best Regards,
Chris



# Auth: Christopher Stone mailto:scriptmeis...@thestoneforge.com>>
# dCre: 2021/03/18 21:10
# dMod: 2021/03/18 21:27
# Appl: BBEdit, Finder, System Events
# Task: Parse the BBEdit Saved-State File for Open File Paths.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @ASObjC, @Finder, @System_Events, @Parse, 
@BBEdit, @Saved-State

use framework "Foundation"
use scripting additions


set bbeditLibFolderAlias to ((path to library folder from user domain as text) 
& "BBEdit") as alias
set tempDirAlias to (path to temporary items from user domain)

tell application "Finder"
set bbeditSavedStateFile to (files of bbeditLibFolderAlias whose name 
starts with "Saved Application State") as alias list

if length of bbeditSavedStateFile = 1 then
set {bbeditSavedStateFile} to bbeditSavedStateFile
else
error "Too many saved-state files were found!"
end if

set tempSavedStateFile to (duplicate bbeditSavedStateFile to tempDirAlias 
with replacing) as alias

end tell

set tempSavedStateFilePath to POSIX path of tempSavedStateFile

set fileURLList to {}

tell application "System Events"
tell property list file tempSavedStateFilePath
tell property list item "OpenDocuments"
set itemList to (get property list items's value)
repeat with i in itemList
try
set urlString to i's |Location|'s |FileURLString|
tell AppleScript
set posixPath to (current application's class "NSURL"'s 
URLWithString:urlString)'s |path|() as text
set end of fileURLList to posixPath
end tell
end try
end repeat
end tell
end tell
end tell

set {oldTIDS, AppleScript's text item delimiters} to {AppleScript's text item 
delimiters, linefeed}

set fileURLList to fileURLList as text

set AppleScript's text item delimiters to oldTIDS

set newDocName to "BBEdit Open Files – " & dateStamp(current date) & ".txt"

tell application "BBEdit"
activate
make new document with properties {name:newDocName, text:fileURLList, 
bounds:{303, 45, 1617, 1196}}
end tell


--» HANDLERS

on dateStamp(theDate)
set dateDelim to "-"
set timeDelim to "."
tell theDate as «class isot» as string to ¬
set {, mm, dd, hh, mm, ss} to ¬
{its text 1 thru 4, its text 6 thru 7, its text 9 thru 10, its text 
12 thru 13, its text 15 thru 16, its text 18 thru 19}
return  & dateDelim & mm & dateDelim & dd & space & hh & timeDelim & mm 
& timeDelim & ss
end dateStamp



-- 
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 here. 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/A4600939-4151-4018-9094-3000F333FC78%40gmail.com.


Re: Where Are Prefs for Open Windows in "Windows" Palette Saved?

2021-03-18 Thread Christopher Stone
On 03/17/2021, at 18:41, Bill Kochman mailto:wordweaver...@gmail.com>> wrote:
> So, I must ask you then. Does the fact that you are taking interest in this 
> mean that there is not just one file somewhere in BBEdit’s folder and file 
> hierarchy where this information is stored?


It looks like Google Groups ate my text, since the attachment was at the top of 
my email, so I'm resending the body.


Hey Bill,

Sam showed you where the file was.  It seems my memory was faulty, or it dates 
back to before the saved-state file existed...  :-)

Personally I would not depend upon the saved-state file, as it's mutable and 
will change right at the moment you don't want it to.

Even if you saved various versions of it, you still have to parse it, extract 
the file-URLs, convert them into a usable format, and open them.

The attached script will create a date-stamped folder of aliases to all files 
open in BBEdit at the time the script is run.

Give it a keyboard shortcut like Control-S, and you can create a new save-state 
on demand.

To open the files go to the saved-state folder, select all the aliases, and hit 
Cmd-O in the Finder.

It wouldn't be hard to write a script to open the last saved-state, or even one 
to provide a list of saved-states to pick from.

There are other ways to do this of course, but let's start here.

--
Best Regards,
Chris



# Auth: Christopher Stone mailto:scriptmeis...@thestoneforge.com>>
# dCre: 2021/03/18 19:06
# dMod: 2021/03/18 19:06 
# Appl: BBEdit, Finder
# Task: Create Aliases of All Files Open in BBEdit in a Date-Stamped Folder.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @ASObjC, @BBEdit, @Finder, @Saved, @State


use AppleScript version "2.4" --» Yosemite or later
use framework "Foundation"
use scripting additions


--» USER SETTING -- Saved State Location

set bbeditSavedStateFolderPath to "~/Documents/BBEdit Saved-State/"


set bbeditSavedStateFolderPath to my 
expandTildeInPath:bbeditSavedStateFolderPath

if itemExists(bbeditSavedStateFolderPath) = false then
my createDirectoryAtPathWithIntermediates:bbeditSavedStateFolderPath
end if

set dateStr to my dateStamp(current date)
set newFolderName to "BBEdit Saved State – " & dateStr

tell application "BBEdit"
set AppleScript's text item delimiters to linefeed
set fList to (file of documents whose on disk is true)
end tell

tell application "Finder"
set destFldr to (make new folder at (POSIX file bbeditSavedStateFolderPath) 
with properties {name:newFolderName}) as alias
repeat with i in fList
make new alias file at destFldr to i
end repeat
end tell


--» HANDLERS

on createDirectoryAtPathWithIntermediates:thePath
set {theResult, theError} to current application's NSFileManager's 
defaultManager()'s createDirectoryAtPath:thePath ¬
withIntermediateDirectories:true attributes:(missing value) 
|error|:(reference)
if not (theResult as boolean) then
set errorMsg to theError's localizedDescription() as text
error errorMsg
end if
end createDirectoryAtPathWithIntermediates:

on dateStamp(theDate)
set dateDelim to "-"
set timeDelim to "."
tell theDate as «class isot» as string to ¬
set {, mm, dd, hh, mm, ss} to ¬
{its text 1 thru 4, its text 6 thru 7, its text 9 thru 10, its text 
12 thru 13, its text 15 thru 16, its text 18 thru 19}
return  & dateDelim & mm & dateDelim & dd & space & hh & timeDelim & mm 
& timeDelim & ss
end dateStamp

on expandTildeInPath:tildeBasedPath
set expandedPath to (current application's NSString's 
stringWithString:tildeBasedPath)'s stringByExpandingTildeInPath
return expandedPath as text
end expandTildeInPath:

on itemExists(posixPath) --> Boolean output
set posixPath to (current application's NSString's 
stringWithString:posixPath)'s stringByExpandingTildeInPath
set myNSURL to current application's |NSURL|'s fileURLWithPath:posixPath
set itemExistsBool to (myNSURL's 
checkResourceIsReachableAndReturnError:(missing value)) as boolean
return itemExistsBool
end itemExists


-- 
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 here. Follow @bbedit on Twitter: 
--- 
You received this message because you are 

Deleting a file via AppleScript

2021-03-18 Thread F. Alfredo Rego
Hi everyone,

I would like to delete a file via AppleScript. 

I’m sure the solution is trivially simple, but so far I can’t find a way.

The easy way would be to do something like this, which sadly does exactly what 
it says and it doesn’t delete the file:

   set theFile to (open file "whatever")
   close theFile saving no

I looked around in BBEdit’s dictionary for something naively obvious (perhaps 
"close theFile deleting yes”) but no such luck.


I would be thankful for any guidance.


Alfredo



-- 
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 here. 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/CA8C47EB-6EBC-4D90-891E-8B7746FCDB23%40gmail.com.