As I make this script I always do the same thing every 4 min
Thanks in advance
Code: Select all
^t::
FileCopyDir,C:\Users\Fernando\Documents\My Games,%A_Desktop%\Terraria %A_YYYY%%A_MM%%A_DD% %A_Hour%%A_Min%
return
Code: Select all
^t::
FileCopyDir,C:\Users\Fernando\Documents\My Games,%A_Desktop%\Terraria %A_YYYY%%A_MM%%A_DD% %A_Hour%%A_Min%
return
Code: Select all
Loop
{
FileCopyDir,C:\Users\Fernando\Documents\My Games,%A_Desktop%\Terraria %A_YYYY%%A_MM%%A_DD% %A_Hour%%A_Min%
Sleep,240000
}
Code: Select all
SetTimer, fc, 240000
; Other code can go here
return
fc:
FileCopyDir,C:\Users\Fernando\Documents\My Games,%A_Desktop%\Terraria %A_YYYY%%A_MM%%A_DD% %A_Hour%%A_Min%
return
Code: Select all
Loop {
; do something endlessly
sleep 100
}
F12::
soundbeep
return
Code: Select all
; [normal flow of code]
SetTimer, SomethingThatCouldTakeAgesAndYouDontWantToWaitFor, -0 ; - means only do once, 0 means immediately
; Code instantly resumes here, while the "thread" goes off and does its stuff.
; [normal flow of code]
Code: Select all
#Persistent
#SingleInstance force
mc := new MyClass()
class MyClass {
__New(){
Loop 100 {
fn := this.DoSleep.Bind(this, A_Index)
SetTimer, % fn, 40
}
}
DoSleep(timernumber){
tooltip % timernumber
Sleep 20
}
}
Code: Select all
#Persistent
#SingleInstance force
mc := new MyClass()
class MyClass {
__New(){
this.LastFire := []
Loop 100 {
this.LastFire[A_Index] := 0
fn := this.DoSleep.Bind(this, A_Index)
SetTimer, % fn, 40
}
}
DoSleep(timernumber){
tooltip % "Timer " timernumber " last fired " (A_TickCount - this.LastFire[timernumber]) / 1000 " seconds ago"
this.LastFire[timernumber] := A_TickCount
Sleep 20
}
}
Code: Select all
#Persistent
SetTimer, Check, 240000
Check:
SetTimer, Check, on
FileCopyDir,C:\Users\Fernando\Documents\My Games,%A_Desktop%\Terraria %A_YYYY%%A_MM%%A_DD% %A_Hour%%A_Min%
return
Code: Select all
if not A_IsAdmin
{
Run *RunAs "%A_ScriptFullPath%"
ExitApp
}
F8::
toggle := !toggle
if toggle
{
SetTimer, run_every_4_min, 240000
gosub, run_every_4_min
MsgBox, The script is running.
}
else
{
SetTimer, run_every_4_min, Off
MsgBox, The script is Stoped.
}
return
run_every_4_min:
FileCopyDir,C:\Users\Fernando\Documents\My Games,%A_Desktop%\Terraria %A_YYYY%%A_MM%%A_DD% %A_Hour%%A_Min%
;use "A_MyDocuments" The full path and name of the current user's "My Documents" folder.
return