Jump to content

New w/ AutoIT


sYs73m
 Share

Recommended Posts

Hello!

I've been trying to teach myself AutoIT, but I've been having a hard time making this script work. Odds are, I'm way off and don't know what I'm doing. Here is basically what I'm looking to do;

I wanted to set a script up to do a keystroke, wait a designated amount of time, hit another keystroke, wait another designated amount of time, then I want the it to basically restart, and endlessly repeat itself until I manually turn off the script.

Can anyone help me with this? I can post what I have if you want, but I'm trying to save face so I'd rather not, that way ya'll don't laugh at me! :)

Thanks.

Link to comment
Share on other sites

i will just give you some hints

While 1
    SendKeys("ABC")
    Sleep(100)
WEnd

Or something close to that. I dont have the helpfile here right now. And you would need to set a hotkey to exit the script or you have to close it from the tray menu.

"I teleported home one nightWith Ron and Sid and Meg.Ron stole Meggie's heart awayAnd I got Sidney's leg."- A poem about matter transference beams.

Link to comment
Share on other sites

i will just give you some hints

While 1
    SendKeys("ABC")
    Sleep(100)
WEnd

Or something close to that. I dont have the helpfile here right now. And you would need to set a hotkey to exit the script or you have to close it from the tray menu.

Yeah, it would be a manual close from the tray.

I'm going to assume that the "Sleep(100)" is in seconds, although I don't understand what the "While 1" part is. I'll play with it some more. Thanks. Anyone else who can help, please do.

Edit: Tried playing with what you gave me, got an error when I try to run it. I'm pretty new so I'm sorry if I'm not getting it..

Edited by sYs73m
Link to comment
Share on other sites

Yeah, it would be a manual close from the tray.

I'm going to assume that the "Sleep(100)" is in seconds, although I don't understand what the "While 1" part is. I'll play with it some more. Thanks. Anyone else who can help, please do.

"While 1 ... WEnd" is an infinite loop, it will run until you exit the loop or the script. Sleep() uses miliseconds. oh and Read The Fine Manual. It helps. Really!

edit: i knew i messed something up.

Replace SendKeys() with Send()

Edited by Björn Kaiser

"I teleported home one nightWith Ron and Sid and Meg.Ron stole Meggie's heart awayAnd I got Sidney's leg."- A poem about matter transference beams.

Link to comment
Share on other sites

HotKeySet("`","_Go")
HotKeySet('{esc}', '_Exit')

While 1
    ToolTip("Press tilde to Start "&@LF&"Press ESC to Exit")
    Sleep(100)
WEnd

Func _Go()
    While 1
        Send("{F1}") ;the Key you want to send
        Sleep(5000) ;Time you want to Wait, 5second
        ;More Sends... .. .
        ;More Sleeps... .. .
        Send(8)
        Sleep(5*60*1000) ;<<-------- 5 minutes
    Wend
EndFunc 

Func _Exit()
    ToolTip('          '&@CRLF&'  EXITING  '&@CRLF&'          ')
    Sleep(500)
    Exit
EndFunc

There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly

Link to comment
Share on other sites

Okay, here is what I have so far, and it's mostly working;

While 1
    Sleep(5000)
    Send("{F2}")
    Sleep(5000)
    Send("3")
    Sleep(5000)
    Send("Q")
    Sleep(5000)
    Send("A")
    Sleep(2000)
    Send("D")
    Sleep(2000)
    Send("T")
    Sleep(40000)
WEnd

Pushing F2 works, pushing 3 works, pushing Q works, but after it pushes Q, it ignores the A, D and T function. Any suggestions?

Thanks, ofLight, but that looks really confusing to me. I'll give it a shot if what I'm doing is useless/broken.

Link to comment
Share on other sites

....

Pushing F2 works, pushing 3 works, pushing Q works, but after it pushes Q, it ignores the A, D and T function. Any suggestions?

...

maybe the program/window you are trying to send input to got inactive.

you can either check if the window is active every time or you can use ControlSend() as that works also with inactive windows.

"I teleported home one nightWith Ron and Sid and Meg.Ron stole Meggie's heart awayAnd I got Sidney's leg."- A poem about matter transference beams.

Link to comment
Share on other sites

Try this one first of all :)

Run("c:\Program Files\AutoIt3\AutoIt.chm")
/bonk

Thanks everyone for their help, I managed to get it working. ofLight, I worked with yours for a bit and it was flawless, bar the fact that it bogged down the entire computer. I chopped some of it out, such as the start/stop feature. Thanks a bunch.

Link to comment
Share on other sites

maybe the program/window you are trying to send input to got inactive.

you can either check if the window is active every time or you can use ControlSend() as that works also with inactive windows.

It wasn't that. Not sure why it wasn't working. I just started from scratch and it worked fine. Maybe I had some unknown typo in there...

Edit: I've spent a good ten minutes looking for one thing; When I installed AutoIt, it asked me if I wanted to edit, or run, a script when I double-clicked it. How can I change this? I want it to run it, instead of editing it.

Anyone know how I can change the setting? Searching the FAQ didn't help much either, kept getting release note updates and stuff, heh..

Edited by sYs73m
Link to comment
Share on other sites

It wasn't that. Not sure why it wasn't working. I just started from scratch and it worked fine. Maybe I had some unknown typo in there...

Edit: I've spent a good ten minutes looking for one thing; When I installed AutoIt, it asked me if I wanted to edit, or run, a script when I double-clicked it. How can I change this? I want it to run it, instead of editing it.

Anyone know how I can change the setting? Searching the FAQ didn't help much either, kept getting release note updates and stuff, heh..

Have you install SciTE4AutoIt3.exe it was an editor which was really usefull to write your script..

In the installation you will be ask what you want to do when double clicking your script (Run or Edit).

http://www.autoitscript.com/autoit3/scite/downloads

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