Sign in to follow this  
Followers 0
Starstar

What is the INSTANCE in control ID????

6 posts in this topic

#1 ·  Posted (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..........

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

Share this post


Link to post
Share on other sites



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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 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."

Share this post


Link to post
Share on other sites

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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

thanks johnOne it works for me...................Thanks a lot..........

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

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  
Followers 0