Problem with guy and timer

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Vortecss
Posts: 2
Joined: 05 Jun 2023, 20:13

Problem with guy and timer

Post by Vortecss » 05 Jun 2023, 20:18

Hello guys i'm having problem with this script;
The problem is when the script go to the loop block the "The second Timer in the guy don't use the random function"
Can anyone please help me :D

Code: Select all

$string = FEED_INTEGRITY_CLICKBAIT_POST_LABELING ; Nome coda di emerald visualizzata durante le task
WaitTime := 58
Gui, 99:+AlwaysOnTop
Gui, 99:font,s9 bold,Verdana
Gui, 99:-Caption -Border -sysmenu
Gui, 99:add, text, x0 y0 w17 h12 Center vTX , %WaitTime%
Gui, 99:Show, x152 y689
        loop % WaitTime-1 {
        GuiControl,99:,TX,% Frmt1(--WaitTime)
        sleep, 1000
        }
    Gui, 99:Destroy
    Frmt1(secs) {
    time = 20000101
    time += %secs%, seconds
    FormatTime, ss, %time%, ss
    return ss
    Sleep, 50
    }
Loop
{
 
    WinActivate,  Google Chrome ahk_class Chrome_WidgetWin_1
    Sleep, 50	
    Image := OCR([321, 151, 337, 41], "eng")
    if Image not contains %$string%
    {  
        SoundPlay, %A_ScriptDir%/error.mp3
	Click, 68 124 ; Clicca Logo SRT per uscire
	Random randommin, 1200, 2400 ; Secondi random per rientrare nella coda di Emerald
    	Gui, 99:+AlwaysOnTop
    	Gui, 99:font,s9 bold,Verdana
    	Gui, 99:-Caption -Border -sysmenu
    	Gui, 99:add, text, x0 y0 w35 h12 Center vTX , %randommin%
    	Gui, 99:Show, x152 y689
            loop % randommin-1 {
            GuiControl,99:,TX,% Frmt2(--randommin)
            sleep, 1000
            }
	    Gui, 99:Destroy
	    Frmt3(secs) {
	    time = 20000101
	    time += %secs%, seconds
	    FormatTime, mmss, %time%, mm:ss
	    return ss
	    }
	    Click, 68 124 ; Clicca Logo SRT per entrare in cod
			
	}
    initSecs := 58 ;
    Sleep, 150
    Sleep, 150
    WinActivate,  Google Chrome ahk_class Chrome_WidgetWin_1
    Sleep, 333
    Sleep, 250
    Send, {Numpad2}
    Sleep, 150
    Send, {NumpadEnter}
    Sleep, 150
    Send, {Numpad2}
    Sleep, 150
    Send, {NumpadEnter}
    Sleep, 150
    Send, {NumpadEnter}
    SoundPlay, C:\Users\Alessio\Downloads\ding.mp3
    ; creo la gui
    Gui, 99:+AlwaysOnTop
    Gui, 99:font,s9 bold,Verdana
    Gui, 99:-Caption -Border -sysmenu
    Gui, 99:add, text, x0 y0 w17 h12 Center vTX , %initSecs%
    Gui, 99:Show, x152 y689
        loop % initSecs-1 {
        GuiControl,99:,TX,% Frmt(--initSecs)
        sleep, 1000
        }
    Gui, 99:Destroy
    Frmt(secs) {
    time = 20000101
    time += %secs%, seconds
    FormatTime, ss, %time%, ss
    return ss
    }

}

[Mod edit: Added [code][/code] tags. Please use them yourself when posting code.]

[Mod action: Moved topic to v1 section since this is v1 code. The main section is for v2.]

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

Re: Problem with guy and timer

Post by boiler » 05 Jun 2023, 20:41

@Vortecss — I’m curious as to whether you saw a popup window when you were about to post this message letting you that you are about to post in the v2 section and asking if your question is for AutoHotkey v2? If you saw it, did you understand what it was saying and asking?

Vortecss
Posts: 2
Joined: 05 Jun 2023, 20:13

Re: Problem with guy and timer

Post by Vortecss » 05 Jun 2023, 21:13

Oh sorry man, i think that this was about the v2 version :(

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

Re: Problem with guy and timer

Post by boiler » 05 Jun 2023, 21:19

It's OK. We're trying to figure out how to most effectively steer people towards the right section when they're new to the forum. If you have any suggestions on how to ask the question in a way that you would understand how to give the correct answer, please pass them along. Thanks.

Post Reply

Return to “Ask for Help (v1)”