On Aug 28, 2011, at 18:33, Christopher Stone wrote:
> I'm sort of ticked with the irregularities, so I'll probably rewrite the
> script tomorrow.
______________________________________________________________________
Hey Gary,
Okay. This script bypasses all but BBEdit and Keyboard Maestro. It runs a
trifle faster if you run it as a compiled script rather than as text.
--
Best Regards,
Chris
-----------------------------------------------------------------------------
## OPEN BBEDIT SCRATCHPAD ##
-----------------------------------------------------------------------------
on openScratchpad()
tell application "BBEdit"
open scratchpad window
activate
set index of window "Scratchpad" to 1 # Workaround for hidden apps issue.
end tell
end openScratchpad
-----------------------------------------------------------------------------
## RESTORE NAMED APPLICATION ##
-----------------------------------------------------------------------------
on kmRestoreApp()
tell application "Keyboard Maestro Engine"
do script "<dict>
<key>Action</key>
<string>SetApplicationByNameMatches</string>
<key>IsActive</key>
<true/>
<key>IsDisclosed</key>
<true/>
<key>MacroActionType</key>
<string>UseVariable</string>
<key>Variable</key>
<string>restoreAppKM</string>
</dict>"
set value of variable "restoreAppKM" to "FALSE"
end tell
end kmRestoreApp
-----------------------------------------------------------------------------
try
tell application "Keyboard Maestro Engine"
set currentApp to process tokens "%CurrentApplication%"
try
set restoreApp to value of variable "restoreAppKM"
on error
make new variable with properties {name:"restoreAppKM", value:"FALSE"}
end try
if currentApp ≠ "BBEdit" then
set value of variable "restoreAppKM" to currentApp
openScratchpad() of me
else if currentApp = "BBEdit" then
if value of variable "restoreAppKM" = "FALSE" then
openScratchpad() of me
else
kmRestoreApp() of me
end if
end if
end tell
on error errMsg number errNum
set sep to "=============================="
set e to sep & return & "Error: " & errMsg & return & sep & return ¬
& "Error Number: " & errNum & return & sep
beep
tell application "System Events" to display dialog e
end try
-----------------------------------------------------------------------------
--
You received this message because you are subscribed to the
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
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>