Could anyone help me with how to turn this code into function?
Grateful
Code: Select all
F9::
tempo := 5
Gui, janela: +AlwaysOnTop -SysMenu
Gui, janela:Font, s20 bold, Arial
Gui, janela:Add, Text, Center w90 h30 vTX, % FormatarTempo(tempo)
Gui, janela:Show, x0 y0 NoActivate, Timer
loop % tempo-1
{
GuiControl, janela:, TX, % FormatarTempo(tempo--)
Sleep, 1000
}
Gui, janela:Destroy
return
F10::
ExitApp
FormatarTempo(segundos)
{
tempoFormat = 20000101
tempoFormat += %segundos%, Seconds
FormatTime, mmss, %tempoFormat%, mm:ss
return mmss
}
Code: Select all
F9::
Visor(5)
F10::
ExitApp
FormatarTempo(segundos)
{
tempoFormat = 20000101
tempoFormat += %segundos%, Seconds
FormatTime, mmss, %tempoFormat%, mm:ss
return mmss
}
Visor(tempo)
{
Gui, janela: +AlwaysOnTop -SysMenu
Gui, janela:Font, s20 bold, Arial
Gui, janela:Add, Text, Center w90 h30, % FormatarTempo(tempo)
Gui, janela:Show, x0 y0 NoActivate, Timer
loop % tempo - 1
{
GuiControl, Text, janela, % FormatarTempo(tempo--)
Sleep, 1000
}
Gui, janela:Destroy
return
}