Jump to content

Recommended Posts

Posted (edited)

I found the answer:

while 1

ControlSend("Untitled", "", "Edit1", "{a down}")

Sleep(2000)

ControlSend("Untitled", "", "Edit1", "{a up}")

Sleep(1000)

wend

thanks to Tvern for reminding me of ControlSend

Edited by chropose
Posted

ummm try to be a little more clear do you mean hold the mouse down for 2 sec then stop for 1 or click repeatedly for 2 sec then stop or what exactly are you tryin to do =\

Posted (edited)

sorry, i mean to press something on keyboard, let's say i wanna have notepad to press and hold "H" for 2 secs and then stop pressing for 1 sec, continuously in loop.

Edited by chropose
Posted (edited)

sorry, i mean to press something on keyboard, let's say i wanna have notepad to press and hold "H" for 2 secs and then stop pressing for 1 sec, continuously in loop.

while 1

send("{a down}")

sleep(2000)

send("{a up}")

sleep(1000)

wend

replace a with whatever key on the keyboard u want

Edited by norax
Posted

hey, thanks it worked.

btw, how to specify this script to work only on a specific program?

let's say i wanted this script to work only on notepad so when i changed the window focus to browser address bar, the script didnt do anything to interrupt it.

Posted (edited)

hey, thanks it worked.

btw, how to specify this script to work only on a specific program?

let's say i wanted this script to work only on notepad so when i changed the window focus to browser address bar, the script didnt do anything to interrupt it.

Try this:

While 1
    Sleep(200)
    if WinActive("[CLASS:Notepad]") = NOT 0 Then
        Send("{a down}")
        Sleep(2000)
        Send("{a up}")
        Sleep(1000)
    EndIf
WEnd
Edited by UnDeFiNeD
Posted

undefined,

i tried that script, it doesnt work. it only makes the script working if window focus is currently on notepad. if the focus changed, nothing happens at all.

Posted

undefined,

i tried that script, it doesnt work. it only makes the script working if window focus is currently on notepad. if the focus changed, nothing happens at all.

While 1
    Sleep(200)
    if WinActive("your programs window title here") Then
        Send("{a down}")
        Sleep(2000)
        Send("{a up}")
        Sleep(1000)
    EndIf
WEnd
Posted (edited)

While 1
    Sleep(200)
    if WinActive("your programs window title here") Then
        Send("{a down}")
        Sleep(2000)
        Send("{a up}")
        Sleep(1000)
    EndIf
WEnd

norax,

if the current window is on "untitled" (Notepad), the script work and only works if the window is on untitled. if the focus changed nothing happens. still same like undefined's script.

Edited by chropose
Posted

While 1
    Sleep(200)
    if WinActive("your programs window title here") Then
        Send("{a down}")
        Sleep(2000)
        Send("{a up}")
        Sleep(1000)
    EndIf
WEnd

norax,

if the current window is on "untitled" (Notepad), the script work and only works if the window is on untitled. if the focus changed nothing happens. still same like undefined's script.

im not sure what your wanting it to do then. if you want it to only not run on a specific window then do this

While 1
    Sleep(200)
    if WinActive("program title here") Then
        Sleep(250)
    Else
        Send("{a down}")
        Sleep(2000)
        Send("{a up}")
        Sleep(1000)
    EndIf
WEnd

if this is not it then ill need a better explanation of what you want lol

Posted

If you want to a window, even if that window is not the active one, replace Send() with ControlSend(). The helpfile has an example using notepad.

Posted

undefined,

i tried that script, it doesnt work. it only makes the script working if window focus is currently on notepad. if the focus changed, nothing happens at all.

You said "let's say i wanted this script to work only on notepad"

Posted

You said "let's say i wanted this script to work only on notepad"

let's say i wanted this script to work only on notepad so when i changed the window focus to browser address bar, the script didnt do anything to interrupt it.

Posted

i've tried adding "Control" so it becomes ControlSend:

While 1
    Sleep(200)
    if WinActive("[CLASS:Notepad]") = NOT 0 Then
        ControlSend("{a down}")
        Sleep(2000)
        ControlSend("{a up}")
        Sleep(1000)
    EndIf
WEnd

and this:

While 1
    Sleep(200)
    if WinActive("Untitled") Then
        ControlSend("{a down}")
        Sleep(2000)
        ControlSend("{a up}")
        Sleep(1000)
    EndIf
WEnd

and also:

While 1
    Sleep(200)
    if WinActive("Untitled") Then
        Sleep(250)
    Else
        ControlSend("{a down}")
        Sleep(2000)
        ControlSend("{a up}")
        Sleep(1000)
    EndIf
WEnd

all of them doesn't work.

Posted

i've tried adding "Control" so it becomes ControlSend:

...

all of them doesn't work.

They wouldn't because ControlSend() has more parameters than Send().

Like I said the helpfile for ControlSend() has an example specifically for notepad.

All you need to do is replace Send with that example and then change the example text with your own.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...