Ijaz

How to Continue a While loop after WEnd Statment

7 posts in this topic

Hello! every body.

I am new to programming...........

I already have a working code for PixelChecksum but i am unable to make it loop after completion. existing code is this:

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

#include <MsgBoxConstants.au3>

; Wait until something changes in the region 0,0 to 50,50

; Get initial checksum

Local $iCheckSum = PixelChecksum(0, 0, 50, 50)

 ; Wait for the region to change, the region is checked every 100ms to reduce CPU load
While  $iCheckSum = PixelChecksum(0, 0, 50, 50)
      Sleep (100)

WEnd
      SoundPlay(@WindowsDir & "\media\tada.wav",1)
      MsgBox($MB_SYSTEMMODAL, "", "There is a pixel color change!")

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

1- I need that after execution of all code it should automatically start again from beginning and wait for another pixel color change.

2- i need to play sound file continuously until i click OK on message box. for now sound file plays only for 01 time.

any help will be appreciated.

thanks in advance.

Share this post


Link to post
Share on other sites



Hi @Ijaz, and welcome to the AutoIt forum :)

Can I ask you for what purpose are you doing this?

By the way, you should insert another While...WEnd loop, in order to have your checksum continuosely :)


Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites
40 minutes ago, FrancescoDiMuro said:

Hi @Ijaz, and welcome to the AutoIt forum :)

Can I ask you for what purpose are you doing this?

By the way, you should insert another While...WEnd loop, in order to have your checksum continuosely :)

Thanks dear, I already have done it and it is working fine now. now the problem is how to repeat sound file until i press ok button on the message box.

thanks for your kind reply.

Share this post


Link to post
Share on other sites
3 minutes ago, Ijaz said:

Thanks dear, I already have done it and it is working fine now. now the problem is how to repeat sound file until i press ok button on the message box.

thanks for your kind reply.

@Ijaz

Just put another While...WEnd loop with the MsgBox that returns a value ( like $MB_YESNO ), and wait for the value Yes or No... Until the Yes or No is pressed, then play the sound :)

Hope that helps :)


Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites
3 minutes ago, FrancescoDiMuro said:

@Ijaz

Just put another While...WEnd loop with the MsgBox that returns a value ( like $MB_YESNO ), and wait for the value Yes or No... Until the Yes or No is pressed, then play the sound :)

Hope that helps :)

Please can you give an example because i am new to programming. so it is better if you show me some example of it. i already posted my code.

thanks alot.

Share this post


Link to post
Share on other sites

Thanks I found the solution.

I made sound loop with another scripting language AutoHotkey and then called this autohotkey script from autoit.

now working fine.

anyway thanks for helping me.

Share this post


Link to post
Share on other sites
44 minutes ago, Ijaz said:

I made sound loop with another scripting language AutoHotkey and then called this autohotkey script from autoit.

Ah the sledgehammer approach for getting the nail in... sweet!  

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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