Thread: AutoHotkey Help

Results 1 to 1 of 1
  1. #1 AutoHotkey Help 
    Super Senior Member PSP Elite Hacker Pirate-M.Lifnen's Avatar
    Join Date
    Feb 2007
    Posts
    3,010
    I've been using AHK for a couple months, and I've fallen in love with it.
    But, I need a code, one that I've searched all over for, and cannot find. And, I'm afraid I don't know how to make it.
    So, in an attempt to remain healthily lazy, and get someone else to do this for me, I'll tell you my idea.

    I need a way to hold the left mouse button to engage a ctrl-click for me.
    I use right-click to close windows/close firefox tabs. Now I need a way to open a link in a new tab via mouse/one handed browsing.

    I was thinking something along the lines of:

    If (Firefox) Window Exists
    Hold LButton for 200s, with no X Y coordinate change :: Ctrl + LButton
    /IfWinExist
    return

    Only, made into real AHK code.

    Edit: I forgot that Middle-Clicking a link will do this...
    I used an Alt-Tab replacement, where I can click my middle mouse button to bring up a little drop down view of all my running applications, but I don't really use this too often, so I'll just pitch it.

    But, here it is if anyone wants it / If I want it back sometime.
    Code:
    /*
    Alter the value of "shorten" below to change where characters are removed from the title
    
    1 = remove from right
    2 = remove from middle
    3 = don't remove any characters
    
    Alter the value of "shorten_length" below to specify how many characters long
    you would like the menu times to be.
    
    */
    
    shorten=1
    shorten_length=35
    
    del=
    
    ~MButton::
    
    if del <>
    menu, tabs, DeleteAll
    
    del++
    
    index=0
    
    WinGet, WinList, List,,,Program Manager
    
    WinGet, active_titleid, Id, A
    
    
    loop, &#37;WinList%
    {
    StringTrimRight, element, WinList%a_index%, 0
    
    if element =
    break
    
    WinGetTitle, title, ahk_id %element%
    
    StringLen, title_len, title
    
    
    if title_len >= %shorten_length%
    {
    
    if shorten=1
    {
    
    no_char_to_remove=%title_len%
    no_char_to_remove-=%shorten_length%
    
    StringTrimRight, title, title, %no_char_to_remove%
    
    title=%title%...
    }
    
    if shorten=2
    {
    no_char_to_remove=%title_len%
    no_char_to_remove-=%shorten_length%
    
    half_remove=%no_char_to_remove%
    half_remove/=2
    
    half_len=%title_len%
    half_len/=2
    half_len-=%half_remove%
    
    StringMid, to_replace, title, %half_len%, %no_char_to_remove%
    
    StringReplace, title, title, %to_replace%, ...
    }
    
    }
    
    
      if title<>
      {
        index++
    
       if active_titleid=%element%
       {
         menu, tabs, add, %index%) *%title%, activate
       }
       else
       {
         menu, tabs, add, %index%) %title%, activate
       }
    
        item%index%=%element%
      }
    
    }
    
    menu, tabs, add,
    menu, tabs, add, Show Desktop, desktop
    
    MouseGetPos, X, Y
    
    Menu, tabs,Show, %x%, %y%
    
    return
    
    activate:
    
    loop, %A_ThisMenuItemPos%
    {
       StringTrimRight, id, item%a_index%, 0
    }
    
    winactivate, ahk_id %id%
    
    menu, tabs, deleteall
    
    return
    
    desktop:
    WinMinimizeAll
    return
    Last edited by Pirate-M.Lifnen; 12-27-2007 at 08:35 PM.
    Rules, rules, rules. WinRAR
    The most important thread you'll ever read..

    "The mods look like the gestapo; 'do as we say, not as we do.'"
     

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •