Jump to content

How to Continue a While loop after WEnd Statment


Ijaz
 Share

Recommended Posts

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.

Link to comment
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.

Link to comment
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

ALWAYS GOOD TO READ:

 

Link to comment
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.

Link to comment
Share on other sites

  • Developers
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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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