Code: Select all
a := 12
SetTimer, z(a), -0
z(a)
{
MsgBox, % a
}
Code: Select all
a := 12
SetTimer, z(a), -0
z(a)
{
MsgBox, % a
}
Code: Select all
a := 12
SetTimer, z, -0
Return
z:
SetTimer, z, off
result := z(a)
Return
z(a)
{
MsgBox, % a
}
Code: Select all
#Persistent
a := 12
fn := Func("z").Bind(a)
SetTimer, %fn%, -0
z(a)
{
MsgBox, % a
}
Code: Select all
#Persistent
a := 12
fn := ObjBindMethod(myClass, "z", a, "bbb")
SetTimer, %fn%, -0
class myClass {
z(a, b) {
MsgBox, % a "`n" b
}
}
At that time I need to directly call function in SetTimer without label so tmplinshi's examples at that situation are very useful. I need to use SetTimer inside another function.Guest10 wrote:what are the advantages of tmplinshi's over ameyrick's. tmplinshi's looks overly complicated!
Code: Select all
#Persistent
#SingleInstance Force
#NoEnv
a := 12
fn := Func("z").Bind(a)
SetTimer, %fn%, -0
z(a)
{
MsgBox, % a
}
Requires AutoHotkey v1.1.20+.Guest10 wrote:when i run this, it says:
Error: Target label does not exist.
---> SetTimer, %fn%, -0
The current thread will exit.
Code: Select all
#Persistent #SingleInstance Force #NoEnv a := 12 fn := Func("z").Bind(a) SetTimer, %fn%, -0 z(a) { MsgBox, % a }
only login for saying thank you!tmplinshi wrote: ↑04 May 2015, 15:11Code: Select all
#Persistent a := 12 fn := Func("z").Bind(a) SetTimer, %fn%, -0 z(a) { MsgBox, % a }
Code: Select all
#Persistent a := 12 fn := ObjBindMethod(myClass, "z", a, "bbb") SetTimer, %fn%, -0 class myClass { z(a, b) { MsgBox, % a "`n" b } }
Users browsing this forum: No registered users and 132 guests