AutoHotkey Community

It is currently May 27th, 2012, 12:29 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: February 3rd, 2009, 12:55 am 
Offline

Joined: February 3rd, 2009, 12:43 am
Posts: 11
Location: Abbotsford, BC, Canada
I thought I'd share my most useful AHK script. It's simple, but is used many times/day. It's most useful with an address bar command thingy like http://www.yubnub.org. I implement it in Firefox this way: http://lifehacker.com/395628/integrate-yubnub-into-firefoxs-address-bar-for-faster-searches

You can select any text, press ctrl+capslock and then a command like "gim" for Google image search and hit enter. It also works for opening URL's that are not hyperlinked. just ctrl+caps+enter. (BTW, Firefox will automatically fix urls wrapping multiple lines or with spaces, so don't bother editing those poorly copied urls)

Hope you find this as useful as I do. :)

Code:
^Capslock::
   SetTitleMatchMode, 2
   IfWinExist, Mozilla Firefox
   {
      ;oCB := ClipboardAll ;backup clipboard
      Send ^c
      ClipWait
      if ErrorLevel
         exit
      WinActivate
      WinWaitActive
      Send ^t
      ;Sleep 400 ; Use this option if you have a new tab plugin like quick launch that creates a delay
      SendInput {Space}^v{Home}
      ;Sleep 600 ;Wait for clipboard before restoring it
      ;ClipBoard := oCB ;restore clipboard
   }
return


If you have a plugin like Quick launch, there may be a slight delay before Firefox accepts input in the address bar. Comment out the "Sleep 400" command for that. (May need adjusting).

Also, if you don't want your text to stay in the clipboard, uncomment the first and last 2 lines for backing up and restoring the clipboard.

Another tip: If you run 2 copies of Firefox and need a way (for you or AHK) to tell between the 2, use this plugin to change Firefox's window title: http://www.oxymoronical.com/web/firefox/nightly. If anyone knows how to easily change Firefox's program icon depending on the profile used, let me know.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bon, SKAN and 5 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group