topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday March 19, 2024, 5:10 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Request. Add feature to the free program  (Read 21488 times)

plander

  • Participant
  • Joined in 2012
  • *
  • Posts: 8
    • View Profile
    • Donate to Member
Request. Add feature to the free program
« on: July 17, 2012, 12:35 PM »
Hi. I use a program, called AltDrag, this program very good, but haven't 1 useful thing - i can't drag windows by pressing only middle mouse button, they can drag windows by combinations alt or ctrl + mouse button, but drag windows by only middle button, without alt or ctrl this program can't. I talk with author, but he say that he haven't time to add this feature and say that i can add by myself, it's free source code, but i don't know coding, but want this feature very much :(

Pls someone can add this feature to this program? or in irc guys give me some script, but he can't drag only by middle mouse button to, may be u can edit this script or add feature to the program?

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: Request. Add feature to the free program
« Reply #1 on: July 17, 2012, 01:05 PM »
or in irc guys give me some script, but he can't drag only by middle mouse button to, may be u can edit this script or add feature to the program?

Hi, plander, and welcome to DonationCoder.  Here is a modified version of the AHK script that should do what you requested:

Code: Autohotkey [Select]
  1. ~MButton::
  2. CoordMode, Mouse  ; Switch to screen/absolute coordinates.
  3. MouseGetPos, EWD_MouseStartX, EWD_MouseStartY, EWD_MouseWin
  4. WinGetPos, EWD_OriginalPosX, EWD_OriginalPosY,,, ahk_id %EWD_MouseWin%
  5. WinGet, EWD_WinState, MinMax, ahk_id %EWD_MouseWin%
  6. if EWD_WinState = 0  ; Only if the window isn't maximized
  7.     SetTimer, EWD_WatchMouse, 10 ; Track the mouse as the user drags it.
  8. return
  9.  
  10. EWD_WatchMouse:
  11. GetKeyState, EWD_LButtonState, MButton, P
  12. if EWD_LButtonState = U  ; Button has been released, so drag is complete.
  13. {
  14.     SetTimer, EWD_WatchMouse, off
  15.     return
  16. }
  17. GetKeyState, EWD_EscapeState, Escape, P
  18. if EWD_EscapeState = D  ; Escape has been pressed, so drag is cancelled.
  19. {
  20.     SetTimer, EWD_WatchMouse, off
  21.     WinMove, ahk_id %EWD_MouseWin%,, %EWD_OriginalPosX%, %EWD_OriginalPosY%
  22.     return
  23. }
  24. ; Otherwise, reposition the window to match the change in mouse coordinates
  25. ; caused by the user having dragged the mouse:
  26. CoordMode, Mouse
  27. MouseGetPos, EWD_MouseX, EWD_MouseY
  28. WinGetPos, EWD_WinX, EWD_WinY,,, ahk_id %EWD_MouseWin%
  29. SetWinDelay, -1   ; Makes the below move faster/smoother.
  30. WinMove, ahk_id %EWD_MouseWin%,, EWD_WinX + EWD_MouseX - EWD_MouseStartX, EWD_WinY + EWD_MouseY - EWD_MouseStartY
  31. EWD_MouseStartX := EWD_MouseX  ; Update for the next timer-call to this subroutine.
  32. EWD_MouseStartY := EWD_MouseY
  33. return

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: Request. Add feature to the free program
« Reply #2 on: July 17, 2012, 01:12 PM »
Hi, plander, and welcome to DonationCoder.  Here is a modified version of the AHK script that should do what you requested:
I believe what plander is asking for is a program that works both with mbutton and with alt. From what I understand, you are suggesting that he runs both the program you posted and the original AHK version, right?

AndyM

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 616
    • View Profile
    • Donate to Member
Re: Request. Add feature to the free program
« Reply #3 on: July 17, 2012, 01:35 PM »
Move Inactive Window by Skrommel

https://www.donation...mel/#MoveInactiveWin

Hold down the Alt key and LeftClick drag any non-focused window without giving that window focus.  That's the original purpose of the script, but Alt-drag works on the active window also.

You could check out the code to change or add other hotkey combinations.

plander

  • Participant
  • Joined in 2012
  • *
  • Posts: 8
    • View Profile
    • Donate to Member
Re: Request. Add feature to the free program
« Reply #4 on: July 17, 2012, 02:14 PM »
i want hold only middle button and drag, not alt + left mouse button, not alt + middle mouse button, only middle

plander

  • Participant
  • Joined in 2012
  • *
  • Posts: 8
    • View Profile
    • Donate to Member
Re: Request. Add feature to the free program
« Reply #5 on: July 17, 2012, 02:18 PM »
skwire thank u for the script, it's work, thank you, but it not work for full opened windows and this script can't do many good things that can do altdrag program, may be u can add this feature to the program? :(
« Last Edit: July 17, 2012, 02:44 PM by plander »

AndyM

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 616
    • View Profile
    • Donate to Member
Re: Request. Add feature to the free program
« Reply #6 on: July 17, 2012, 02:20 PM »
then try skwire's script

plander

  • Participant
  • Joined in 2012
  • *
  • Posts: 8
    • View Profile
    • Donate to Member
Re: Request. Add feature to the free program
« Reply #7 on: July 17, 2012, 02:26 PM »
and what about edit altdrag program? coz program very useful and functional and i want very much use it with middle button
« Last Edit: July 17, 2012, 02:38 PM by plander »

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,958
    • View Profile
    • Donate to Member
Re: Request. Add feature to the free program
« Reply #8 on: July 17, 2012, 04:10 PM »
and what about edit altdrag program?

have you asked the author of AltDrag?
Tom

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: Request. Add feature to the free program
« Reply #9 on: July 17, 2012, 05:28 PM »
have you asked the author of AltDrag?
I talk with author, but he say that he haven't time to add this feature and say that i can add by myself, it's free source code, but i don't know coding, but want this feature very much
yep :P

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: Request. Add feature to the free program
« Reply #10 on: July 17, 2012, 05:47 PM »
AltDrag has a window resize similar to linux: when you press Alt and drag close to the corner, you can resize that window in that direction.
I'm pretty sure I've seen something like that somewhere. Probably it's one of these two (most likely the first one):
http://www.autohotke...WindowDrag_(KDE).htm
http://www.enovatic....ywindows/onlinedemo/

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: Request. Add feature to the free program
« Reply #11 on: July 17, 2012, 05:49 PM »
Also, another option: plander, why don't you run the script skrommel posted and altdrag? They complement each other and could solve your problem.

plander

  • Participant
  • Joined in 2012
  • *
  • Posts: 8
    • View Profile
    • Donate to Member
Re: Request. Add feature to the free program
« Reply #12 on: July 18, 2012, 12:39 AM »
jgpaiva i run script and altdrag, but they do not interact together , coz when i drag windows by middle mouse button the don't resize and nothing happend (they just moving by script), (when i use alt drag commands) windows resize only when i press alt + drag window, but i want only press middle button and drag and resize. They work separately, not together, this is a problem.

and thank you for the NiftyWindows program, very interesting, but steel haven't drag by middle button and hotkeys in opera not work when run NiftyWindows :(
« Last Edit: July 18, 2012, 03:00 AM by plander »

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: Request. Add feature to the free program
« Reply #13 on: July 18, 2012, 10:25 AM »
I see.
I modified the easywindowdrag script to include the resizing stuff.
See below:
; This script was inspired by and built on many like it
; in the forum. Thanks go out to ck, thinkstorm, Chris,
; and aurelian for a job well done. Modified by jgpaiva

; Change history:
; November 07, 2006: Optimized resizing code in !RButton, courtesy of bluedawn.
; February 05, 2006: Fixed double-alt (the ~Alt hotkey) to work with latest versions of AHK.
; February 05, 2006: removed alt stuff, changed for middlebutton

; The shortcuts:
;  Alt + Left Button  : Drag to move a window.
;  Alt + Right Button : Drag to resize a window.
;  Double-Alt + Left Button   : Minimize a window.
;  Double-Alt + Right Button  : Maximize/Restore a window.
;  Double-Alt + Middle Button : Close a window.
;
; You can optionally release Alt after the first
; click rather than holding it down the whole time.

If (A_AhkVersion < "1.0.39.00")
{
    MsgBox,20,,This script may not work properly with your version of AutoHotkey. Continue?
    IfMsgBox,No
    ExitApp
}


; This is the setting that runs smoothest on my
; system. Depending on your video card and cpu
; power, you may want to raise or lower this value.
SetWinDelay,2

CoordMode,Mouse
return

MButton::
; Get the initial mouse position and window id, and
; abort if the window is maximized.
MouseGetPos,KDE_X1,KDE_Y1,KDE_id
WinGet,KDE_Win,MinMax,ahk_id %KDE_id%
If KDE_Win
    return
; Get the initial window position and size.
WinGetPos,KDE_WinX1,KDE_WinY1,KDE_WinW,KDE_WinH,ahk_id %KDE_id%
; Define the window region the mouse is currently in.
if (KDE_X1 < KDE_WinX1 + KDE_WinW / 2)
   KDE_WinLeft := 1        
else
   KDE_WinLeft := -1

if (KDE_Y1 < KDE_WinY1 + KDE_WinH / 2)
   KDE_WinUp := 1      
else
   KDE_WinUp := -1

centerX := KDE_X1 > KDE_WinX1 + KDE_WinW / 3 AND KDE_X1 < KDE_WinX1 + 2*KDE_WinW /3

centerY := KDE_Y1 > KDE_WinY1 + KDE_WinH / 3 AND KDE_Y1 < KDE_WinY1 + 2*KDE_WinH /3


Loop
{
    GetKeyState,KDE_Button,MButton,P ; Break if button has been released.
    If KDE_Button = U
        break
    MouseGetPos,KDE_X2,KDE_Y2 ; Get the current mouse position.
    ; Get the current window position and size.
    WinGetPos,KDE_WinX1,KDE_WinY1,KDE_WinW,KDE_WinH,ahk_id %KDE_id%
    KDE_X2 -= KDE_X1 ; Obtain an offset from the initial mouse position.
    KDE_Y2 -= KDE_Y1
    ; Then, act according to the defined region.
    if (centerX AND centerY)
      WinMove,ahk_id %KDE_id%,, KDE_WinX1 + KDE_X2  ; X of resized window
                              , KDE_WinY1 + KDE_Y2  ; Y of resized window
                              , KDE_WinW ; W of resized window
                              , KDE_WinH ; H of resized window
    else
        WinMove,ahk_id %KDE_id%,, KDE_WinX1 + (KDE_WinLeft+1)/2*KDE_X2  ; X of resized window
                                , KDE_WinY1 +   (KDE_WinUp+1)/2*KDE_Y2  ; Y of resized window
                                , KDE_WinW  -     KDE_WinLeft  *KDE_X2  ; W of resized window
                                , KDE_WinH  -       KDE_WinUp  *KDE_Y2  ; H of resized window

    KDE_X1 := (KDE_X2 + KDE_X1) ; Reset the initial position for the next iteration.
    KDE_Y1 := (KDE_Y2 + KDE_Y1)
}
return
DISCLAIMER: I do *not* have a computer to test this code on, so it may very well not work. If any bananas explode when using this program, I claim no responsibility :P
« Last Edit: July 19, 2012, 10:58 AM by jgpaiva, Reason: updating code »

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: Request. Add feature to the free program
« Reply #14 on: July 19, 2012, 10:58 AM »
Ok, I've updated the above post to include code that actually has been tested and works! :P

plander

  • Participant
  • Joined in 2012
  • *
  • Posts: 8
    • View Profile
    • Donate to Member
Re: Request. Add feature to the free program
« Reply #15 on: July 19, 2012, 01:07 PM »
jgpaiva yea it's work, but not so cool like altdrag or other functional programs  :(

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: Request. Add feature to the free program
« Reply #16 on: July 19, 2012, 01:09 PM »
jgpaiva yea it's work, but not so cool like altdrag or other functional programs  :(
What are you missing?

plander

  • Participant
  • Joined in 2012
  • *
  • Posts: 8
    • View Profile
    • Donate to Member
Re: Request. Add feature to the free program
« Reply #17 on: July 24, 2012, 03:36 PM »
Is it so hard to add middle button feature to altdrag ?

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: Request. Add feature to the free program
« Reply #18 on: July 24, 2012, 06:46 PM »
Given that altdrag is written in C, yes. It would be a considerable amount of work to understand how the program is implemented, and then I'd have to learn how to create the hooks for the middle button in C (which I have zero previous experience). I'm sorry, but if that's what you need, I really can't help anymore :(

plander

  • Participant
  • Joined in 2012
  • *
  • Posts: 8
    • View Profile
    • Donate to Member
Re: Request. Add feature to the free program
« Reply #19 on: July 25, 2012, 01:05 AM »
 :( and noone else can't do that?

AndyM

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 616
    • View Profile
    • Donate to Member
Re: Request. Add feature to the free program
« Reply #20 on: July 25, 2012, 09:34 AM »
I've assigned things to the middle button using AutoHotkey.  It can be a little flakey so I only kept the things that worked.

Might be worth a try so you could keep AltDrag and assign either Alt-Left or Alt-Middle to MiddleButtonDown.  Can't see how you could assign both to MiddleButtonDown, and Alt-Middle might be flakey.  Assigning  Alt-Left ButtonDown to MiddleButtonDown would be worth a try if that's the key combo you want to fire when you MiddleClickDrag.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: Request. Add feature to the free program
« Reply #21 on: July 30, 2012, 03:13 PM »
Here's an alternative to AltDrag that allows you to set the middle mouse button to resize windows:

http://www.deskex.com/AltMove/index.asp