On Nov 04, 2015, at 13:27, Larry Helms <[email protected]> wrote:
> Would like to be able to mark specific files as 'Favorites' and then be able 
> to easily/quickly open/re-open them from the File->Open-Favorites (similar to 
> File->Open-Recent), except the file list on the favorites is 'sticky' in that 
> the list only changes when a file is 'Favorited'.
______________________________________________________________________

Hey Larry,

This is something you can do pretty easily yourself.

Create a subfolder inside your Scripts folder:

~/Library/Application Support/BBEdit/Scripts/

Name it exactly this:

00)Favorite Files

Save this script as a compiled AppleScript using the Script Editor.

-------------------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2015/11/05 05:19
# dMod: 2015/11/05 05:29
# Appl: BBEdit
# Task: Create Open a Favorites-File Script
# Tags: @Applescript, @Script, @BBEdit, @Create, @Open, @Favorites, @File, 
@Script
-------------------------------------------------------------------------------------------

set favoritesFolder to POSIX path of ((path to application support from user 
domain as text) & "BBEdit:Scripts:00)Favorite Files:")
tell application "BBEdit"
  tell front document
    if its on disk is true then
      set docFileHFS to its file as text
    else
      error "Error: The front BBEdit document is not saved!"
    end if
  end tell
end tell
set filePathPosix to quoted form of (POSIX path of docFileHFS)
set {oldTIDS, AppleScript's text item delimiters} to {AppleScript's text item 
delimiters, ":"}
set newFileName to (last text item of docFileHFS) & ".sh"
set AppleScript's text item delimiters to oldTIDS
set newFilePath to quoted form of (favoritesFolder & newFileName)
set shellTemplate to text 2 thru -1 of "
#! /usr/bin/env bash
FILE=" & filePathPosix & ";
bbedit \"$FILE\";
"
set shCMD to text 2 thru -1 of "
echo " & quoted form of shellTemplate & " > " & newFilePath
do shell script shCMD

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

Put the script in your script folder, and assign it a keyboard shortcut in 
BBEdit's 'Menus & Shortcuts' prefs.

Use the script to create a new favorite from the front text document in BBEdit.

Access them through Menu-Bar > Script-Menu > Favorite Files > <your file name>.

Delete items by selecting Menu-Bar > Script-Menu > Favorite Files – and 
deleting the script-files in the Finder.

Generally I don't like accessing menus like this with the mouse, but Keyboard 
Maestro can actually open the menu for me to type-select the file I want – so I 
do use solutions like this when it's convenient.

For my own use I'm more likely to want to pop-up a pick-list, make my 
choice(s), and go.

Like this:




Pop-up the choose-from dialog as shown above.

-------------------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2015/11/05 06:04
# dMod: 2015/11/05 06:04 
# Appl: BBEdit, Finder
# Task: Open BBEdit Favorite files from a pick-list or Open Favorites Folder in 
Finder.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @BBEdit, @Finder
-------------------------------------------------------------------------------------------

set favoritesFolderHFS to ((path to documents folder as text) & "BBEdit 
Favorite Files:")
set favoritesFileNameList to list folder (alias favoritesFolderHFS)
set beginning of favoritesFileNameList to " Edit Favorites"

tell application "BBEdit"
  set pickList to choose from list favoritesFileNameList ¬
    with title "Favorite Files" with prompt "Pick 1 or More." default items 
{item 2 of favoritesFileNameList} ¬
    with multiple selections allowed
  
  if pickList = {" Edit Favorites"} then
    openFolder(favoritesFolderHFS) of me
  else if pickList ≠ false and pickList ≠ {" Edit Favorites"} then
    repeat with i in pickList
      set contents of i to (favoritesFolderHFS & (contents of i)) as alias
    end repeat
    open pickList
  end if
  
end tell

-------------------------------------------------------------------------------------------
--» HANDLERS
-------------------------------------------------------------------------------------------
on openFolder(theFolderHFS)
  tell application "Finder"
    activate
    open (alias theFolderHFS)
  end tell
end openFolder
-------------------------------------------------------------------------------------------

Create an alias to the front document in the BBEdit Favorite Files folder.

-------------------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2015/11/05 05:19
# dMod: 2015/11/05 05:29
# Appl: BBEdit
# Task: Create an alias to a Favorites-File.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @BBEdit, @Create, @Open, @Favorites, @File, 
@Script
-------------------------------------------------------------------------------------------

set favoritesFolder to ((path to documents folder as text) & "BBEdit Favorite 
Files:")
try
  alias favoritesFolder
on error
  tell application "Finder"
    make new folder at (path to documents folder) with properties {name:"BBEdit 
Favorite Files"}
  end tell
end try
tell application "BBEdit"
  tell front document
    if its on disk is true then
      set docFile to its file
    else
      error "Error: The front BBEdit document is not saved!"
    end if
  end tell
end tell
tell application "Finder"
  make new alias file at (alias favoritesFolder) to docFile
end tell

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

If I didn't go about it this way I might index the BBEdit Favorite Files folder 
with LaunchBar.

For that matter you could put the BBEdit Favorite Files folder in your Dock.

There are many ways to go about this.

--
Best Regards,
Chris

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://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].

Reply via email to