Jump to content
Sign in to follow this  
Guest elementskater255

Random KeyStrokes

Recommended Posts

Guest elementskater255

Hi, is it possible to write a script that just continusly hits random keystrokes? Like all of the letters.

And then end it by pressing Home.

How would I do this. I just downloaded autoit3 yesterday, so I really have no clue what I am doing.

Share this post


Link to post
Share on other sites

HotKeySet( {Home}, Exit(0) ) ;Home?

run("notepad.exe")

While 1 = 1

$val = Random(32,126)

$myChar = Chr(Round( $val ) )

Send($myChar)

WEnd

if this is not correct it is close

Edited by blakel

Share this post


Link to post
Share on other sites

Hi, is it possible to write a script that just continusly hits random keystrokes? Like all of the letters.

And then end it by pressing Home.

How would I do this. I just downloaded autoit3 yesterday, so I really have no clue what I am doing.

<{POST_SNAPBACK}>

Yes, it is very possible. Below is a script that will demonstrate the basics. There are many other short examples in the help file for each of the AutoIt functions. In the latest beta's, the help file includes several tutorials. If you did not download the "beta" version, you should do so and use it instead of version 3.0.102. The latest version is 3.0.103.156 (at least it was a couple of hours ago).

;; Type random letters (A through Z) in Notepad.
;; Note: Stop the script (press HOME) before clicking any
;; window other that the Notepad window opened
;; by this script.
HotKeySet("{HOME}", "_Exit")

Opt("WinWaitDelay", 25)
Opt("SendKeyDelay", 0)
If WinExists("Untitled - Notepad") = 0 Then
    Run("Notepad")
EndIf
WinActivate("Untitled - Notepad")
WinWaitActive("Untitled - Notepad")
Send("{ENTER}")
Send("Press HOME to stop...", 1)
Send("{ENTER}{ENTER}")
$iCnt = 0
While 1
    $iCnt = $iCnt + 1
    $i = Random(65, 90, 1)
    WinActivate("Untitled - Notepad")
    Send(chr($i), 1)
    If Mod($iCnt, 26) = 0 Then Send("{ENTER}")
    sleep(100)
WEnd
exit

Func _Exit()
  exit
EndFunc

Phillip

Share this post


Link to post
Share on other sites

HotKeySet("{ESC}", "leave" )

run("notepad.exe")

Sleep(2000)

$i=1

While 1 = 1

$i = $i + 1

if Mod($i,100) > 50 Then

if Random(0,100) > 95 OR Mod($i,100) > 98 Then

Send(Chr(10),1 )

$i = 1

EndIF

EndIF

Send(Chr(Round(Random(33,125))),1)

WEnd

Func leave()

Exit(0)

EndFunc

Edited by blakel

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...