Jump to content

Recommended Posts

Posted (edited)

Global $hGui, $hTest, $sText = ''
GUICreate("AutoIt Interrupting Cow", 500, 200)
$hText = GUICtrlCreateLabel("", Default, Default, 480, 180)
GUISetState()
$sText = 'Cow: "Knock Knock"' & @CRLF
GUICtrlSetData($hText, $sText)
Sleep(2000)
$sText&= 'Man: "Who''s there?"' & @CRLF
GUICtrlSetData($hText, $sText)
Sleep(2000)
$sText&= 'Cow: "Interrupting Cow"' & @CRLF
GUICtrlSetData($hText, $sText)
AdLibRegister("_MOO", 2200)
Sleep(2000)
$sText&= 'Man: "Interrupting Cow who?"' & @CRLF
GUICtrlSetData($hText, $sText)
Sleep(5000)

Exit

Func _MOO()
    AdlibUnRegister("_MOO")
    msgbox(0,"(*!^%&*!^$*&^INTERRUPTING COW $*&^$*$#&^$", "MOOOOOOOOOOOOOOOOOOOO!!!!!!!!!!!")
EndFunc

Edited by Mechaflash
  Reveal hidden contents

 

Posted

You should look at re-arranging the structure of your code. I would also advise using Tidy by Jos for proper indentation and naming of the functions.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

... thanx... guinness...

  Reveal hidden contents

 

Posted

As an example for others wondering "huh?!" $hGUI is declared and initialised, but never actually used in the script (even though it should be passed to GUISetState.)

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

  On 3/25/2013 at 8:02 PM, 'guinness said:

As an example for others wondering "huh?!" $hGUI is declared and initialised, but never actually used in the script (even though it should be passed to GUISetState.)

hehe :D that's originally why I declared $hGUI in the first place but forgot that GUISetState() doesn't actually require the handle if you're pointing to the [last] defined gui.
  Reveal hidden contents

 

Posted

  On 3/25/2013 at 8:15 PM, 'Mechaflash said:

hehe :D that's originally why I declared $hGUI in the first place but forgot that GUISetState() doesn't actually require the handle if you're pointing to the [last] defined gui.

Good practice states you shouldn't rely on the "last GUI/control used" method. I know it's there, but sometimes it can land you in all sorts of problems.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

Then we shall petition to force GUISetState() to accept a GUI handle else it returns with an error!

  Reveal hidden contents

 

Posted

  On 3/25/2013 at 8:20 PM, 'Mechaflash said:

Then we shall petition to force GUISetState() to accept a GUI handle else it returns with an error!

That would be an unnecessary script breaking change in my humble opinion.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...