On Sep 22, 2015, at 05:19, Obir <[email protected] 
<mailto:[email protected]>> wrote:
> I'm looking for a keyboard shortcut to switch back to the last active file in 
> the project window, 
> similar to cmd-~ for cycling through windows or cmd-tab for cycling through 
> applications.
______________________________________________________________________

Hey Rutger

Last active?  No, I don't think so.  I believe the possible choices are 
order-added and alphabetic.

> Most of the time I have several files open in a project but only working on a 
> few at the time.
> A shortcut for switching to the previous file *I was working on* (so not the 
> previous open file by order in the projectlist) would be a tremendous 
> time-saver.

This can be done with AppleScript with a couple of limitations.

All documents must have been saved.

A document must have been modified not just looked at to be considered most 
recent.

Save the AppleScript with the Script Editor app to:

~/Library/Application Support/BBEdit/Scripts/

Give it a keyboard shortcut, and you're good to go.

--
Best Regards,
Chris

-------------------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2015/09/22 15:33
# dMod: 2015/09/23 15:07
# Appl: BBEdit
# Task: Go to last modified saved document in a project window (excluding front 
document).
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @BBEdit, @Go-To, @Last, @Modified, @Document.
-------------------------------------------------------------------------------------------

tell application "BBEdit"
  set bbeditApp to it
  
  tell front project window
    set docList to (documents where its name is not ¬
      (get name of active document) and its name does not contain ".bbprojectd")
    
    if docList ≠ {} then
      set {docNameList, docModDateList} to {name, modification date} of ¬
        (documents where its name is not (get name of active document) and its 
name does not contain ".bbprojectd")
      
      repeat with i from 1 to (length of docModDateList) - 1
        if (item i of docModDateList) < (item (i + 1) of docModDateList) then
          set item i of docModDateList to 0
          set item i of docNameList to 0
        end if
      end repeat
      
      set lastDocName to first item of (text of docNameList)
      set lastDocModDate to first item of dates of docModDateList
      set lastDocFile to file of document lastDocName
      
      tell bbeditApp to open lastDocFile
      
    else
      beep
    end if
    
  end tell
end tell

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

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