Switching from tooltips to Gui

Get help with using AutoHotkey and its commands and hotkeys
DarkKitten
Posts: 31
Joined: 10 Mar 2016, 00:20

Switching from tooltips to Gui

Post by DarkKitten » 17 Dec 2017, 15:07

Hello! So I've made a simple GUI Script that I've been using for a while but I started out with tooltips at a fixed position since I'm not sure how to add in counting timers in the gui. Could someone help me out with that? I actually have two requests if anyone can point me in the right direction or give a good example using my script here.

Would love to replace my wonky tooltips that don't move around if I happen to move the GUI, and replace them with actual text within the GUI it's self, and my other request would be to convert seconds into hh:mm:ss (Example: Instead of it saying I have 125 seconds left, it would say something like 00:02:05)

Code: Select all

#SingleInstance Force
Coordmode, Mouse, Screen
Coordmode, Tooltip, Screen
DetectHiddenWindows, On


OffOnWindow = x1935 y75

CustomColor = EEAA99  
Gui 2:+LastFound +AlwaysOnTop -Caption +ToolWindow 
Gui, 2:Color, Green
Gui, 2:Font, s11
Gui, 2:Add, Text,, Test1

WinSet, TransColor, %CustomColor% 180 
Gui, 2:Show, h100 %OffOnWindow% NoActivate, Test1 



;--------------------------------------------------
AngelXY				=	x5 y10
FeedXY			=	x80 y10
GreenXY			=	x80 y+5
RedXY					=	x80 y+5
Black1XY				=	x80 y+5
Purple1XY			=	x350 y10
Purple2XY			=	x350 y+5
Blue1XY			=	x350 y+5
;--------------------------------------------------
FeedTimerX			:=	2160
FeedTimerY			:=	40

GreenTimerX			:=	2160
GreenTimerY			:=	72

RedTimerX					:= 	2160
RedTimerY					:= 	110

Black1TimerX				:= 	2160
Black1TimerY				:= 	140

Black1m1TimerX				:=	2160
Black1m1TimerY				:=	140

Purple1TimerX			:=	2430
Purple1TimerY			:=	40

Purple2TimerX			:=	2430
Purple2TimerY			:=	72

Blue1TimerX			:=	2430
Blue1TimerY			:=	110
;--------------------------------------------------

;--------------------------------------------------

;--------------------------------------------------



OffOnWindow = x1935 y75


Gui, 1:Show, x1925 y5 w700 h250, Twelve
Gui, 1:Font, s9, Comic Sans MS
Gui, 1:Color, 888888




Gui, 1:Add, Button, w70 %AngelXY% Default, Angel
Gui, 1:Add, Button, w150 %FeedXY% Default, Feed Nines Alt+1
Gui, 1:Add, Button, w150 %GreenXY% Default, Salad Alt+2
Gui, 1:Add, Button, w150 %RedXY% Default, Red Alt+3
Gui, 1:Add, Button, w150 %Black1XY% Default, Black 1 Alt+4
Gui, 1:Add, Button, w150 %Purple1XY% Default, Banana Ctrl+1
Gui, 1:Add, Button, w150 %Purple2XY% Default, Banana Ctrl+2
Gui, 1:Add, Button, w150 %Blue1XY% Default, Taco Ctrl+3
Return




!Numpad1::
Sleep 500
Send {Esc}
Sleep 300
Mousemove, 708, 550, 2
Click Down
Sleep 200
Click Up
Sleep 200
Mousemove, 1494, 659, 2
Click Down
Sleep 200
Click Up
Sleep 200
Mousemove, 1276, 342, 2
Click Down
Sleep 200
Click Up
Sleep 2000
Mousemove, 1581, 658, 2
Click Down
Sleep 200
Click Up
Sleep 100
Send {Esc}

Settimer, FeedCD, 1000
FeedVar := 2700

FeedCD: 
{
FeedVar--
Tooltip, Nine: %FeedVar%, %FeedTimerX%, %FeedTimerY%, 1
}

if FeedVar = 0
{
    settimer, FeedCD, off
    tooltip, , , , 1
	SoundBeep, 400, 300
}

Return


!Numpad2::

Settimer, GreenCD, 1000

GreenVar := 900

GreenCD: 
{
GreenVar--
Tooltip, Channel: %GreenVar%, %GreenTimerX%, %GreenTimerY%, 2
}

if GreenVar = 0
{
    settimer, GreenCD, off
    tooltip, , , , 2
	SoundBeep, 400, 100
	SoundBeep, 300, 100
	SoundBeep, 200, 100
}
Return

ButtonGreenAlt+2:
settimer, GreenCD, off
Tooltip, , , , 2
Return


!Numpad3::


Settimer, MouseCD, 1000

MouseVar := 11700

MouseCD: 
{
MouseVar--
Tooltip, Mouse: %MouseVar%, %RedTimerX%, %RedTimerY%, 3

}

if MouseVar = 0
{
    settimer, MouseCD, off
    tooltip, , , , 3
	SoundBeep, 400, 300
}

Return


!Numpad4::

Sleep 500
Send b
Sleep 200
MouseMove, 1868, 683, 2
Sleep 200
Loop 3 {
Click Down Right
Sleep 200
Click Up Right
}
Send b

Settimer, BlackTimer1, 1000
Settimer, BlackWait1mTimer1, 1000

BlackVar1 := 885
BlackWait1mVar1 := 58

BlackTimer1:
{
BlackVar1--
Tooltip, Black: %BlackVar1%`nCooldown: %BlackWait1mVar%, %Black1TimerX%, %Black1TimerY%, 4
}

if BlackVar1 = 0
{
    settimer, BlackTimer1, off
    tooltip, , , , 4
	SoundBeep, 200, 100
	SoundBeep, 300, 100
	SoundBeep, 400, 100
}
Return


BlackWait1mTimer1:
{
BlackWait1mVar1--

Tooltip, Black: %BlackVar1%`nCooldown: %BlackWait1mVar1%, %Black1m1TimerX%, %Black1m1TimerY%, 4
}

if BlackWait1mVar1 = 0
{
    settimer, BlackWait1mTimer1, off

    tooltip, , , , 4
	SoundBeep, 200, 100
	SoundBeep, 300, 100
}

Return






^Numpad1::

Sleep 500
Click Middle
Send {=}
Sleep 200
Mousemove, 829, 312, 8
Loop 1 {
Click Down
Sleep 500
Click Up
}

Settimer, YettiTimer1, 1000

YettiVar1 := 1200

YettiTimer1: 
{
YettiVar1--
Tooltip, Storage: %YettiVar1%, %Purple1TimerX%, %Purple1TimerY%, 5
}

if YettiVar1 = 0
{
    settimer, YettiTimer1, off
    Tooltip, , , , 5
	SoundBeep, 400, 100
	SoundBeep, 300, 100
	SoundBeep, 200, 100
}
Return

ButtonPurpleCtrl+1:
settimer, YettiTimer1, off
Tooltip, , , , 5
Return


^Numpad2::

Sleep 500
Click Middle
Send {=}
Sleep 200
Mousemove, 829, 312, 8
Loop 1 {
Click Down
Sleep 500
Click Up
}

Settimer, YettiTimer2, 1000

YettiVar2 := 1200

YettiTimer2: 
{
YettiVar2--
Tooltip, Storage: %YettiVar2%, %Purple2TimerX%, %Purple2TimerY%, 6
}

if YettiVar2 = 0
{
    settimer, YettiTimer2, off
    Tooltip, , , , 6
	SoundBeep, 400, 100
	SoundBeep, 300, 100
	SoundBeep, 200, 100
}
Return

ButtonPurpleCtrl+2:
settimer, YettiTimer2, off
Tooltip, , , , 6
Return


^Numpad3::

Sleep 500
Click Middle
Send {=}
Sleep 200
Mousemove, 910, 312, 8
Loop 1 {
Click Down
Sleep 500
Click Up
}

Settimer, YettiTimer3, 1000

YettiVar3 := 1200

YettiTimer3: 
{
YettiVar3--
Tooltip, Market: %YettiVar3%, %Blue1TimerX%, %Blue1TimerY%, 7
}

if YettiVar3 = 0
{
    settimer, YettiTimer3, off
    Tooltip, , , , 7
	SoundBeep, 400, 100
	SoundBeep, 300, 100
	SoundBeep, 200, 100
}
Return

ButtonBlueCtrl+3:
settimer, YettiTimer3, off
Tooltip, , , , 7
Return
































;----------------------------------------------------------------------------------------------------------------
; Pause
~Numlock::
Suspend Permit
Suspend
Return
;----------------------------------------------------------------------------------------------------------------


~Enter::

Suspend

if (A_IsSuspended)
{
Gui, 2:Destroy
CustomColor = EEAA99  
Gui 2:+LastFound +AlwaysOnTop -Caption +ToolWindow 
Gui, 2:Color, red
Gui, 2:Font, s11
Gui, 2:Add, Text,, Off

WinSet, TransColor, %CustomColor% 180 
Gui, 2:Show, x1935 y75 NoActivate, Test1
}

Else
{
Gui, 2:Destroy
CustomColor = EEAA99  
Gui 2:+LastFound +AlwaysOnTop -Caption +ToolWindow 
Gui, 2:Color, Green
Gui, 2:Font, s11
Gui, 2:Add, Text,, Test1

WinSet, TransColor, %CustomColor% 180 
Gui, 2:Show, %OffOnWindow% NoActivate, Test1
}
Return










































; Exit

!^F10::ExitApp


GuiClose:
ExitApp





Hellbent
Posts: 143
Joined: 23 Sep 2017, 13:34

Re: Switching from tooltips to Gui

Post by Hellbent » 17 Dec 2017, 19:20

Try adding a edit box to your gui and assign it a variable.

Next replace the tooltips by updating the edit control with the info you want to display using GuiControl.

Here is a overly simplified example of adding the edit and updating it.

;add this to your gui
Gui,Add,Edit,vSome_Var_Name

;change your tooltips with this.
GuiControl,,Some_Var_Name,% Value
DarkKitten
Posts: 31
Joined: 10 Mar 2016, 00:20

Re: Switching from tooltips to Gui

Post by DarkKitten » 18 Dec 2017, 01:53

Thanks, I figured out how to do the GuiControl and some Gui,Text .. How about changing the numbers to hh:mm:ss though? I see a few posts on google but it seems confusing to me, a nice example would be great if anyone could help with that part.
Hellbent
Posts: 143
Joined: 23 Sep 2017, 13:34

Re: Switching from tooltips to Gui

Post by Hellbent » 18 Dec 2017, 21:18

Code: Select all

total_time:=120
mins_var:=total_time//60
seconds_var:=(total_time-(mins_Var*60))
if(mins_var=0)
   mins_Var:="00"
else if(mins_var<10)
    mins_var:="0" mins_var
 
 if(seconds_var=0)
     seconds_var:="00"
 else if(seconds_var<10)
      seconds_var:="0" seconds_var
  
  msgbox,% mins_var ":" seconds_var           


Post Reply

Return to “Ask For Help”