WinMove [AutoHotkey_1.1.29.00] Topic is solved

Report problems with documented functionality
rousni
Posts: 23
Joined: 27 Dec 2014, 07:57

WinMove [AutoHotkey_1.1.29.00]

25 May 2018, 03:22

OK

Code: Select all

WinMove, X, Y
OK

Code: Select all

WinMove,,, X, Y [, Width, Height, ExcludeTitle, ExcludeText]
But this doesn't work:

Code: Select all

WinMove, WinTitle, WinText, X, Y [, Width, Height, ExcludeTitle, ExcludeText]
User avatar
jmeneses
Posts: 451
Joined: 28 Oct 2014, 11:09
Location: Catalan Republic

Re: WinMove [AutoHotkey_1.1.29.00]

25 May 2018, 03:33

Confirmed from version v1.1.28.02-13 + g52f9e5d
The script will close in WinMove
In Version v1.1.28.02 works well

Code: Select all

oVersion :=  "`nVersion: " "v" A_AhkVersion " " (A_PtrSize = 4 ? 32 : 64) "-bit / " (A_IsUnicode ? "Unicode" : "ANSI")   ;*[AHK ShowVersion]
	. "`nType:" A_Tab A_OSType . "`nOS:" A_Tab A_OSVersion     
Gui, Add, Text, , % oVersion
Gui, Show, w300 h100, WinMove TEST
winmove, WinMove TEST,, 200, 500
Return
Attachments
WinMove.png
WinMove.png (7.36 KiB) Viewed 1459 times
Donec Perficiam
joefiesta
Posts: 174
Joined: 24 Jan 2016, 13:54

Re: WinMove [AutoHotkey_1.1.29.00]

25 May 2018, 07:16

@rousni: please provide your code that you say does not work as it should. Showing the command syntax does not show what does not work.
SOD
Posts: 1
Joined: 26 Apr 2015, 03:33

Re: WinMove [AutoHotkey_1.1.29.00]

25 May 2018, 15:54

I confirm that the script is crashing when you use the command WinMove:
; Problem signature:
; Problem Event Name: APPCRASH
; Application Name: AutoHotkey.exe
; Application Version: 1.1.29.0
; Application Timestamp: 5b0762f3
; Fault Module Name: AutoHotkey.exe
; Fault Module Version: 1.1.29.0
; Fault Module Timestamp: 5b0762f3
; Exception Code: c0000005
; Exception Offset: 00001226
; OS Version: 6.1.7601.2.1.0.256.1
; Locale ID: 2057
; ...

#Persistent
ListLines
WinMove
, % "ahk_id "A_ScriptHwnd,, 0, 0
63OR63
Posts: 1
Joined: 25 May 2018, 16:25

Re: WinMove [AutoHotkey_1.1.29.00]

25 May 2018, 16:31

I confirm this problem, had to downgrade. The following code crashes the script:

Code: Select all

WinMove, %A_ScriptName%, , 0, 0
burque505
Posts: 630
Joined: 22 Jan 2017, 19:37

WinMove fails in 1.1.29.00

25 May 2018, 16:56

Hello,

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Persistent
DetectHiddenWindows, On
SetTitleMatchMode, 2

While 1=1 {
#IfWinExist, ahk_class TMain ahk_exe sr.exe
BottomWindow("ahk_class TMain")
^!Escape::ExitApp
}
			
BottomWindow(WindowName)
{
    WinGetPos,,, Width, Height, %WindowName%
    ; Crashes when it hits the next line.
    WinMove, %WindowName%,, (A_ScreenWidth/2)-(Width/2), (A_ScreenHeight)-(A_ScreenHeight*.05)
	return
}
Works fine in AHK_L U64 1.1.28.002 (and has since 1.1.26), crashes in AHK_L U64 1.1.29.00.
If I put a msgbox in right before the WinMove directive it'll run till there, then crashes on exiting the msgbox.

Edit: It occurs to me I have not considered other possibilities - perhaps the failure is in A_ScreenWidth or A ScreenHeight ???

Regards,
burque505
User avatar
goldeneyesrj
Posts: 37
Joined: 18 Jan 2016, 22:09
Location: Rio de Janeiro / Brazil

v1.1.29.00 script close after winmove

25 May 2018, 19:01

If i use winmove to resize windows:

Code: Select all

WinMove, EPOCA RADIO,,,,, 124
the script freeze and crash after a short time.
Last edited by goldeneyesrj on 25 May 2018, 21:23, edited 1 time in total.
Guest

Re: WinMove [AutoHotkey_1.1.29.00]

25 May 2018, 20:20

I have essentially the same problem with AutoHotkey_1.1.29.00.
lexikos
Posts: 6207
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: WinMove [AutoHotkey_1.1.29.00]

25 May 2018, 21:51

I have a fix, but it seems there might be other issues. For now, you can revert to a previous version or use the Last Found Window (omit WinTitle and WinText).
DRocks
Posts: 190
Joined: 08 May 2018, 10:20

Re: WinMove [AutoHotkey_1.1.29.00]

26 May 2018, 09:05

Hello guys,

Following this topic I also have a custom made WindowManager which probably has bad coding in some points but it worked good in 1.1.28.02.
In 1.1.29 it doesnt work at all and crashes automatically when pressing the Hotkey that triggers the WinMoves

Code: Select all

;https://autohotkey.com/boards/viewtopic.php?f=5&t=49087&p=219059#p219059
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
SetTitleMatchMode, RegEx
#SingleInstance, Force

;=============================================================================================================================================
;=============================================================================================================================================
WinTitlesArray:=  [ "AutoHotkey.Help",   "AHK Studio",   "ahk_class Chrome_WidgetWin_1",   "Window.Spy",   "WinSpy",   "ahk_class CabinetWClass",   "DataSage50",   "INFOS.CLIENT",   "TempsTravail",   ".SAI",   "Ventes|Revenus|Produits ahk_class WindowsForms10.Window.8.app.0.(?:.*)_r38_ad1",   "Achats|fournisseurs|Charges ahk_class WindowsForms10.Window.8.app.0.(?:.*)_r38_ad1",   "Bilan ahk_class WindowsForms10.Window.8.app.0.(?:.*)_r38_ad1",   ".tat des r.sultats ahk_class WindowsForms10.Window.8.app.0.(?:.*)_r38_ad1",   "Rapport.*Rapprochement ahk_class WindowsForms10.Window.8.app.0.(?:.*)_r38_ad1",   "Rapport.*sommaire ahk_class WindowsForms10.Window.8.app.0.(?:.*)_r38_ad1",   "Encaissements ahk_class #32770",	"Paiements ahk_class #32770",    "Virer des Fonds ahk_class #32770",		 "Rapprochement & d.p.ts ahk_class #32770",    "Journal.g.n.ral ahk_class #32770",    "REGISTRE_KM",   "TauxStatsCan.csv",    "Visual Studio Code",   "Accessible.Info.Viewer",   "D.tails chronologiques des clients"  ]
;=============================================================================================================================================
;=============================================================================================================================================


!#1::
SetBatchLines, -1
SetWinDelay, 0
SaveWindows(WinTitlesArray)		; Function call
Return

#1::
SetBatchLines, -1
SetWinDelay, 0
RepositionWindows(WinTitlesArray) 	; function call
Return


;=============================================================================================================================================
;=============================================================================================================================================
; Functions
;=============================================================================================================================================
;=============================================================================================================================================
SaveWindows(WinTitlesArray) 		; SaveWindows( **WinTitles Array**)
{
	MsgBox,262180,Sauvegarder la position des fenêtres?,Voulez-vous sauvegarder la position des fenêtres, ou non?`n`nSi Oui, le fichier WinTitleStats_%A_ComputerName%.ini sera actualisé en conséquence des changements analysés.
	ifMsgBox No
		return
	WinClose, WinTitleStats_%A_ComputerName%
	WinGetActiveTitle, LastActiveWindowSaved
	For Each, WinTitle in WinTitlesArray
	{
		This_WinTitle:= WinTitle
		if WinExist(This_WinTitle)
		{
			IniRead, Ini_x, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, x
			IniRead, Ini_y, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, y
			IniRead, Ini_w, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, w
			IniRead, Ini_h, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, h
			IniRead, Ini_MinMax, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, MinMax
			WinActivate, %This_WinTitle%
			WinGetPos,Current_x,Current_y,Current_w,Current_h, %This_WinTitle%
			WinGet, Current_MinMax, MinMax, %This_WinTitle%
			if (Current_x != Ini_x) or (Current_y != Ini_y) or (Current_w != Ini_w) or (Current_h != Ini_h) ;or (Current_MinMax != Ini_MinMax)
			{
				IniDelete, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%
				IniWrite, %Current_x%, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, x			
				IniWrite, %Current_y%, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, y
				IniWrite, %Current_w%, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, w
				IniWrite, %Current_h%, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, h
				IniWrite, %Current_MinMax%, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, MinMax
				IniWrite, %A_Space%, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, _________________________________________________________________________________________
				;IniWrite, Value	, Filename							  , Section		  , Key
			}
		}
	}
	WinActivate, %LastActiveWindowSaved%
}


;=============================================================================================================================================
;=============================================================================================================================================
RepositionWindows(WinTitlesArray) 	; RepositionWindows( **WinTitles Array**)
;=============================================================================================================================================
;=============================================================================================================================================
{
	WinClose, WinTitleStats_%A_ComputerName%
	WinGetActiveTitle, LastActiveWindowSaved
	For Each, WinTitle in WinTitlesArray
	{
		LoopTopLabel:
		This_WinTitle:= WinTitle
		if WinExist(This_WinTitle)
		{
			;IniRead, Ini_MinMax, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, MinMax
			;if (Ini_MinMax = 1)
				;WinMaximize, %This_WinTitle%
			;else if (Ini_MinMax = -1) ;and (LastActiveWindow !== %This_WinTitle%)
				;WinMinimize, %This_WinTitle%
			;else if (Ini_MinMax = 0)
			;{
				;IniRead, OutputVar, 	Filename			   , Section		, Key	 [, Default]
				IniRead, Ini_x, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, x
				IniRead, Ini_y, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, y
				IniRead, Ini_w, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, w
				IniRead, Ini_h, WinTitleStats_%A_ComputerName%.ini, %This_WinTitle%, h
				WinGetPos,Current_x,Current_y,Current_w,Current_h, %This_WinTitle%
				WinGet, Current_MinMax, MinMax, %This_WinTitle%
				WinGet, MatchingTitle, List, %This_WinTitle% ; Compare this WinTitle contained in the Array to count how many matches with All existing windows and retrieve IDs of these in pseudo-array
				if (MatchingTitle > 1) ; If there is more than 1 existing window matching with This_WinTitle
				{
					;MsgBox % "Inside Loop Layer1`n`nSearching for This_WinTitle in all existing windows to count matches:`n`n" WinTitle "`n`nNumber of Matches found:`n" MatchingTitle
					Loop, %MatchingTitle% ; loop for the amount of matches we found
					{
						This_WinTitle:= "ahk_id " MatchingTitle%A_Index% ; MatchingTitle contient le no. de MATCH| MatchingTitles1, MatchingTitles2, MatchingTitles3, etc.. = Unique ID of This_WinTitle
						;MsgBox % "Inside Loop Layer2`n`nAnalysed Match " A_Index "/" MatchingTitle " for`n" This_WinTitle "`n`nThis Matching Window's unique ID is:`n" This_WinTitle
						if (Current_MinMax = 0) and (Current_x != Ini_x) or (Current_y != Ini_y) or (Current_w != Ini_w) or (Current_h != Ini_h)
							WinMove, %This_WinTitle%,, %Ini_x%, %Ini_y%, %Ini_w%, %Ini_h%
						else if (Current_MinMax != 0) and (Current_x != Ini_x) or (Current_y != Ini_y) or (Current_w != Ini_w) or (Current_h != Ini_h)
						{
							;WinRestore, %This_WinTitle%
							WinMove, %This_WinTitle%,, %Ini_x%, %Ini_y%, %Ini_w%, %Ini_h%
						}
					}
				}
				else if (Current_MinMax = 0) ; Normal state (not Minimized or Maximized)
					if (Current_x != Ini_x) or (Current_y != Ini_y) or (Current_w != Ini_w) or (Current_h != Ini_h)
					{
						;WinMove, WinTitle	    ,WinText,X, 	Y [, Width  , Height, ExcludeTitle, ExcludeText]
						WinMove, %This_WinTitle%,, %Ini_x%, %Ini_y%, %Ini_w%, %Ini_h%
						;Goto,LoopTopLabel
						;MsgBox MinMax = 0 and Ini_positions are not matching Current Positions: Continuing back to LoopTopLabel
					}
				else if (Current_MinMax = 1) ; Maximized
					if (Current_x != Ini_x) or (Current_y != Ini_y) or (Current_w != Ini_w) or (Current_h != Ini_h)
					{
						WinRestore, %This_WinTitle%
						WinMove, %This_WinTitle%,, %Ini_x%, %Ini_y%, %Ini_w%, %Ini_h%
						;MsgBox MinMax = 1: do nothing: Going LoopTopLabel
					}
				else if (Current_MinMax = -1)
					{
						;WinRestore, %This_WinTitle%
						;WinMove, %This_WinTitle%,, %Ini_x%, %Ini_y%, %Ini_w%, %Ini_h%
						;MsgBox MinMax = -1: do nothing: Continuing back to LoopTopLabel
					}
			;}
		}
		WinActivate, %LastActiveWindowSaved%
	}
}	

^#!1::ExitApp
User avatar
goldeneyesrj
Posts: 37
Joined: 18 Jan 2016, 22:09
Location: Rio de Janeiro / Brazil

Re: WinMove [AutoHotkey_1.1.29.00]

01 Jun 2018, 11:45

"Seven Days"
Samara from The Ring kill today. :LOL:
lexikos
Posts: 6207
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: WinMove [AutoHotkey_1.1.29.00]  Topic is solved

02 Jun 2018, 00:34

DRocks, you are not using the workaround I noted in my previous post.

Now I suggest you update to v1.1.29.01.
User avatar
goldeneyesrj
Posts: 37
Joined: 18 Jan 2016, 22:09
Location: Rio de Janeiro / Brazil

Re: WinMove [AutoHotkey_1.1.29.00]

02 Jun 2018, 10:32

lexikos Thankx for new version.
AHK is the most important tool for me.
DRocks
Posts: 190
Joined: 08 May 2018, 10:20

Re: WinMove [AutoHotkey_1.1.29.00]

13 Jun 2018, 12:20

lexikos wrote:DRocks, you are not using the workaround I noted in my previous post.

Now I suggest you update to v1.1.29.01.
Thank you Lexikos

Return to “Bug Reports”

Who is online

Users browsing this forum: SpaghettiCoder and 6 guests