Jump to content
Sign in to follow this  
badcoder123

How does AdlibRegister exactly work?

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By kingjacob90
      Hi
      So I am trying to click the green button, this button is not always in the same place. So fare I am trying to click it by finding the color but there is also something else with the same color on the screen (circled in yellow) that is causing issues. Is there a way to use the Title and Class of the window (can't be just the window as there are more than one with the same name).
      How does AutoIt Info get this information?

    • By adjist
      Hello all! 
       
      Getting this error :
      (22) : ==> Variable used without being declared.: if $vNumber = 0 Then if ^ ERROR  
      But I'm sure I have defined the variable, as in the top of my script has 
      Global $vNumber = 0  
      How would I go about fixing this?
       
    • By MarkIT
      Hi AutoIT masters,
      Good day! Sorry to have bothered this forum but we really need help. We are working on an automation project that is running on VDI server. The BOTS are in .exe are running fine until AV detected them and deleted the files. The files were re-compiled and AV kept on deleting them. The copy of the .exe BOT deleted were sent to Symantec for whitelisting. After whitelisting, it is no longer deleted but no longer working as designed (showing Line script error). We checked the scripts and there were no issues since we run it using SciTE editor and it performed the desired task. Good thing we found on this thread the solution using .a3x and the BOTS worked fine and no longer deleted. Now, the problem is they are asking why the BOTS won't run in .EXE and what is the reason behind Symantec AV deleting them. We raised a case with Symantec but they cannot provide further information as they are always seeing the file as "False Positive". We even tested with Symantec turned off and those .EXE files are working fine, however, after re-enabling, it got deleted.
      Just seeking help on how to better convince them that it is really Symantec causing the issue and the .a3x file.
    • By AutoitMike
      Scite 3.4.4
      Win 10
      I click "Help" or press F1, there is no response
      If I use the file explorer and double click Autoit.chm or Autoit3.chm help opens.
      There is no dialog to check or uncheck "Always ask before opening this file" when clicking on these files.
       
      If you are curious as to why I dont have the latest version, I am creating a back up laptop that has a VERY extensive automation application that I have written over the past 15 years.
       
      An extremely potent, powerful, needed function has been deleted in the upgrade of Autoit in recent years that I can not do without. If my main laptop dies, which it almost did, I am in a very bad position. So I bought the exact same laptop and I am "cofiguring" it to work exactly the same as my main laptop. However, this one has been "Upgraded" to Win 10 which I hope is not the problem. 
      Thanks for any help
    • By dascondor
      So basically need to pull text from a .txt file or .sql and use that text to replace something within a different file.
       
      First File:
      jumps
       
      Or:
      Text1 = jumps
      Text2 = fence
      Second File:
      My Dog XXXXX over the YYYYY.
       
       
      After Script:
      My Dog jumps over the fence
       
      I have found a good start, I'm basic programmer at best, I have some experience but this gets out of my wheel house.
       
      Any help is appreciated.
       
       
×
×
  • Create New...