-------------------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2008/01/05 05:34
# dMod: 2016/05/19 16:50
# Appl: TextWrangler
# Task: Open BBEdit/TextWrangler RegEx Cheat Sheet
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @System_Events, @TextWrangler, @RegEx, @Cheat_Sheet
-------------------------------------------------------------------------------------------
set preferredWindowBounds to {451, 45, 1493, 1196}
set bbeditCheatSheetPath to "~/Documents/BBEdit Documents/Documentation/RegEx Cheat Sheet.txt"
tell application "System Events"
set bbeditCheatSheetPath to POSIX path of disk item bbeditCheatSheetPath
end tell
tell application "TextWrangler"
set twApp to a reference to it
tell document "RegEx Cheat Sheet.txt"
if it exists then
if index of its window ≠ 1 then
set index of its window to 1
end if
else
tell twApp to open bbeditCheatSheetPath opening in new_window
end if
if bounds of its window ≠ preferredWindowBounds then
set bounds of its window to preferredWindowBounds
end if
end tell
end tell
-------------------------------------------------------------------------------------------
I have this AppleScript bound to Cmd-Opt-Ctrl-G for quick access.
Of course the cheat-sheet must exist and reside at the path given in bbeditCheatSheetPath.
preferredWindowBounds is my preference, but you can easily change it to suit.