| From: Johan Solve | Date Sent: 2004-09-10 01:08:41 |
| Subject: Document workspace script | To: BBEdit Talk |
| Navigation: First Message | Previous Message | Next Message | Last Message | |
Here's a script to save or load the current set of windows and documents in BBEdit 8.
It's rather simple, it can only save one workspace but you can make multiple copies of the script to be able to work with multiple workspaces.
property workspace : {}
tell application "BBEdit"
if (count text windows) = 0 then
-- if we have no open documents, we always load the workspace
set choice to "Load"
else
-- ask user if we should save or loada the workspace
set choice to (button returned of (display dialog "Do you want to save or load workspace?" buttons {"Cancel", "Load", "Save"} default button "Save"))
end if
if choice is "Save" then
-- save current windows
repeat with thiswindow in text windows
set documentlist to {}
-- save current documents in each window
repeat with thisdocument in (text documents of thiswindow)
if on disk of thisdocument then
set documentlist to documentlist & {file of thisdocument}
end if
end repeat
set workspace to workspace & {documentlist}
end repeat
else if choice is "Load" then
-- open last saved windows
repeat with thiswindow in workspace
set currentwindow to ""
repeat with thisdocument in thiswindow
if currentwindow is "" then
-- open new window
set currentwindow to (open thisdocument)
else
-- open in current window
set currentwindow to (open thisdocument opening in window of currentwindow)
end if
end repeat
end repeat
end if
end tell
--
Johan Slve [FSA Partner, Lasso Partner]
Web Application/Lasso/FileMaker Developer
MONTANIA SOFTWARE & SOLUTIONS
http://www.montania.se mailto:joh-n@[Protected]
(spam-safe email address, replace '-' with 'a')
--
----------------------------------------------------------
Please send bug reports to <support@[Protected]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-off@[Protected]>
| From: Jan Pieter Kunst | Date Sent: 2004-09-10 01:33:45 |
| Subject: Re: Document workspace script | To: BBEdit Talk |
| Navigation: First Message | Previous Message | Next Message | Last Message | |
Johan Solve:
>Here's a script to save or load the current set of windows and
>documents in BBEdit 8.
>It's rather simple, it can only save one workspace but you can make
>multiple copies of the script to be able to work with multiple
>workspaces.
Very nice! This is actually what I hoped that the built-in BBEdit 8
'Workspace' would be.
JP
--
----------------------------------------------------------
Please send bug reports to <support@[Protected]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-off@[Protected]>
| From: Johan Solve | Date Sent: 2004-09-10 01:40:01 |
| Subject: Re: Document workspace script | To: BBEdit Talk |
| Navigation: First Message | Previous Message | Next Message | Last Message | |
At 10.33 +0200 04-09-10, Jan Pieter Kunst wrote:
>Very nice! This is actually what I hoped that the built-in BBEdit 8 'Workspace' would be.
Actually, this is what I also thought that the built in Workspace feature was when I discovered it - just after writing the script (and that gave me a good laugh...). It took a trip to the manual to find out why the built-in Workspace didn't seem work... :-)
--
Johan Slve [FSA Partner, Lasso Partner]
Web Application/Lasso/FileMaker Developer
MONTANIA SOFTWARE & SOLUTIONS
http://www.montania.se mailto:joh-n@[Protected]
(spam-safe email address, replace '-' with 'a')
--
----------------------------------------------------------
Please send bug reports to <support@[Protected]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-off@[Protected]>
| From: Matthew Galaher | Date Sent: 2004-09-10 10:16:28 |
| Subject: Re: Document workspace script | To: BBEdit Talk |
| Navigation: First Message | Previous Message | Next Message | Last Message | |
Shouldn't this bring up a dialog asking for a Workspace name? I don't
get that. Not complaining, just wondering if I'm missing something.
--
----------------------------------------------------------
Please send bug reports to <support@[Protected]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-off@[Protected]>
| From: Johan Solve | Date Sent: 2004-09-12 23:59:07 |
| Subject: Re: Document workspace script | To: BBEdit Talk |
| Navigation: First Message | Previous Message | Next Message | Last Message | |
At 10.16 -0700 04-09-10, Matthew Galaher wrote:
>Shouldn't this bring up a dialog asking for a Workspace name? I don't get that. Not complaining, just wondering if I'm missing something.
As I wrote "It's rather simple, it can only save one workspace but you can make multiple copies of the script to be able to work with multiple workspaces."
In other words, one instance of the script only saves one single workspace, and thus no need to ask for a name.
If I find the time and inspiration I will improve it to be able to save any number of workspaces without duplicating the script, and to store them more persistently (?) than in a script property. But so far it fills my immediate need.
--
Johan Slve [FSA Partner, Lasso Partner]
Web Application/Lasso/FileMaker Developer
MONTANIA SOFTWARE & SOLUTIONS
http://www.montania.se mailto:joh-n@[Protected]
(spam-safe email address, replace '-' with 'a')
--
----------------------------------------------------------
Please send bug reports to <support@[Protected]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-off@[Protected]>
| From: Johan Solve | Date Sent: 2004-09-19 14:00:12 |
| Subject: Re: Document workspace script | To: BBEdit Talk |
| Navigation: First Message | Previous Message | Next Message | Last Message | |
>Here's a script to save or load the current set of windows and documents in BBEdit 8.
>It's rather simple, it can only save one workspace but you can make multiple copies of the script to be able to work with multiple workspaces.
Inspired by John Gruber's latest blog "Opening Files Together in a New BBEdit Text Window" <http://daringfireball.net/2004/09/bbedit_open_together> I've improved my Workspace script so it opens a workspace much faster and nicer, without the window flashing of the previous version.
If you update the existing script, please keep in mind that your current saved workspace will be lost when you save the compile the script. Either load your workspace before compiling the script so you can save it afterwards, or save this script under a new name.
Here goes:
property workspace : {}
tell application "BBEdit"
if (count text windows) = 0 then
-- if we have no open documents, we always load the workspace
set choice to "Load"
else
-- ask user if we should save or load the workspace
set choice to (button returned of (display dialog "Do you want to save or load workspace?" buttons {"Cancel", "Load", "Save"} default button "Save"))
end if
if choice is "Save" then
-- save current windows
repeat with thiswindow in text windows
set documentlist to {}
-- save current documents in each window
repeat with thisdocument in (text documents of thiswindow)
if on disk of thisdocument then
set documentlist to documentlist & {file of thisdocument}
end if
end repeat
set workspace to workspace & {documentlist}
end repeat
else if choice is "Load" then
-- open last saved windows
repeat with thiswindow in workspace
-- create a new window
set currentwindow to window of (open item 1 of thiswindow)
-- open all documents in this window (thiswindow is a list of aliases)
-- this will open the first item again but that is not a problem
open thiswindow opening in currentwindow
end repeat
end if
end tell
--
Johan Slve [FSA Partner, Lasso Partner]
Web Application/Lasso/FileMaker Developer
MONTANIA SOFTWARE & SOLUTIONS
http://www.montania.se mailto:joh-n@[Protected]
(spam-safe email address, replace '-' with 'a')
--
----------------------------------------------------------
Please send bug reports to <support@[Protected]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-off@[Protected]>