Hello.
I have dropped the script below into my Script Editor Script’s folder, so I have easy access from the contextual menu, that you get up when you control-click in a Script Editor docucment.
Well, I have changed the templates folder to user domain, so I it easier to drop and change files there. (You’ll have to change the script accordingly).
Enjoy!
property scriptTitle : "Script Editor Folders"
property StdFolders : {"Templates Folder", "Scripts Folder", "Libraries Folder"}
-- set instigator to (path to frontmost application as text)
set choice to choose from list StdFolders with prompt "Which folder do you want to open?" default items item 1 of StdFolders with title my scriptTitle
if choice is false then
error number -128 -- bummer
else if choice is {"Templates Folder"} then
tell application id "MACS" to open ((path to library folder from user domain as text) & "Application Support:Script Editor:Templates:")
else if choice is {"Scripts Folder"} then
tell application id "MACS" to ¬
open ((path to library folder from local domain as text) & "Scripts:Script Editor Scripts:")
else
try
-- it doesn't exist by default so we'll check if it does.
local probe
set probe to ((path to library folder from user domain as text) & "Script Libraries:") as alias
on error
-- and if it didn't we'll as if we shall create it.
set choice to button returned of (display dialog "The Script Libary Folder does not exist." buttons {"Cancel", "Create"} default button 2 cancel button 1 with title my scriptTitle with icon caution)
if choice is "Create" then
tell application id "MACS" to make new folder at (path to library folder from user domain) with properties {name:"Script Libraries"}
else
error number -128
end if
end try
tell application id "MACS" to open folder ((path to library folder from user domain as text) & "Script Libraries:")
end if
tell application id "MACS" to ¬
set pth to quoted form of POSIX path of (target of its Finder window 1 as alias)
tell (path to frontmost application as text) to tell me to do shell script "open " & pth