Most efficient method for updating tool tip

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
rubeusmalfoy
Posts: 27
Joined: 20 Sep 2023, 06:40

Most efficient method for updating tool tip

15 May 2024, 11:11

I'm trying to figure out what is the best method for updating a tool tip. My loop runs fine but its difficult to know what's going on, so I'm trying to add a tooltip that will display what function is being called. However when called in each function at the end of the actions, it just shows "Function Name" rather than the actual function e.g. "Box". Below is my attempt.

Code: Select all

F1:: ; f1 launches script
	Loop{ ; main loop
		Isactive() ; checks
		complete()
		;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
		if (isactive == 0 && iscomplete == 0){ ; if not active and not complete
			clickactive()
		}
		if(iscomplete == 1){ ; if process complete
			Gobox() 
			box() 
			reset() 
		}
	}
Return

UpdateToolTip(Function Name) {
    ToolTip % Function Name
    return
}

Box(){
	Loop{
		PixelSearch, Px, Py, 614, 350, 664, 388, 0x00FFFF, , Fast 
		if(ErrorLevel == 0){
			Random, rand1, 2000, 3500
			Sleep rand1 ; Wait
			Click, %Px% %Py%
			Break
			UpdateToolTip(Box)
		}
	}
}

User avatar
CoffeeChaton
Posts: 35
Joined: 11 May 2024, 10:50

Re: Most efficient method for updating tool tip

15 May 2024, 11:35

Code: Select all


F1:: f1_script()  ; f1 launches script

f1_script() {
    Loop { ; main loop
        isactiveVal := Isactive() ;#1 
        iscomplete := complete() ; #2
        
        if (isactiveVal == 0 && iscomplete == 0) { ; if not active and not complete
            ;#1-1
            clickactive()
        }
        if (iscomplete == 1) { ; if process complete
            Gobox()
            box()
            reset()
        }
    }
}


UpdateToolTip(Function_Name) {
    ;                 ^ #2 param not allow space
    ToolTip, % Function_Name
    return
}

Box() {
    Loop{
        PixelSearch, Px, Py, 614, 350, 664, 388, 0x00FFFF, , Fast
        if (ErrorLevel == 0) {
            Random, rand1, 2000, 3500
            Sleep, rand1 ; Wait
            Click, %Px% %Py%
            Break
            ; #3 will never reach this line
            UpdateToolTip(A_ThisFunc) ; #4 A_ThisFunc
        }
    }
}


I started writing some parts, but after #3 Break what do you want to do ?
Ahk v1 and v1.1, functions and variables are in different namespaces.
rubeusmalfoy
Posts: 27
Joined: 20 Sep 2023, 06:40

Re: Most efficient method for updating tool tip

18 May 2024, 10:27

ah thank you. I meant for the updatetooltip call to come before the break. After the break it will return to the main loop

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: hammer32, mikeyww and 73 guests