Code: Select all
loop{
SetTimer, Time, -2000
sleep, 10000
}
return
Time:
if (Time = 0){
msgbox, hello
}
else{
msgbox, done
}
return
}
I can't use the if statement the only thing that pop up is the done msg not the hello
Code: Select all
loop{
SetTimer, Time, -2000
sleep, 10000
}
return
Time:
if (Time = 0){
msgbox, hello
}
else{
msgbox, done
}
return
}
sorry i'm new at this I don't know how to make it work
Code: Select all
; top of the script
time := 0 ; this initializes the variable time with 0 (zero)
loop{
SetTimer, Time, -2000
sleep, 10000
}
return
Time: ; <<<<< this is the label called Time, it's not the variable
if (Time = 0) { ; <<<<< this is the variable called time
msgbox, hello
}
else {
msgbox, done
}
return
}
Code: Select all
#persistent
time:=0
settimer,Label1,5000
gosub,Label1
return
;------------------
esc::
tooltip,QUIT this script %a_scriptname%
sleep,3000
tooltip
exitapp
;-----------------
Label1:
if (time=0)
msgbox, 262208, ZERO,Hello ,1 ;- show this the first-time , then see msgbox DONE each 5 second
else
msgbox, 262208, DONE,Show this=`nEach 5 second ,1
time:=1
return
;=================================
garry wrote: ↑28 Oct 2021, 06:40also an exampleCode: Select all
#persistent time:=0 settimer,Label1,5000 gosub,Label1 return ;------------------ esc:: tooltip,QUIT this script %a_scriptname% sleep,3000 tooltip exitapp ;----------------- Label1: if (time=0) msgbox, 262208, ZERO,Hello ,1 ;- show this the first-time , then see msgbox DONE each 5 second else msgbox, 262208, DONE,Show this=`nEach 5 second ,1 time:=1 return ;=================================
Code: Select all
#Persistent
SetTimer, Message, 2000
Message:
If firstMessage := !firstMessage
MsgBox, 262208, DONE, Show this=`nEach 5 second, 1
Else MsgBox, 262208, ZERO, Hello, 1
Return
This code sends Hello every 2nd time (4-seconds interval) too as sends Done. Is that what you wanted?mikeyww wrote: ↑28 Oct 2021, 07:44Code: Select all
#Persistent SetTimer, Message, 2000 Message: If firstMessage := !firstMessage MsgBox, 262208, DONE, Show this=`nEach 5 second, 1 Else MsgBox, 262208, ZERO, Hello, 1 Return
Users browsing this forum: digidings, Ineedhelplz, mikeyww and 201 guests