Jump to content

Help! - A bit complicated issue.


Recommended Posts

Hello AutoIt scripters.

I have this, a bit weird and complicated issue.

I'll give it a try, to explain, an exampel would be:

I want my script to open notepad. Then write a sentence, or do a mousemove over and over, for like 15 minutes. After that, close the notepad only to open it again and do it all over. - And I want this to loop.

I understand if you don't get the problem, I'll give the code a try (don't look for minor mistakes, this is just a quick exampel):

Run("notepad.exe")
While 1
MouseMove(100, 200, 25)
Send("Text")
MouseMove(200, 400, 25)
WEnd

The script opens notepad, and then looping continusly mousemoves and textinput.

But what if I want the script to, only loop mousemoves and textinputs for like, 15 minutes, then loop entire script? (Closing down notepad and open it again, looping mousemoves and textinputs once again). - And I want this to loop also.

I don't know if this is a good exampel or not, or if I told you enough info about the issue, but please, someone give it a try, I'm almost crying! : )

Thanks.

Steffen "crz" Jorgensenwww.crz.dkcrz@crz.dk

Link to comment
Share on other sites

While 1
    $timer = TimerInit()
    While 1
        $pid = Run("notepad.exe")
        WinWaitActive("Untitled - Notepad")
        While TimerDiff($timer) < 900000
            Send("l")
        WEnd
        ProcessClose($pid)
        ExitLoop
    WEnd
WEnd

Alzo

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

This one, I don't get.. could you comment it out for me? - Or maybe another solution?

EDIT: I get it now, hehe! Thanks for helping me out.

Edited by crz

Steffen "crz" Jorgensenwww.crz.dkcrz@crz.dk

Link to comment
Share on other sites

  • Moderators

@marf / only looks like you need 2 loops there, the exitloop While doesn't look like it's necessary.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

@marf / only looks like you need 2 loops there, the exitloop While doesn't look like it's necessary.

Yes, you're right, as usual :D

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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