Jump to content

Help with GUI and few actions, im pretty new with autoit


grzn
 Share

Recommended Posts

hello, ppl, im learning this wonderful programming language, today i came up with a prob, let me say that i was trying to make a program that sends certain key every certain time, but also another key with its own time.

i.e: send letter w every 1 second, and at the same time send D every 10 seconds (the letter D timer has nothing to do with the other one) was hoping someone could help me achieve this. Thanx in advance

(this is what i have so far)

Global $Paused
HotKeySet("{º}", "TogglePause")
HotKeySet("{RIGHT}", "Terminate")
 
#include <GUIConstantsEx.au3>
GUICreate("prueba", 350, 500)
GUICtrlCreateLabel("primera", 8, 10)
$key1 = GUICtrlCreateInput("", 45, 8, 40)
GUICtrlCreateLabel("Time", 8, 44)
$time1 = GUICtrlCreateInput("", 45, 40, 40)
$startbutton = GUICtrlCreateButton("Inicar", 95, 8, 40)
GUISetState(@SW_SHOW)
WinWaitActive("Sin título: Bloc de notas")
 
While 1
$msg = GUIGetMsg()
Select
Case $msg = $startbutton
$send1 = GUICtrlRead($key1)
$sleep1 = GUICtrlRead($time1)
While 1
Send($send1)
Sleep($sleep1*1000)
WEnd
 
Case $msg = $GUI_EVENT_CLOSE
GUIDelete()
ExitLoop
 
EndSelect
 
WEnd
 
Func TogglePause()
  $Paused = NOT $Paused
  While $Paused
    sleep(100)
    ToolTip('Script is "Paused"',0,0)
  WEnd
  ToolTip("")
EndFunc
Func Terminate()
  Exit 0
EndFunc
Link to comment
Share on other sites

How about:

$count = 0
while 1
    Sleep(1000)
    send("a")
    $count += 1
    if $count = 10 Then
        send("d")
        count = 0
    EndIf
WEnd

Here is the psuedo code:

counting up starts at 0

forever

wait 1 second

press a

counting goes up by 1

when my counting reaches 10

press d

go back to 0

Edited by NewNinja
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...