Jump to content

Imcoolkarni

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by Imcoolkarni

  1. Hello All, I am beginner in AutoIt, I am trying to make a script to handle 2 popup in application. In the script it will handle the first popup with ease Then the user logs in in using his credentials and presses on the login, he will be able to login After the login the nextpopup will be handled by script. The problem is that I have made script in such a way so as only for one instance if script will be running. If the cancel button in the login is pressed then the application will exit but still the script will be running in background, It would be very helpful if someone helps me with logic wherein the script should exit if the cancel button is pressed. There are two buttons Login and cancel, If login is pressed it should proceed to resolve the upcoming popup If cancel is pressed then the application will terminate but i want to terminate the script along with it. I do not know how to take action if the cancel button is pressed. Please find the below snip of code #include <Misc.au3> $g_szVersion = "Scriptname" If WinExists($g_szVersion) Then Exit ; It's already running AutoItWinSetTitle($g_szVersion) Run("C:\Program Files\Subex Limited\Optima v4.6\Optima.exe","") WinWait("Popup Window1") WinActivate("Popup Window1") ;To provide password to the client ;send("{LEFT}") ;Send("{ENTER}") ;Click on the Login Button ;If WinExists ("Component not registered") Then ; ControlSend("Component not registered", "", "[CLASS:Scintilla; INSTANCE:1]", "{ENTER}") ;EndIf If WinWaitActive("Popup Window1") Then ; you know it is going to appear ControlSend("Popup Window1", "", "[CLASS:Button; INSTANCE:1]", "{ENTER}") ; you can add TEXT: there too. Send("{ENTER}") EndIf If WinWaitActive(" Login") Then ; you know it is going to appear $dll = DllOpen("user32.dll") While 1 sleep(10) If _IsPressed("01", $dll) Then;Here i have detect when the cancel button is pressed. Consolewrite('Pressed' & @CRLF) Exit EndIf WEnd DllClose($dll) EndIf ;Send("{ENTER}") Thanks in Advance.
  2. Hello Jefrey, Thanks for update. I want to call exit if the button is pressed by user. How do i detect if button is clicked. There are two buttons Login and cancel, If login is pressed it should proceed to resolve the upcoming popup If cancel is pressed then the application will terminate but i want to terminate the script along with it. I do not know how to take action if the cancel button is pressed. Please find the below snip of code #include <Misc.au3> $g_szVersion = "Scriptname" If WinExists($g_szVersion) Then Exit ; It's already running AutoItWinSetTitle($g_szVersion) Run("C:\Program Files\Subex Limited\Optima v4.6\Optima.exe","") WinWait("Popup Window1") WinActivate("Popup Window1") ;To provide password to the client ;send("{LEFT}") ;Send("{ENTER}") ;Click on the Login Button ;If WinExists ("Component not registered") Then ; ControlSend("Component not registered", "", "[CLASS:Scintilla; INSTANCE:1]", "{ENTER}") ;EndIf If WinWaitActive("Popup Window1") Then ; you know it is going to appear ControlSend("Popup Window1", "", "[CLASS:Button; INSTANCE:1]", "{ENTER}") ; you can add TEXT: there too. Send("{ENTER}") EndIf If WinWaitActive(" Login") Then ; you know it is going to appear $dll = DllOpen("user32.dll") While 1 sleep(10) If _IsPressed("01", $dll) Then;Here i have detect when the cancel button is pressed. Consolewrite('Pressed' & @CRLF) Exit EndIf WEnd DllClose($dll) EndIf ;Send("{ENTER}") If WinWaitActive("Popup window2") Then ; you know it is going to appear ControlClick("Popup window2","", "[CLASS:WindowsForms10.BUTTON.app.0.378734a; INSTANCE:1]","left",1) ElseIf Exit EndIf
  3. Hello All, I am beginner in AutoIt, I am trying to make a script to handle 2 popup in application. In the script it will handle the first popup with ease Then the user logs in in using his credentials and presses on the login, he will be able to login After the login the nextpopup will be handled by script. The problem is that I have made script in such a way so as only for one instance if script will be running. If the cancel button in the login is pressed then the application will exit but still the script will be running in background, It would be very helpful if someone helps me with logic wherein the script should exit if the cancel button is pressed. Thanks In Advance
×
×
  • Create New...