Welcome, Guest. Please Login
Tinderbox
  News:
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
  HomeHelpSearchLogin  
 
Pages: 1
Send Topic Print
Using Tinderbox with Keyboard Maestro (Read 5345 times)
greg ibendahl
Full Member
*
Offline



Posts: 15

Using Tinderbox with Keyboard Maestro
Sep 16th, 2008, 6:11pm
 
Anyone else try using TB with Keyboard Maestro? While Tinderbox has very limited Apple Script and Automator support, it does have a lot of shortcut keystrokes. This lends itself fairly well to a program like Keyboard Maestro or similar program to record keyboard and mouse actions.

Here's what I'm doing with it. I often copy text out of Safari to save for later. Lots of programs can do this but they often just save the whole page which is more than I need. I now have a system where I can highlight my desired text in safari and then press a keyboard shortcut to put this text into a new note with the URL field set to the current Safari page and with a title auto generated from the first 10 words of what I've selected.

Here's the commands you need in KM

Activate Safari.app
Copy to clipboard ‘Clipboard #2’
Execute ‘Copy URL to clipboard.scpt’ AppleScript
Pause For 0 Seconds
Filter Clipboard: Remove Styles
Activate Tinderbox.app
Pause For 1 Seconds
Type the ⌘K Keystroke
Pause For 0.1 Seconds
Type the ⌘V Keystroke
Pause For 0.1 Seconds
Type the Return Keystroke
Pause For 0.1 Seconds
Set Clipboard To Named Clipboard ‘Clipboard #2’
Pause For 0 Seconds
Filter Clipboard: Remove Styles
Pause For 0.1 Seconds
Type the ⌘V Keystroke
Pause For 0.1 Seconds
Type the ⌘W Keystroke
Pause For 0.1 Seconds
Activate Safari.app

there's also an Applescript that goes along with this and you need an agent in your TB file to generate the title and move the URL to the URL field. I'll post that later if there is interest.

Back to top
 
 
  IP Logged
rtalexander
Full Member
*
Offline



Posts: 37

Re: Using Tinderbox with Keyboard Maestro
Reply #1 - Sep 17th, 2008, 12:09am
 
Yes, please post the rest!
Back to top
 
 
  IP Logged
greg ibendahl
Full Member
*
Offline



Posts: 15

Re: Using Tinderbox with Keyboard Maestro
Reply #2 - Sep 17th, 2008, 11:34am
 
I have a top level note called "Notes" with all the clipped notes from Safari as children. Before running the Keyboard script, be sure to have one of the children highlighted. Otherwise, I have a user attribute called "updateURL" that can be either true or false and I have a prototype called "Note prototype" that just sets the font and color.

The major element is an agent that has this for a query:
updateURL=false & #descendedFrom(Notes)

The action for this agent is:
Prototype = "Note prototype";  URL = $Name; Name = ^text( this, 10 )^; if($Name != "") {updateURL = true}

That's it on the Tinderbox side. You'll notice that the Keyboard script refers to an Applescript that I've copied below. Sorry, I can't find the reference for the script.

tell application "Safari"
     tell document 1
           set the clipboard to my escapeURL(URL)
     end tell
end tell
on escapeURL(aURL)
     set newURL to ""
     set savedDelimiters to AppleScript's text item delimiters
     set AppleScript's text item delimiters to {"&"}
     
     set aCount to count text item of aURL
     repeat with index from 1 to (aCount - 1)
           set newURL to newURL & (text item index of aURL) & "&"
     end repeat
     set newURL to newURL & last text item of aURL
     
     set AppleScript's text item delimiters to savedDelimiters
     return newURL
end escapeURL

The overall effect is pretty good. On some computers you might need to adjust the pause times for the Keyboard script as sometimes the computer might not react as quick as the script runs. The only really downside to the process is that you must keep Keyboard Maestro up and running. It would be nice if Tinderbox had a broader Applescript dictionary (hint hint), but I would rather see TB become a native Intel application first.
Back to top
 
 
  IP Logged
Pages: 1
Send Topic Print