WinMove not working

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
donsonmd
Posts: 55
Joined: 19 Feb 2017, 05:57

WinMove not working

29 Nov 2021, 08:54

Hello,

I can't have the MsgBox window moved. The file is test.AHK and the WinTitle was obtained from WinSpy. What am I doing wrong? Please help. Thank you.

Code: Select all

DOS := "11/29/21"
PtName := "John Doe"
BD := "08/22/82"

MsgBox, 4096, DOS-Name-BD, % "DOS:`t" DOS "`n`nName:`t" PtName "`n`nDOB:`t" BD
WinWaitActive, DOS-Name-BD ahk_exe Test.exe
;WinMove, ahk_class #32770, , 82, 300
WinMove, DOS-Name-BD, , 82, 300
;WinMove, ahk_exe test.exe, , 82, 300
;WinMove, DOS-Name-BD ahk_exe Test.exe, , 82, 300
Return
Last edited by gregster on 29 Nov 2021, 10:34, edited 1 time in total.
Reason: Topic moved from 'Scripts and Functions'.
tuzi
Posts: 223
Joined: 27 Apr 2016, 23:40

Re: WinMove not working

29 Nov 2021, 09:34

Here is "Scripts and Functions", you need to go "Ask For Help".
User avatar
jmeneses
Posts: 524
Joined: 28 Oct 2014, 11:09
Location: Catalan Republic

Re: WinMove not working

29 Nov 2021, 10:08

The MSGBOX statement stops the process until the OK button is pressed. To move an MSGBOX window you must do it with a timer in an independent thread, try this:

Code: Select all


title := "DOS-Name-BD"
DOS := "11/29/21"
PtName := "John Doe"
BD := "08/22/82"

test_move := Func("WinMoveMsgBox").bind(title)
SetTimer, % test_move, 50
MsgBox, 4096, % title, % "DOS:`t" DOS "`n`nName:`t" PtName "`n`nDOB:`t" BD   
Return

WinMoveMsgBox(pTitle) { 
	ID:=WinExist(pTitle)
  If (ID) {
    WinMove, % "ahk_id "ID ,82,300 
    SetTimer ,, off         
  }     
 Return
}
Donec Perficiam
donsonmd
Posts: 55
Joined: 19 Feb 2017, 05:57

Re: WinMove not working

29 Nov 2021, 16:58

Thank you so much @jmeneses for sharing your wisdom :D :D

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 351 guests