Hey Gary, On Aug 28, 2011, at 14:42, Gary wrote: > If I may ask one more question. I promise, my last.
Don't worry about asking questions; ask away. :) > I was curious though. Something like Simplenote has a preference for a > shortcut key. If I'm in Safari and press f11 Simplenote appears. I can then > press f11 and its gone, with the focus returned to Safari... Is something > like that possible with applescript and keyboard maestro or is that beyond > their capabilities? It's simpler to assign a 'last application' shortcut in Keyboard Maestro and then use your global Scratchpad shortcut in combination with that. However: ------------------------------------------------------------------------------------------------ property savedFrontAppName : "" try tell application "Finder" set frontAppName to item 1 of (get name of processes whose frontmost is true) if frontAppName ≠ "BBEdit" then set savedFrontAppName to frontAppName tell application "BBEdit" open scratchpad window activate end tell else if savedFrontAppName ≠ "" then set procNameList to name of processes if savedFrontAppName is in procNameList then set frontmost of processes whose name is savedFrontAppName to true set savedFrontAppName to "" end if else if frontAppName = "BBEdit" then tell application "BBEdit" to open scratchpad window end if 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 ------------------------------------------------------------------------------------------------ This is a bit quick and dirty, but it works. If you hit the Keyboard Maestro hotkey from an application other than BBEdit it will activate BBEdit and open the Scratchpad window. If you have previously done the above it will return you to the application you started with. However if you switch out of BBEdit with some other means than the hotkey it will bring you back to BBEdit's Scratchpad. If you START in BBEdit it will simply open the Scratchpad window. I decided to use the Finder rather than System Events, because SEV isn't always running - so there can be a lag while it starts up. On the other hand if the Finder is really busy there might be a lag. Give it a try and see what you think. I just looked and Keyboard Maestro v5 has a %CurrentApplication% property, so it should be possible to bypass both the Finder and SEV to iron out any speed irregularities. But I'm done for now. ;-) I'm sort of ticked with the irregularities, so I'll probably rewrite the script tomorrow. -- Best Regards, Chris -- 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 bbedit@googlegroups.com To unsubscribe from this group, send email to bbedit+unsubscr...@googlegroups.com 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 "supp...@barebones.com" rather than posting to the group. Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>