Multiple msgboxes at random positions

Get help with using AutoHotkey and its commands and hotkeys
DJQuad
Posts: 23
Joined: 25 Mar 2016, 10:11

Multiple msgboxes at random positions

28 Jan 2018, 18:54

Hey all, my goal is to basically have multiple msgboxes at random positions. The "randomness" in this works fine when run by itself -

Code: Select all

; generate a random number between x and y
x = 1
y = 800
random, randNum, %x%, %y%

; nPosX:=10, nPosY:=10 ; coordinates to move to.

nPosX:=%randNum%, nPosY:=%randNum% ; coordinates to move to.
setTimer, watchMsgBox, 10 ; jumps to label watchMsgBox and..

MsgBox 0x40031, Popup Found!

IfMsgBox OK, { }

Else IfMsgBox Cancel, { }

exitApp
return

watchMsgBox:
  winMove, ahk_class #32770,, %randNum%, %randNum% ; ..moves the msgbox to coordinates.
  winGetPos, mbX, mbY,,, ahk_class #32770 ; checks to see msgbox position.
  if ( mbX=%randNum% && mbY=%randNum% ) ; if msgbox position = coordinates..
    setTimer, watchMsgBox, off ; ..stop jumping to label.
return
Since within this script there can't be multiple MsgBox windows open (please correct me if I'm wrong), I run them with a runner script -

Code: Select all

Loop, 3 {
Run, C:\Users\Public\msgbox.ahk
}
It gives very unexpected results. It should open 3 instances of msgboxes all at random positions. If I change the number from 3 to 30, it should open 30.

My goal is to annoy the shit out of tech support scammers after they connect to my VM. ;) This is one of very, very many scripts to achieve that goal.
User avatar
Exaskryz
Posts: 2876
Joined: 17 Oct 2015, 20:28

Re: Multiple msgboxes at random positions

28 Jan 2018, 19:04

You can trigger multiple MsgBoxes through SetTimer:

Code: Select all

SetTimer, MsgBox_1, -300
SetTimer, MsgBox_2, -400
SetTimer, MsgBox_3, -500
Sleep 700 ; bypass #Persistent and ExitApp by making the auto-execute section last longer than it takes for the first MsgBoxes to appear
return

MsgBox_1:
SetTimer, MoveMsgBox_1, -50
MsgBox,,Title_1,Text_1
return

MoveMsgBox_1:
WinMove, Title_1,, 100, 200
return

MsgBox_2:
SetTimer, MoveMsgBox_2, -50
MsgBox,,Title_2,Text_2
return

MoveMsgBox_2:
WinMove, Title_2,, 300, 400
return

MsgBox_3:
SetTimer, MoveMsgBox_3, -50
MsgBox,,Title_3,Text_3
return

MoveMsgBox_3:
WinMove, Title_3,, 1000, 800
return
DJQuad
Posts: 23
Joined: 25 Mar 2016, 10:11

Re: Multiple msgboxes at random positions

28 Jan 2018, 19:33

I haven't tested this yet, but If I'm reading this right, it only opens 3. Is there a way to make it configurable so it opens 30 via a loop? Or 300 for that matter

I.E., Loop, X should simply control how many times it's run, all with random locations. So by changing a number, it could be configured to run 2 times (2 msgboxes at once and random locations), 12 times, or 653 times. ;)
User avatar
Exaskryz
Posts: 2876
Joined: 17 Oct 2015, 20:28

Re: Multiple msgboxes at random positions

28 Jan 2018, 22:21

Yeah, feel free to open more. Using A_Index, A_ThisLabel, and stacked labels, we can do some good concise trickery:

Code: Select all

Loop, 5
    SetTimer, MsgBox_%A_Index%, % -100*A_Index ; the times need to be different or else it conflicts as threads interfere and can't have launched simultaneously
Sleep 600
return

MsgBox_1:
MsgBox_2:
MsgBox_3:
MsgBox_4:
MsgBox_5:
SetTimer, Move%A_ThisLabel%, -50
number:=SubStr(A_ThisLabel,8)
MsgBox,,Title_%number%, Text_%number%
return

MoveMsgBox_1:
MoveMsgBox_2:
MoveMsgBox_3:
MoveMsgBox_4:
MoveMsgBox_5:
number:=SubStr(A_ThisLabel,12)
WinMove, Title_%number%,, % 150*number, % 100*number
return
I did not put the random in. I think you can figure that out. I would put it in the MoveMsgBox_ labels and not use the 150*number, 100*number.

The timing isn't perfect, so you can perfect that. Maybe that -50 should be a -25 when setting the timer of MoveMsgBox_n.
DJQuad
Posts: 23
Joined: 25 Mar 2016, 10:11

Re: Multiple msgboxes at random positions

29 Jan 2018, 14:41

For the loop, is it a must to have as many MsgBox_X lines as the number of boxes? I was hoping to change how many MsgBoxes are created by one specified place.

Here's the code for the MsgBox

Code: Select all

OnMessage(0x44, "OnMsgBox")
MsgBox 0x40031, Virus found, Run scanner?
OnMessage(0x44, "")

IfMsgBox OK, { } 
Else
IfMsgBox Cancel, { }

OnMsgBox() {
    DetectHiddenWindows, On
    Process, Exist
    If (WinExist("ahk_class #32770 ahk_pid " . ErrorLevel)) {
        WinMove 200, 200
    }
}
And I couldn't get the positions to be random. :(
User avatar
Exaskryz
Posts: 2876
Joined: 17 Oct 2015, 20:28

Re: Multiple msgboxes at random positions

29 Jan 2018, 18:07

Honestly, I'm not sure. I didn't try it out... Maybe you can use a single MoveMsgBox label, and if you don't need variety in your MsgBox, then the create MsgBox label would work.

I was thinking of random done like this:

Code: Select all

MoveMsgBox:
Random, x, 100, 1200
Random, y, 100, 500
WinMove, MsgBox, %x%, %y%
return
But that reminds me, the reason I thought to have multiple labels is because you may want multiple titles for your MsgBoxes to make sure each MsgBox is moved only move.

But you can have excess labels; but it would be an upper limit if you needed.
DJQuad
Posts: 23
Joined: 25 Mar 2016, 10:11

Re: Multiple msgboxes at random positions

29 Jan 2018, 18:23

No worries, I really appreciate your help!

Does anyone have any ideas? Again, the goal is to just pop up a ton of Msgboxes at random positions.
Odlanir
Posts: 477
Joined: 20 Oct 2016, 08:20

Re: Multiple msgboxes at random positions

30 Jan 2018, 09:07

I suspect you can't achieve the result expected. The max number of Msgbox per thread seems to be 7.

Code: Select all

Loop, 8 {
    SetTimer, MsgBox_%A_Index%, % -50*A_Index        
}
return

MsgBox_1:
MsgBox_2:
MsgBox_3:
MsgBox_4:
MsgBox_5:
MsgBox_6:
MsgBox_7:
MsgBox_8:
   number:=SubStr(A_ThisLabel,8)
   SetTimer, MoveMsgBox_%number%, -50
   MsgBox,,Title_%number%, Text_%number%
return

MoveMsgBox_1:
MoveMsgBox_2:
MoveMsgBox_3:
MoveMsgBox_4:
MoveMsgBox_5:
MoveMsgBox_6:
MoveMsgBox_7:
MoveMsgBox_8:
number:=SubStr(A_ThisLabel,12)
random, rndx, 1, 1000
random, rndy, 1, 600
WinMove, Title_%number%,, % rndx, % rndy
return
____________________________________________________________________________
Windows 10 Pro 64 bit - Autohotkey v1.1.30.01 64-bit Unicode
DJQuad
Posts: 23
Joined: 25 Mar 2016, 10:11

Re: Multiple msgboxes at random positions

31 Jan 2018, 12:04

Yeah that won't work then. I'm going to try to do it with GUIs instead. Thanks!
MaxAstro
Posts: 552
Joined: 05 Oct 2016, 13:00

Re: Multiple msgboxes at random positions

31 Jan 2018, 12:39

A fun thing you could do with GUIs is have each GUI be owned by another GUI, and use the setting that blocks input on the parent GUIs until the child is closed. That way the GUIs have to be closed in a specific, random order.

For bonus points have a timer running in the background that spawns new children off of random GUIs every few seconds. :P
DJQuad
Posts: 23
Joined: 25 Mar 2016, 10:11

Re: Multiple msgboxes at random positions

31 Jan 2018, 19:52

That's kinda over my head but any code examples would be more than appreciated. Anything to annoy and waste the time of tech support scammers is welcome. In short, it's called scambaiting - people call scam tech support numbers and allow them to connect to their VM via a VPN. The good ones have scripts/program like a fake syskey, cmd.exe, notepad.exe, stuff like that.

Kitboga is one of the better ones. https://clips.twitch.tv/EsteemedDelight ... hEleGiggle

https://en.wikipedia.org/wiki/Technical_support_scam
DJQuad
Posts: 23
Joined: 25 Mar 2016, 10:11

Re: Multiple msgboxes at random positions

07 Feb 2018, 17:50

Odlanir wrote:I suspect you can't achieve the result expected. The max number of Msgbox per thread seems to be 7.
I tried changing it to 7 but ^F9 doesn't trigger this

Code: Select all

^F9::
Loop, 7 {
    SetTimer, MsgBox_%A_Index%, % -50*A_Index        
}
return

MsgBox_1:
MsgBox_2:
MsgBox_3:
MsgBox_4:
MsgBox_5:
MsgBox_6:
MsgBox_7:
   number:=SubStr(A_ThisLabel,7)
   SetTimer, MoveMsgBox_%number%, -50
   MsgBox,,Title_%number%, Text_%number%
return

MoveMsgBox_1:
MoveMsgBox_2:
MoveMsgBox_3:
MoveMsgBox_4:
MoveMsgBox_5:
MoveMsgBox_6:
MoveMsgBox_7:
	number:=SubStr(A_ThisLabel,12)
	random, rndx, 1, 1000
	random, rndy, 1, 600
	WinMove, Title_%number%,, % rndx, % rndy
return
Odlanir
Posts: 477
Joined: 20 Oct 2016, 08:20

Re: Multiple msgboxes at random positions

08 Feb 2018, 09:14

Code: Select all

number:=SubStr(A_ThisLabel,8)
____________________________________________________________________________
Windows 10 Pro 64 bit - Autohotkey v1.1.30.01 64-bit Unicode
DJQuad
Posts: 23
Joined: 25 Mar 2016, 10:11

Re: Multiple msgboxes at random positions

08 Feb 2018, 14:21

Still no go :(

Code: Select all

^F9::
Loop, 7 {
    SetTimer, MsgBox_%A_Index%, % -50*A_Index        
}
return

MsgBox_1:
MsgBox_2:
MsgBox_3:
MsgBox_4:
MsgBox_5:
MsgBox_6:
MsgBox_7:
   number:=SubStr(A_ThisLabel,8)
   SetTimer, MoveMsgBox_%number%, -50
   MsgBox,,Title_%number%, Text_%number%
return

MoveMsgBox_1:
MoveMsgBox_2:
MoveMsgBox_3:
MoveMsgBox_4:
MoveMsgBox_5:
MoveMsgBox_6:
MoveMsgBox_7:
	number:=SubStr(A_ThisLabel,12)
	random, rndx, 1, 1000
	random, rndy, 1, 600
	WinMove, Title_%number%,, % rndx, % rndy
return

Return to “Ask For Help”

Who is online

Users browsing this forum: Google [Bot], guguf, Peaceful, terenceck, wcsk8 and 160 guests