Splash Image Problem

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
ResonateBob
Posts: 4
Joined: 15 Jun 2017, 11:15

Splash Image Problem

16 Dec 2017, 10:38

I would like to know how to change an images position every time a messagebox appears, and presses ok. Apparently this isn't working. Any reason why? Thanks.

#SingleInstance Force
image=image.png


Random, rand, 1, 10000

Loop
{
sleep, rand
MsgBox, 48, Test, Test
IfMsgBox, Ok
SplashImage, %image%, B x%rand% y%rand%
}
esc::ExitApp
User avatar
TheDewd
Posts: 1513
Joined: 19 Dec 2013, 11:16
Location: USA

Re: Splash Image Problem

19 Dec 2017, 09:37

The Random command is outside of the Loop, which means that it is only executed once. It must be inside the Loop so that it executes with every iteration and produces new results.

Code: Select all

#SingleInstance, Force

Image := "test.png"

Loop {
    Random, Rand, 1, 10000
    Sleep, % Rand
    MsgBox, 48, Test, Test
    IfMsgBox, OK
    SplashImage, % Image, % "B x" Rand " y" Rand
}

Esc::
    ExitApp
return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: -Elaphe-, downstairs, Google [Bot], sebalotek and 189 guests