Starstar Posted April 14, 2013 Share Posted April 14, 2013 (edited) What is the INSTANCE in control ID???? And how can i use it in controlclick ID??? I want to Remove a netwok adapter from network connections.but Controlclick is not doing click on yes button of confirm connection delete.Please guide me.......... expandcollapse popup#NoTrayIcon #compiler_icon=itlifesaver.ico #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <process.au3> $COMPANY_NAME = "HM-LINK" ; name of the pppoe icon, friendly description $SERVICE_NAME = "HM" ; name of the pppoe service configured in NAS/Mikrotik Local $font $timeout=00 ;Restart TimeOut $DELAY = 250 ; Run Network Setup Run("control ncpa.cpl") WinWaitActive("Network Connections") ; Check if PPPOE dialer by same name already exists, since it'll break script later if Windows add's a number at the end of the name... $ControlID = ControlListView("Network Connections", "", "SysListView321", "FindItem", $COMPANY_NAME, "AACABLE - DIALER SERVICE") WinClose("Network Connections") If $ControlID <> -1 Then $frmInformation1 = GUICreate("Uninstall Process", 325, 80, 190, 110) $btnOK1 = GUICtrlCreateButton("Remove", 260, 50, 60, 25, 0x0001) $lblInfo1 = GUICtrlCreateLabel("Acount is already exist Do you want to delete it...", 10, 8, 250, 40) $lblInfo1 = GUICtrlSetFont($lblInfo1, 9, 800) $lblInfo2 = GUICtrlCreateLabel(" If you have not any Problem do't click on Remove", 10, 55, 245, 17, 0x1000) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $btnOK1 If $ControlID <> -1 Then ; Check if PPPOE dialer by same name already exists, since it'll break script later if Windows add's a number at the end of the name... $ControlID1 = ControlListView("Network Connections", "", "SysListView321", "FindItem", $COMPANY_NAME, "AACABLE - DIALER SERVICE")&$ControlID>0 $answer = MsgBox(4, "HM-LINK 03216592390", "Are You Sure to Delete Account of "& $COMPANY_NAME &"?") If $answer = 7 Then Exit WinClose("Uninstall Process") Else Sleep($DELAY) Send("!{F4}") Send("!{F4}") Sleep($DELAY) Send("!{F4}") Send("!{F4}") Sleep($DELAY) Send("{ESc}") Sleep($DELAY) Run("control ncpa.cpl") WinWaitActive("Network Connections") ControlListView("Network Connections", "", "SysListView321", "Select", $ControlID1) ControlSend("Network Connections","","","{Del}") Sleep($DELAY) ControlClick("Confirm Connection Delete", "", "[Button; Yes]") Sleep($DELAY) WinClose("Network Connections") Sleep($DELAY) FileDelete(@DesktopCommonDir & "\HM-LINK.lnk"); if COMPANY_NAME changed see it............................................................. Sleep($DELAY) FileDelete(@StartupCommonDir & "\HM-LINK 03216592390.lnk"); if COMPANY_NAME changed see it............................................................. Sleep($DELAY) $answer1 = MsgBox(4, "Computer Restart 03216592390","You Must Restart Your Computer! Are You Sure To Restart Computer?") If $answer1 = 6 Then WinClose("Computer Restart 03216592390") Sleep($DELAY) Shutdown(2) Else WinClose("Uninstall Process") Sleep($DELAY) WinClose("Computer Restart 03216592390") ExitLoop EndIf EndIf EndIf Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd GUISetState(@SW_HIDE) Exit EndIf Edited April 14, 2013 by adnanbaloch Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." Link to comment Share on other sites More sharing options...
water Posted April 14, 2013 Share Posted April 14, 2013 Adnan,as always the help file is your friend. This description is only a click away from ControlClick. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Starstar Posted April 14, 2013 Author Share Posted April 14, 2013 (edited) Thanks Water i looked on it.but i could not understand that what is "instance:1" or "instance:2"? Is instance based on numeric configuration of buttons?If i want to click on a "Yes" button of information msgbox what is the instance of that button or another ID>>>>There are two buttons Yes and No.ControlClick("Confirm Connection Delete", "", "[Class:Button; Text:Yes]","left",1) Edited April 14, 2013 by adnanbaloch Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." Link to comment Share on other sites More sharing options...
JohnOne Posted April 14, 2013 Share Posted April 14, 2013 [CLASS:Button; INSTANCE:1] [CLASS:Button; INSTANCE:2] Check with window info tool. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
water Posted April 14, 2013 Share Posted April 14, 2013 Instance is only needed when all other properties of two controls match. Usually ID or Class is all you need. You get all thos properties when you move the crosshair of the AutoIt Window Info tool over a control. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Starstar Posted April 14, 2013 Author Share Posted April 14, 2013 (edited) thanks johnOne it works for me...................Thanks a lot.......... Edited April 14, 2013 by adnanbaloch Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." 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