AWS issues with Alt + Click to move window

Get help with using AutoHotkey and its commands and hotkeys
User avatar
AlleyArtwork
Posts: 43
Joined: 09 Jun 2015, 21:08

AWS issues with Alt + Click to move window

23 Apr 2019, 09:35

Hello,
I'm hoping to understand why this script won't work in a Win10 AWS VM desktop.

It works perfectly on: Win10 laptop, Win7 laptop, Win7 VDI desktop but when i tried to use it in AWS, it does nothing.
I am using an identical script file (not copied, but actual same script file from a network drive) in all environments.
other scripts within the same file work in AWS (ones using hotstrings, loops, variables etc,) but for some reason the Alt + Left Click doesn't doesn't move the window at all.

Just in case AWS handled passing through commands unexpectedly, I used msgbox to see if it was even pulling an id when alt+Lbutton click on a window. It does pull a unique value for any given window clicked on and assigning it to %EWD_MouseWin%.

The issue doesn't appear to be with the gathering of the ID. I'm assuming then, that the issue is somewhere with either MouseGetPos, WinGetPos or WinMove not playing nice within AWS.
It's a longshot but hoping someone knows how to take this a step further than I do for troubleshooting, as it appears to be specific behavior within AWS.

Script used:

Code: Select all

;---------------------------------------------------------------
; Move/drag Window from anywhere without having to click on the title bar.
; Press Alt + Left Mouse button and drag the window
;---------------------------------------------------------------
Alt & LButton::
CoordMode, Mouse  ; Switch to screen/absolute coordinates.
MouseGetPos, EWD_MouseStartX, EWD_MouseStartY, EWD_MouseWin
WinGetPos, EWD_OriginalPosX, EWD_OriginalPosY,,, ahk_id %EWD_MouseWin%
WinGet, EWD_WinState, MinMax, ahk_id %EWD_MouseWin% 
if EWD_WinState = 0  ; Only if the window isn't maximized 
	SetTimer, EWD_WatchMouse, 10 ; Track the mouse as the user drags it.
return

EWD_WatchMouse:
GetKeyState, EWD_LButtonState, LButton, P
if EWD_LButtonState = U  ; Button has been released, so drag is complete.
{
	SetTimer, EWD_WatchMouse, off
	return
}
GetKeyState, EWD_EscapeState, Escape, P
if EWD_EscapeState = D  ; Escape has been pressed, so drag is cancelled.
{
	SetTimer, EWD_WatchMouse, off
	WinMove, ahk_id %EWD_MouseWin%,, %EWD_OriginalPosX%, %EWD_OriginalPosY%
	return
}
; Otherwise, reposition the window to match the change in mouse coordinates
; caused by the user having dragged the mouse:
CoordMode, Mouse
MouseGetPos, EWD_MouseX, EWD_MouseY
WinGetPos, EWD_WinX, EWD_WinY,,, ahk_id %EWD_MouseWin%
SetWinDelay, -1   ; Makes the below move faster/smoother.
WinMove, ahk_id %EWD_MouseWin%,, EWD_WinX + EWD_MouseX - EWD_MouseStartX, EWD_WinY + EWD_MouseY - EWD_MouseStartY
EWD_MouseStartX := EWD_MouseX  ; Update for the next timer-call to this subroutine.
EWD_MouseStartY := EWD_MouseY
return

Return to “Ask For Help”

Who is online

Users browsing this forum: Albireo, Bing [Bot], BXF, Google [Bot], ilhom, kyuuuri, PuzzledGreatly, snowmind, Spikea and 231 guests