This script will pop up a dialog giving you the choice of opening the file or folder of the path selected in the front BBEdit window. All keyboard – no mouse needed.
--------------------------------------------------------
# dCre: 2021/03/17 18:02
# dMod: 2021/03/17 18:03
# Appl: BBEdit, Finder
# Task: Open a File or its Parent Folder by a Path Selected in the Front Window.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @BBEdit, @Finder, @Open, @File, @Folder, @Path
--------------------------------------------------------
property LF : linefeed
property openStatusList : {"File", "Folder"}
--------------------------------------------------------
tell application "BBEdit"
set pathStr to selection's contents
set pathStr to replace "\\A\\s+|\\s+\\Z" searchingString pathStr using "" options {search mode:grep}
end tell
set itemAlias to alias POSIX file pathStr
set openStatus to choose from list openStatusList ¬
with title "Open File or Folder" with prompt ¬
"Pleae Make Your Choice:" default items {"File"} ¬
without empty selection allowed
if openStatus ≠ false then
set {openStatus} to openStatus
tell application "Finder"
if openStatus = "File" then
open itemAlias
else if openStatus = "Folder" then
activate
open parent of itemAlias
end if
end tell
end if
--------------------------------------------------------