RunMyFunction() {
global IsRunning
IsRunning := true
Loop {
if (IsRunning) {
Loop, 6 {
SendEvent, {Ctrl down} ; Press the Ctrl key
Sleep, 500 ; Wait for 0.5 seconds
SendEvent, {Ctrl up} ; Release the Ctrl key
Sleep, 500 ; Wait for 0.5 seconds
}
Random, AltOrLeft, 1, 2 ; Randomly choose 1 or 2
if (AltOrLeft = 1) {
SendEvent, {Alt down} ; Press the Alt key
Sleep, 2000 ; Wait for 2 seconds
SendEvent, {Alt up} ; Release the Alt key
} else {
SendEvent, {Left down} ; Press the left arrow key
Sleep, 2000 ; Wait for 2 seconds
SendEvent, {Left up} ; Release the left arrow key
}
; Press the right arrow key twice
SendEvent, {Right down} ; Press the right arrow key
Sleep, 10 ; Wait for 0.01 seconds
SendEvent, {Right up} ; Release the right arrow key
Sleep, 7990 ; Wait for 7.99 seconds
} else {
break ; Exit the loop
}
}
return
}
PauseMyFunction() {
global IsRunning
IsRunning := !IsRunning ; Toggle the running state
return
}
이런거임... 뭐가 문젤까
댓글2
오핫 코드를 제대로 짜보셈
그냥 챗 지피티한테 물어봐서 한건데..
#Persistent
F5::RunMyFunction()
F6::PauseMyFunction()
RunMyFunction() {
global IsRunning
IsRunning := true
Loop {
if (IsRunning) {
Loop, 6 {
SendEvent, {Ctrl down} ; Press the Ctrl key
Sleep, 500 ; Wait for 0.5 seconds
SendEvent, {Ctrl up} ; Release the Ctrl key
Sleep, 500 ; Wait for 0.5 seconds
}
Random, AltOrLeft, 1, 2 ; Randomly choose 1 or 2
if (AltOrLeft = 1) {
SendEvent, {Alt down} ; Press the Alt key
Sleep, 2000 ; Wait for 2 seconds
SendEvent, {Alt up} ; Release the Alt key
} else {
SendEvent, {Left down} ; Press the left arrow key
Sleep, 2000 ; Wait for 2 seconds
SendEvent, {Left up} ; Release the left arrow key
}
; Press the right arrow key twice
SendEvent, {Right down} ; Press the right arrow key
Sleep, 10 ; Wait for 0.01 seconds
SendEvent, {Right up} ; Release the right arrow key
Sleep, 7990 ; Wait for 7.99 seconds
} else {
break ; Exit the loop
}
}
return
}
PauseMyFunction() {
global IsRunning
IsRunning := !IsRunning ; Toggle the running state
return
}
이런거임... 뭐가 문젤까