At 09.11 +0100 2008-02-07, Johan Solve wrote:
>Another script could be used to ask for a file name and create a new file 
>(using the shell command touch) at the location of the current disk browser or 
>document and then open the file in BBEdit - that would be very handy, I think 
>I'll try that. "New Text Document Here".

Sliding a bit sideways on this, here's a script for "New Document Here..." -  I 
am going to love this...


tell application "BBEdit"
        if on disk of text document 1 then
                set filepath to file of text document 1
                tell application "Finder" to set folderpath to container of 
filepath
                set newfilename to text returned of (display dialog "Save new 
file as: " & return & (POSIX path of (folderpath as string)) default answer 
"Untitled.txt")
                tell text document 1 -- the current document
                        set oldlinebreaks to line breaks
                        set oldsourcelanguage to source language
                        set oldencoding to encoding
                        set unixname to POSIX path of ((folderpath as string) & 
newfilename)
                        do shell script "touch " & unixname & ";bbedit " & 
unixname
                end tell
                tell text document 1 -- the new document
                        set encoding to oldencoding
                        set linebreaks to oldlinebreaks
                        set source language to oldsourcelanguage
                        save
                end tell
        end if
end tell

--
     Johan Sölve    [FSA Member, Lasso Partner]
     Web Application/Lasso/FileMaker Developer
     MONTANIA SOFTWARE & SOLUTIONS
http://www.montania.se   mailto:[EMAIL PROTECTED]
 (spam-safe email address, replace '-' with 'a')

--
------------------------------------------------------------------
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