Jump to content
Sign in to follow this  
crz

Help! - A bit complicated issue.

Recommended Posts

crz

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

Share this post


Link to post
Share on other sites
marfdaman

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!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Share this post


Link to post
Share on other sites
crz

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

Share this post


Link to post
Share on other sites
SmOke_N

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

Share this post


Link to post
Share on other sites
marfdaman

@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!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.