Jump to content
Sign in to follow this  
redivider

Sending a key $var1 times

Recommended Posts

Hello I have a question: I want to send a specific hotkey (say A) as many times as $var1 value is; so if $var1 = 10 it would send A 10 times. How would I go about this? Thanks in advance!

Share this post


Link to post
Share on other sites

Global $iPressTimes = 10
$iPid = Run ("Notepad")
WinWaitActive("[Class:Notepad]")

HotKeySet("{HOME}","SendAKey")

Func SendAKey()
    For $i = 1 To $iPressTimes
        Send("A")
    Next
EndFunc

While ProcessExists($iPid)
WEnd

Example, above


IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

No need for a loop

Global $iPressTimes = 10
$iPid = Run("Notepad")
WinWaitActive("[Class:Notepad]")

HotKeySet("{HOME}", "SendAKey")

Func SendAKey()
    Send("{A " & $iPressTimes & "}")
EndFunc   ;==>SendAKey

While ProcessExists($iPid)
WEnd

UDF: _SingleScript()                                        If you like my post, just click the like button :)        here -->

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×
×
  • Create New...