On Mar 27, 2007 John Harwood wrote:

> This happens all the time ... I'm working along and have a BBedit
> file open with some miscellaneous code or notes in it that I really
> don't want or need to save as a specific file and am rushing so
> copy/paste into stickies (or whatever) is an unwanted step. I just
> want to keep the stuff for when I continue with whatever is in
> progress. But for one reason or another I also need to quit the
> program.
>
> Wouldn't it be useful to have a buffer that could save such text (in
> the preferences or such) when the app is closed and still be
> available when opened up again? Even if it was a special file that
> you didn't have to go looking for to open because the program always
> knew where it was would suffice.

I don't know if this is of any interest. All it does is put any text on the clip
oard in a new BBEdit file and then save it in a special folder I've created for
t.

The filename is in this format: yyyy-mm-dd-hh-mm-ss

Obviously you'd need to change the path in the variable file_path to one that wi
l work with you set up.

tell application "BBEdit"
        activate
        make new text document with properties {contents:current clipboard}
end tell
set file_name_year to year of (current date) as string

set file_name_month to month of (current date) as number
if file_name_month Š 9 then
        set file_name_month to "0" & file_name_month
end if

set file_name_day to day of (current date) as number

if file_name_day Š 9 then
        set file_name_day to "0" & file_name_day
end if

set secs to time of (current date)

if secs „ hours then
        --An hour or longer...
        set h to secs div 3600
        set minutes_left to secs mod 3600
        set m to minutes_left div 60
        set s to minutes_left mod 60
else if secs „ minutes then
        --A minute or longer
        set h to 0
        set m to secs div 60
        set s to secs mod 60
else
        set h to 0
        set m to 0
        set s to secs
end if


if h Š 9 then
        set h to "0" & h
end if
if m Š 9 then
        set m to "0" & m
end if
if s Š 9 then
        set s to "0" & s
end if

set file_title to file_name_year & "-" & file_name_month & "-" & file_name_day &
"-" & h & "-" & m & "-" & s as string

set file_path to "Macintosh HD:Users:your_home_folder:a_special_folder:" & file_
itle

tell application "BBEdit"
        tell document 1
                save to file file_path
        end tell
end tell



--
Patrick
<http://www.patrickjames.me.uk>



--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL 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:  <[EMAIL PROTECTED]>

Reply via email to