Jump to content

How to get Toggle Only to run when while the the QCDM is open


Go to solution Solved by Danp2,

Recommended Posts

 

I have excatly 2 months of experience in AUTIOIT and I am learning when you think have everything you need you quickly learn you don't.  I have been working on this project that has a small gui that has 5 buttons  one button will open a web page, one closes the web page, one opens and excel file, one to close the excel file, and the final button exits the GUI.  I don't really want to post my entire code because I am learning as I go and I would rather figure out the small errors out on my own.

When I first started working in AutoIT I asked question about a toggle feature and someone helped with the code.  I still want to use the toggle feature

My Goal is when I CLICK close the QCDM I want the toggle feature to stop.  I can't figure out how to do that.  Any help would be nice.

 

Button to Open a the webpage and to toggle

;button to open QCDM
Case $idButton_QCDM


;Calls webpage
    webPage()
                          
    Sleep(1000)
    openScreen()

 

Web page will close properly but the "Toggle" is still running

;Closes Chrome
Case $idButton_CLOSEQCDM
;Closes Chrome

WinClose("Amazon.com. Spend less. Smile more. - Google Chrome","")
exitChrome()

My Function to open chrome

Func openScreen()
    ;max size of window @sw_maxmimize

    WinSetState("Musical Instruments For Sale - New & Used Music Gear | Reverb - Google Chrome", "", @SW_MAXIMIZE)

    ;sleeps for 3 seconds
    Sleep (3000)

    AdlibRegister("toggle", 3000)
    
    

EndFunc

This is my Toggle Function

Func Toggle() ;==>Toggle between web pages
        ConsoleWrite('@@ (8) :(' & @MIN & ':' & @SEC & ') Toggle()' & @CR) ;### Trace Function
        Static $bFirst = True


            WinActivate(@SW_MAXIMIZE)

                    If $bFirst Then
                            Send("^1")
                    Else
                            Send("^2")

                    EndIf

                    $bFirst = Not $bFirst
EndFunc

 

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