MsgBox Position

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
dpardinas
Posts: 11
Joined: 29 Sep 2020, 19:08

MsgBox Position

Post by dpardinas » 30 Nov 2022, 17:40

Good afternoon!

I have two monitors. I am getting data from cells in a spreadsheet and copying them to a program on the other screen. I'm also using Window Spy to detect a position I need to click. (This web program does not have any shortcut keys.) Once clicking and sleeping and processing is complete, I put up a "MsgBox, Continue" so as the user monitors what happened, and is ready to go to the next record, the MsgBox can be clicked. I am using Notepad++ to code (which conveniently removed all my indents when I previewed the post).

My problem is I would like to put the MsgBox up on a specific monitor and/or position. I've searched the forums and the Commands for MsgBox but I can't find anything to position the MsgBox.

I first put up a GUI box for the user to select the function they want to perform with radio buttons and a submit button. Later, there will be other functions added but for now I'm using the menu answer1 button. This is the beginning of the sections and section 1. Later there will be Else If (Answer2) code inserted for other tasks.

All I really want to do is put the MsgBox in a place to conveniently click to continue.

Thank you for any assistance!
Dianne

Code: Select all

Create:
   Gui Submit, NoHide
   If (Answer1)								;Set Privacy
   {	
		Loop, %UsedRowsNum%
		{
			varA1 := Xl.ActiveSheet.range("A" . a_index).value

			CoordMode, Mouse, Screen
			Click -1541, 385				;Clicks the search field
			Sleep, 1000					;Wait
			SendInput, %varA1% 				;Pull information from spreadsheet to search field
			Sleep, 1000 ; Wait 2 seconds	        ;Wait for information to be pasted
			Send, {Enter}					;Send enter key to search for resident
			Sleep, 2000  					;Wait for record to display
			Click -130, 603					;Actions drop down
			Sleep, 2000					;Wait
			Click -224, 657					;Edit Person
			Sleep, 2000					;Wait
			Click -601, 531					;Privacy Settings
			Sleep, 2000					;Wait

			MsgBox, Continue				;Put up message box to verify process
			;MouseMove, 992, 607				;Move mouse back to other screen to hit OK

			Click -1479, 913				;Save Changes
			Click -1830, 312				;Click Directory
			Sleep, 2000					;Wait
		}
	}
Else If (etc etc etc.)
[Mod edit: [code][/code] tags added.]
Last edited by gregster on 30 Nov 2022, 17:48, edited 1 time in total.
Reason: Please use code tags. Thank you!

User avatar
boiler
Posts: 16925
Joined: 21 Dec 2014, 02:44

Re: MsgBox Position

Post by boiler » 30 Nov 2022, 18:48

Example of how you can move a MsgBox:

Code: Select all

SetTimer, MoveMsgBox, -20
MsgBox,, Moved Box, I'm not in the usual place!
return

MoveMsgBox:
	WinMove, Moved Box ahk_class #32770 ahk_exe AutoHotkey.exe,, 0, 0
return

If it doesn't move for you, change the -20 to some longer time like -50. The shorter it is, the more invisible it will be in its original location.

Post Reply

Return to “Ask for Help (v1)”