Jump to content

a little help with autoit script


algloom
 Share

Recommended Posts

Good evening autoit community ;)

Until now I have been using autoit for automating my repeative windows tasks. Having only a little HTML knowledge I will not pretend to be any good at scripting, thus I've been using the script recorders for most of my scripts until now.

My goal is to modify a current autoit script with a small addition. The addition I have on my mind is the following:

every 30-50 seconds it would send certain keystrokes to the program (like press 5 5 5 5 5 5 6 and then shift+click on the center of the screen).

I would like to add that function to the script I'm using. How would I do that? What would I have to write in addition to this script and where should I position it?

; ----------------------------------------------------------------------------
;
; AutoIt Version:         3.2.0
; Author:                 The-Chad <chadscrib@gmail.com>
; Website:                OnlineGameHacker <www.OnlineGameHacker.com>
; Script Function:        Anti Afk
;
; ----------------------------------------------------------------------------


HotKeySet("{F9}", "hide")
HotKeySet("{F10}", "show")
AutoItSetOption("WinTitleMatchMode", 4)
While 1
   Sleep(1000)
WEnd

Func hide()
   Global $Show = 0
   Global $handle = WinGetHandle("classname=GxWindowClassD3d")
   WinSetState($handle, "", @SW_MINIMIZE)
   WinSetState($handle, "", @SW_HIDE)
   If @error Then
      MsgBox(0, "error", "couldnt find WoW")
   Else
      While 1
         $unique = Random(1, 4, 1)
         If $unique = 1 Then
            ControlSend($handle, "", "", "{UP DOWN}")
            Sleep(100 + Random(1, 50, 1))
            ControlSend($handle, "", "", "{UP UP}")
            ControlSend($handle, "", "", "{DOWN DOWN}")
            Sleep(100 + Random(1, 50, 1))
            ControlSend($handle, "", "", "{DOWN UP}")
            Sleep(200000 + Random(5000, 15000, 1))
         ElseIf $unique = 2 Then
            ControlSend($handle, "", "", "{RIGHT DOWN}")
            Sleep(100 + Random(1, 50, 1))
            ControlSend($handle, "", "", "{RIGHT UP}")
            ControlSend($handle, "", "", "{LEFT DOWN}")
            Sleep(100 + Random(1, 50, 1))
            ControlSend($handle, "", "", "{LEFT UP}")
            Sleep(200000 + Random(5000, 15000, 1))
         ElseIf $unique = 3 Then
            ControlSend($handle, "", "", "{DOWN DOWN}")
            Sleep(100 + Random(1, 50, 1))
            ControlSend($handle, "", "", "{DOWN UP}")
            ControlSend($handle, "", "", "{UP DOWN}")
            Sleep(100 + Random(1, 50, 1))
            ControlSend($handle, "", "", "{UP UP}")
            Sleep(200000 + Random(5000, 15000, 1))
         ElseIf $unique = 4 Then
            ControlSend($handle, "", "", "{LEFT DOWN}")
            Sleep(100 + Random(1, 50, 1))
            ControlSend($handle, "", "", "{LEFT UP}")
            ControlSend($handle, "", "", "{RIGHT DOWN}")
            Sleep(100 + Random(1, 50, 1))
            ControlSend($handle, "", "", "{RIGHT UP}")
            Sleep(200000 + Random(5000, 15000, 1))
         EndIf
         If $Show > 0 Then ExitLoop
      WEnd
   EndIf
EndFunc   ;==>hide

Func show()
   Global $Show = 1
   WinSetState("World of Warcraft", "", @SW_SHOW)
   WinSetState("World of Warcraft", "", @SW_MAXIMIZE)
   WinActivate($handle, "")
EndFunc   ;==>show

Thank you :evil:

Link to comment
Share on other sites

With a website for that and numerous mentions of WOW in your script your asking for trouble.

The function your looking for is AdlibEnable. Add it to your script and every x ms it will run a function. For every thirty Seconds:

AdlibEnable ("MyFunc", 30000)
Func MyFunc()
;;;
EndFunc   ;==>MyFunc

That is of course, presuming you are slightly out of date. The latest Stable release of autoit (3.3.*2*.0) Uses "AdlibRegister". The functionality id the same for registering/enabling, but is slightly different for Unregistering/disabling. So watch out for that. If you want more help then don't post about hacking. I probably shouldn't give you any help at all but... It's Christmas! ;)

Mat

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...