badcoder123 Posted September 22, 2017 Share Posted September 22, 2017 Hey everyone, I've been messing around with some new things and adlibs look extremely useful/interesting, however, I can't seem to get it to work.. Here's what I have HotKeySet("{F1}", "_Exit") $qCount = 1 Global $_Timer AdlibRegister($_Timer, 1000) AdlibUnRegister($_Timer) While 1 SoundPlay(@WindowsDir & "\media\tada.wav", 1) $qCount += 1 ToolTip('"Tada" has been played ' & $qCount & " times",200,200) WEnd Func _Timer() Local Static $iCount += 1 ConsoleWrite($iCount) If $iCount = 20 Then ConsoleWrite("iCount is at " & $iCount) EndFunc Func _Exit() Exit EndFunc Basically I want it to call the _Timer function but it doesn't seem to work :/ any ideas? Link to comment Share on other sites More sharing options...
Danp2 Posted September 22, 2017 Share Posted September 22, 2017 Move this line to after the While loop or within your _Exit function -- AdlibUnRegister($_Timer) Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
badcoder123 Posted September 23, 2017 Author Share Posted September 23, 2017 49 minutes ago, Danp2 said: Move this line to after the While loop or within your _Exit function -- AdlibUnRegister($_Timer) Hey Danp2, Thanks for the reply. I've modified the code to... HotKeySet("{F1}", "_Exit") $qCount = 1 Global $_Timer AdlibRegister($_Timer, 1000) While 1 SoundPlay(@WindowsDir & "\media\tada.wav", 1) $qCount += 1 ToolTip('"Tada" has been played ' & $qCount & " times",200,200) WEnd Func _Timer() Local Static $iCount += 1 ConsoleWrite($iCount) If $iCount = 20 Then ConsoleWrite("iCount is at " & $iCount) EndFunc Func _Exit() ToolTip("") AdlibUnRegister($_Timer) Sleep(2000) Exit EndFunc I'm not sure if this is what you meant but this still does not work. Link to comment Share on other sites More sharing options...
kylomas Posted September 23, 2017 Share Posted September 23, 2017 Badcoder123, Register the function. Not the variable. Kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
badcoder123 Posted September 23, 2017 Author Share Posted September 23, 2017 25 minutes ago, kylomas said: Badcoder123, Register the function. Not the variable. Kylomas omg... Thanks haha Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now