On 03/13/2021, at 17:47, @lbutlr <[email protected] <mailto:[email protected]>> wrote: > So, I have a text file that has a path to a file, and I would like to open > that file, or the directory containing that file.
Hey Lewis, 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. -- Best Regards, Chris -------------------------------------------------------- # Auth: Christopher Stone <[email protected] <mailto:[email protected]>> # 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 -------------------------------------------------------- -- 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 here. Follow @bbedit on Twitter: <https://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 view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/D9F8B066-7D9A-41F5-960C-0049348B0583%40gmail.com.
