Jump to content

Recommended Posts

Posted

I'm doing a lite project and i need some help this is my code

Sleep(1000) ; Wait 1 seconds before script starts

While 1 ; Start Loop

Send("1")

Sleep(400)

Send("2")

Sleep(1000)

WEnd

and between

Send("1")

Sleep(400)

and

Send("2")

Sleep(1000)

WEnd

i want the Send 1 to repeat it self X times and then it gos to the SEND 2 and then lops the script

I hop you will understand :D

Posted

Mayby this could help you.

HotKeySet("{ESC}", "_Exit") ; If you press ESCAPE the func. '_Exit' will be called

$TimesToRepeat = 10 ; Times to Repeat Send("1")

Run("notepad.exe") ; Run Notepad

If Not WinActive("[CLASS:Notepad]") Then WinActivate("[CLASS:Notepad]") ; Makes notepad active if it isn't already
WinWaitActive("[CLASS:Notepad]") ; Waits for notepad to be active

Sleep(1000) ; Sleeps 1 seconds

While 1 ; Start loop
    For $i = 1 To $TimesToRepeat ; Start for loop
        Send("1") ; Sends 1
        Sleep(400) ; Sleeps .4 seconds
    Next ; Stops for loop
    Send("2") ; Sends 2
    Sleep(1000) ; Sleeps 1 second
WEnd ; Stop loop

Func _Exit() ; Starts func. '_Exit'
    Exit ; Exists
EndFunc ; Stops func. '_Exit'

AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Posted

Mayby this could help you.

HotKeySet("{ESC}", "_Exit") ; If you press ESCAPE the func. '_Exit' will be called

$TimesToRepeat = 10 ; Times to Repeat Send("1")

Run("notepad.exe") ; Run Notepad

If Not WinActive("[CLASS:Notepad]") Then WinActivate("[CLASS:Notepad]") ; Makes notepad active if it isn't already
WinWaitActive("[CLASS:Notepad]") ; Waits for notepad to be active

Sleep(1000) ; Sleeps 1 seconds

While 1 ; Start loop
    For $i = 1 To $TimesToRepeat ; Start for loop
        Send("1") ; Sends 1
        Sleep(400) ; Sleeps .4 seconds
    Next ; Stops for loop
    Send("2") ; Sends 2
    Sleep(1000) ; Sleeps 1 second
WEnd ; Stop loop

Func _Exit() ; Starts func. '_Exit'
    Exit ; Exists
EndFunc ; Stops func. '_Exit'

AlmarM

don't understand the code u made I'm NEW whit auto it so you know, any easy code then this one ?

Posted

Hi. Really not sure what you mean. Scripts can only run in a consecutive order. Do one thing, thand do another. Does this help you.

For $i = 1 to 10 ; this loops 10 times

Send("1")

Sleep(400)

Send("2")

Sleep(1000)

next

Send("2")

Sleep(1000)

Posted

Hi. Really not sure what you mean. Scripts can only run in a consecutive order. Do one thing, thand do another. Does this help you.

For $i = 1 to 10 ; this loops 10 times

Send("1")

Sleep(400)

Send("2")

Sleep(1000)

next

Send("2")

Sleep(1000)

nono u dont understand me.

Afther the script didi SEND 1 its going to loop X time and then go to SEND 2

Posted

Did you even try my script?

It sends the "1" 10 times, then sends the "2", then sends the "1" 10 times again, etc.

AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Posted (edited)

Did you even try my script?

It sends the "1" 10 times, then sends the "2", then sends the "1" 10 times again, etc.

AlmarM

i tryd it but on the program the script is made fore doesn't sent anything

HotKeySet("{ESC}", "_Exit"); If you press ESCAPE the func. '_Exit' will be called

$TimesToRepeat = 10; Times to Repeat Send("1")

Sleep(1000); Sleeps 1 seconds

While 1; Start loop
    For $i = 1 To $TimesToRepeat; Start for loop
        Send("1"); Sends 1
        Sleep(4000); Sleeps 4 seconds
    Next; Stops for loop
    Send("2"); Sends 2
    Sleep(1000); Sleeps 1 second
WEnd; Stop loop

Func _Exit(); Starts func. '_Exit'
    Exit; Exists
EndFunc; Stops func. '_Exit'
Edited by AX5
Posted

i tryd it but on the program the script is made fore do sent do anything

HotKeySet("{ESC}", "_Exit"); If you press ESCAPE the func. '_Exit' will be called

$TimesToRepeat = 10; Times to Repeat Send("1")

Sleep(1000); Sleeps 1 seconds

While 1; Start loop
    For $i = 1 To $TimesToRepeat; Start for loop
        Send("1"); Sends 1
        Sleep(4000); Sleeps 4 seconds
    Next; Stops for loop
    Send("2"); Sends 2
    Sleep(1000); Sleeps 1 second
WEnd; Stop loop

Func _Exit(); Starts func. '_Exit'
    Exit; Exists
EndFunc; Stops func. '_Exit'
hi,

you missed the notepad part from AlmarM ' s example. His keys are sent to application notepad, your send's are sent to nirvana. You have to have an active Window to send messages with Send (see help file).

;-))

Stefan

Posted (edited)

hi,

you missed the notepad part from AlmarM ' s example. His keys are sent to application notepad, your send's are sent to nirvana. You have to have an active Window to send messages with Send (see help file).

;-))

Stefan

i don't understand what u are telling me

I removed the notepad script becomes the script is not made for notepad its made fore a Client .... Online

Edited by AX5
Posted

i don't understand what u are telling me

I removed the notepad script becomes the script is not made for notepad its made fore a Client .... Online

Hi,

see helpfile function send:

Sends simulated keystrokes to the active window

Since you have no active window, your Send ("1") is sent to nothing.

Use WinActivate to set focus on your client application and your send will work.

;-))

Stefan

Posted

Hi,

see helpfile function send:

Sends simulated keystrokes to the active window

Since you have no active window, your Send ("1") is sent to nothing.

Use WinActivate to set focus on your client application and your send will work.

;-))

Stefan

so hove do i make so the script works for the client ?

Posted (edited)

Here is the script agen but it don't work in my Client Window some one that can fix my script ?

link to download the au3 script : CLICK HERE

Edited by AX5

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...