On 04/11/2019, at 03:48, Scott in Pollock <[email protected] 
<mailto:[email protected]>> wrote:
> I often need to create a new text file and save it to a directory deep down 
> within ~/Library. Is there a way I can automate either the save to that 
> folder, OR the navigation to that folder during a save (short of putting that 
> folder in Finder Favorites)?


Hey Scott,

The easiest way to do this on a regular basis is with an AppleScript in 
BBEdit's Script Menu bound to a keyboard shortcut.

------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2019/04/11 16:30
# dMod: 2019/04/11 16:30 
# Appl: BBEdit, System Events
# Task: Save Front BBEdit Document to Deeply Nested Folder.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @BBEdit, @System_Events, @Save, @Document, 
@Deeply, @Nested, @Folder
------------------------------------------------------------

set deepDir to 
"~/test_directory/BBEdit_Test_Dir_Level_01/BBEdit_Test_Dir_Level_02"
tell application "System Events" to set deepDir to POSIX path of (get disk item 
deepDir)

set docName to text returned of (display dialog "Enter Name of Document to be 
Saved:" default answer "Temp.txt")

tell application "BBEdit"
    tell front document
        if on disk = false then
            save it to (deepDir & "/" & docName)
        end if
    end tell
end tell

------------------------------------------------------------

You'll need to change the path in the variable deepDir to suit.

When you run the script it'll ask you for a file name, and then it'll save it 
to the defined location.

Many customizations are possible.

--
Best Regards,
Chris

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

Reply via email to