JohnnyDepth Posted February 17, 2016 Share Posted February 17, 2016 Hi all, Is there a way to store a window's coordinates in a variable, subtract one from each coordinate, and then move the window to the new coordinates? I want the window to move slightly. I am thinking i will need to use the wingetpos, somehow store it in a variable, then winmove with the new coordinates after subtracting one from the variable and applying it to the winmove. Any help? I am not sure how to store the coordinates in a variable from the wingetpos. Thanks Link to comment Share on other sites More sharing options...
spudw2k Posted February 17, 2016 Share Posted February 17, 2016 (edited) Yes you can. The WinGetPos function returrn an Array with the X, Y, Width and Height values of a desired "window". You can then reference the appropriate Array element for the coordinate values and provide them to the WinMove function. ;pseudo-code $aWinPos = WinGetPos("title") ; X Pos Y Pos + 1 WinMove("title",$aWinPos[0],$aWinPos[1]+1) Edited February 17, 2016 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
JohnnyDepth Posted February 17, 2016 Author Share Posted February 17, 2016 32 minutes ago, spudw2k said: Yes you can. The WinGetPos function returrn an Array with the X, Y, Width and Height values of a desired "window". You can then reference the appropriate Array element for the coordinate values and provide them to the WinMove function. ;pseudo-code $aWinPos = WinGetPos("title") ; X Pos Y Pos + 1 WinMove("title",$aWinPos[0],$aWinPos[1]+1) Thank you for the help! I didn't know you could do that. How would you do this if you wanted it to do this for which ever window is active, regardless of what the title is? Link to comment Share on other sites More sharing options...
spudw2k Posted February 17, 2016 Share Posted February 17, 2016 There is another function which will give you the "active" window...namely WinGetHandle(""). Proving an empty string ("") to the function returns the handle of the active window. Keep in mind the logic will be different to keep all windows "below a line" for example. You wouldn't want to just continuously add to the window position, but set a limit/threshold or finite position value(s). Also be aware of window size to compensate for a window position that might cause a window to overhang the desktop. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
InunoTaishou Posted February 17, 2016 Share Posted February 17, 2016 Local $hWnd_active_window = WinGetHandle("[Active]") Local $win_pos = WinGetPos($hWnd_active_window) WinMove($hWnd_active_window, "", $win_pos[0], $win_pos[1] + 1) Link to comment Share on other sites More sharing options...
JohnnyDepth Posted February 18, 2016 Author Share Posted February 18, 2016 Thanks for all the help! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now