Sign in to follow this  
Followers 0
PcExpert

Loop

19 posts in this topic

#1 ·  Posted (edited)

Hello,

How can I let the program restart from a point when the script has finished? For example: Your program writes a document in Word and if it has finished with it it starts over, but it only repeats the commands between /1 and /1

Thanks

Edited by PcExpert

Share this post


Link to post
Share on other sites



Hello,

How can I let the program restart from a point when the script has finished? For example: Your program writes a document in Word and if it has finished with it it starts over, but it only repeats the commands between /1 and /1

Thanks

Make it a conditional statement... If something is True Then Do Commands ... If it isn't true then it will just continue the loop.

[center]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.[/center]

Share this post


Link to post
Share on other sites

@smoke_n an if-case isn't a loop a loop is sth like while-wend or for-next!

@pcexpert for what do you exactly use the loo? there are some loops:

- the while-loop, which repeats while it has a special value for example.

- the for-loop, which repeats until a special value for a variable has reached

- and the do-loop, which conditions are like the one from the for:

Do...Until

--------------------------------------------------------------------------------

Loop based on an expression.

Do

statements

...

Until <expression>

Parameters

expression The statements in between Do and Until are executed until the expression is true.

Remarks

Do...Until statements may be nested.

The expression is tested after the loop is executed, so the loop will be executed one or more times.

For...Next

--------------------------------------------------------------------------------

Loop based on an expression.

For <variable> = <start> To <stop> [step <stepval>]

statements

...

Next

Parameters

variable The variable used for the count.

start The initial numeric value of the variable.

stop The final numeric value of the variable.

stepval [optional] The numeric value (possibly fractional) that the count is increased by each loop. Default is 1.

While...WEnd

--------------------------------------------------------------------------------

Loop based on an expression.

While <expression>

statements

...

WEnd

Parameters

expression If the expression is true the following statements up to the WEnd statement are executed. This loop continues until the expression is false.

Share this post


Link to post
Share on other sites

@smoke_n an if-case isn't a loop a loop is sth like while-wend or for-next!

@pcexpert for what do you exactly use the loo? there are some loops:

- the while-loop, which repeats while it has a special value for example.

- the for-loop, which repeats until a special value for a variable has reached

- and the do-loop, which conditions are like the one from the for:

No kidding? Wow... Thanks for the lesson... next time read and try to comprehend it a bit.

I said use the If / Then in a loop!


[center]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.[/center]

Share this post


Link to post
Share on other sites

yes, but actually his question was

How can I let the program restart from a point when the script has finished? For example: Your program writes a document in Word and if it has finished with it it starts over, but it only repeats the commands between /1 and /1

and this is not answered with saying him he should use a if case... read more carefully the questions and answer then only -.-*. he asks for the loops and not for if cases and wen you say him he could solve it with an ifcase and a loop he couldn't know which loop and how and so on, cause he exactly asks for it...

it's the same if you ask "how could i make a gui"

and you say you could make an ifcase if the gui should created and create one.

Share this post


Link to post
Share on other sites

yes, but actually his question was

and this is not answered with saying him he should use a if case... read more carefully the questions and answer then only -.-*. he asks for the loops and not for if cases and wen you say him he could solve it with an ifcase and a loop he couldn't know which loop and how and so on, cause he exactly asks for it...

it's the same if you ask "how could i make a gui"

and you say you could make an ifcase if the gui should created and create one.

Hello,

How can I let the program restart from a point when the script has finished? For example: Your program writes a document in Word and if it has finished with it it starts over, but it only repeats the commands between /1 and /1

Thanks

BUUUUUUUUUUUUUUUUT........ONLY REPEATS SOMETHING SPECIFIC!!!!!

IF SITUATION IS TRUE THEN DO SOMETHING / IN THE LOOP!!!!

If you have him just putting it in a loop (THAT HE ALREADY HAS!!), then he will REPEAT EVERYTHING!!


[center]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.[/center]

Share this post


Link to post
Share on other sites

not to create problems...

i agree with SmOke

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

maybe post your script so we can show you so that um smoke doesnt have a heart attack or something :)

Edited by thatsgreat2345

Share this post


Link to post
Share on other sites

maybe post your script so we can show you so that um smoke doesnt have a heart attack or something :)

It's not that, and I really want to say what I think of one of the posters, but I'm trying to keep my forum etiquette in tact.

[center]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.[/center]

Share this post


Link to post
Share on other sites

It's not that, and I really want to say what I think of one of the posters, but I'm trying to keep my forum etiquette in tact.

:) just saying cuz u could just show him up and im pretty sure proving him wrong would shut him up

Share this post


Link to post
Share on other sites

This is the script:

Run("C:\Program Files\Microsoft Office\OFFICE11\POWERPNT.exe")

WinWaitActive("Microsoft PowerPoint - [Presentatie1]")

MouseClick("left", 61, 34)

MouseClick("left", 60, 80)

MouseClick("left", 507, 204)

MouseClick("left", 360, 222)

MouseClick("left", 353, 435)

WinWaitActive("Microsoft PowerPoint - [presentatie]")

send("{F5}")

Sleep(272000)

Send("{SPACE}")

Send("{SPACE}")

Sleep(1000)

send("{F5}")

Share this post


Link to post
Share on other sites

which parts do u want to repeat after the script gets to the end?

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

The codes between

WinWaitActive("Microsoft PowerPoint - [presentatie]")

and

the last

send("{F5}")

Edited by PcExpert

Share this post


Link to post
Share on other sites

The codes between

WinWaitActive("Microsoft PowerPoint - [presentatie]")

and

the last

send("{F5}")

This will loop the part you want

Run("C:\Program Files\Microsoft Office\OFFICE\POWERPNT.exe")
While 1
WinWaitActive("Microsoft PowerPoint - [Presentatie1]")
MouseClick("left", 61, 34)
MouseClick("left", 60, 80)
MouseClick("left", 507, 204)
MouseClick("left", 360, 222)
MouseClick("left", 353, 435)
WinWaitActive("Microsoft PowerPoint - [Presentatie1]")
send("{F5}")
Sleep(2000)
Send("{SPACE}")
Send("{SPACE}")
Sleep(1000)
send("{F5}")
WEnd

Remember to put in a hotkey to exit the program or it will loop forever.



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

BUUUUUUUUUUUUUUUUT........ONLY REPEATS SOMETHING SPECIFIC!!!!!

IF SITUATION IS TRUE THEN DO SOMETHING / IN THE LOOP!!!!

If you have him just putting it in a loop (THAT HE ALREADY HAS!!), then he will REPEAT EVERYTHING!!

lol, he has never said that he only wants to repeat sth specific... don't know where you read that... :)

he just asked for a repeat, not for repeating sth special. don't know why you should use at his script an ifcase... -.-

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

"Winning an online argument is like winning the special olympics....in the end, you are still retarded" - Anonymous

Edited by LovinItAll

Share this post


Link to post
Share on other sites

lol, he has never said that he only wants to repeat sth specific... don't know where you read that...

Yep, it is pretty funny that you and PcExpert understand the same level of grammar. I also interpreted the OP to say that help was needed to construct a conditional statement on the order of an If/Then line or two.

Enjoy your - ?victory? - it has won you a special place in hearts of many forum members.


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

@lord doomick yeah he said he wanted it to go through once then only repeat part of the script but was this ever solved?

Share this post


Link to post
Share on other sites

My ebonics must be off if he wants to repeat the entire thing?

let the program restart from a point when the script has finished


[center]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.[/center]

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  
Followers 0