Jump to content

Recommended Posts

Posted

Hello, I am trying to click on button in dameware where the controlid isn't unique. The man. states that you can use the "text" option instead of the controlid or the ClassNameNN. My question is how do you implement this? here's my code: Thanks!

GUICreate("Emc Script", 350, 210)
$button1 = GUICtrlCreateIcon ("C:\progra~1\damewa~1\damewa~1\DNTU.exe",-1,90,10)
GUISetState ()
While 1
   $msg = GUIGetMsg()
   If $msg = $GUI_EVENT_CLOSE Then ExitLoop
   Select
     Case $msg = $button1
         dameware()
   EndSelect
WEnd

func dameware()
 Dim $primary
 Dim $secondary
 $k = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "SwapMouseButtons")
 If $k = 1 Then
   $primary = "right"
   $secondary = "left"
 Else 
   $primary = "left"
   $secondary = "right"
 EndIf
 $vServerClip=clipget()
 $vServerString=stringsplit($vServerClip,@TAB)
 $vServer=$vServerString[22]
 run(@ComSpec & " /c C:\progra~1\damewa~1\damewa~1\dntu.exe")
 sleep(2000)
 controlclick("dameware", "", "Add Favorite Domain or Non-Browsable Machine", $primary)
 send($vServer)
 send("{ENTER}")
 sleep(100)
endfunc
[\code]


            
        

        

        
    

    
    

    

                    
                    
                        
                    
                    
                

                    

                    
                    






    

    

    
        
            
                


    
        
    

                
                
                    
                        

                    
                
            
        
        
            
                


MHz
            
            
                Posted 
                
            
        
    
    
        


MHz
            
        
        
            
                
                    


    
        
    

                    
                    
                        

                    
                
            
            
                MVPs
                
                    
                
            
            
                
                    
                        
                            
                                
                            
                                 5.6k
                            
                                
                            
                        
                        
                            
                                
                                    
                                        
                                        30
                                
                                    
                                
                            
                        
                    
                
            
            
                

    
    
        
Just simple
    
    

            
        
    
    
        



    
        
            
                
                    
                    
                    
                    
                    
                
            
            
                
                    
                    
                        
                        
                        
                        
                        
                        
                            
                                
                            
                            
                            
                            
                            
                            
                        
                    
                
                
            
        

        
           
           Posted 
           
            
            
                
                
            
        
    

    

    

    
        
        
            Have you tried to add a WinWait() before the ControlClick() to ensure the window will be ready for it ?
You can use the AutoIt Info Tool to supply the control text. Just add it as a string parameter into ControlClick().


            
        

        

        
    

    
    

    

                    
                    
                        
                    
                    
                

                    

                    
                    






    

    

    
        
            
                


    
        
    

                
                
                    
                        

                    
                
            
        
        
            
                


monte
            
            
                Posted 
                
            
        
    
    
        


monte
            
        
        
            
                
                    


    
        
    

                    
                    
                        

                    
                
            
            
                Active Members
                
            
            
                
                    
                        
                            
                                
                            
                                 128
                            
                                
                            
                        
                        
                    
                
            
            
                

            
        
    
    
        



    
        
            
                
                    
                        Author
                    
                    
                    
                    
                    
                
            
            
                
                    
                    
                        
                        
                        
                        
                        
                        
                            
                                
                            
                            
                            
                            
                            
                            
                        
                    
                
                
            
        

        
           
           Posted 
           
            
            
                
                
            
        
    

    

    

    
        
        
            adding winwait("DameWare NT Utilities") provided no success, thanks though.


            
        

        

        
    

    
    

    

                    
                    
                        
                    
                    
                

                    

                    
                    






    

    

    
        
            
                


    
        
    

                
                
                    
                        

                    
                
            
        
        
            
                


monte
            
            
                Posted 
                
            
        
    
    
        


monte
            
        
        
            
                
                    


    
        
    

                    
                    
                        

                    
                
            
            
                Active Members
                
            
            
                
                    
                        
                            
                                
                            
                                 128
                            
                                
                            
                        
                        
                    
                
            
            
                

            
        
    
    
        



    
        
            
                
                    
                        Author
                    
                    
                    
                    
                    
                
            
            
                
                    
                    
                        
                        
                        
                        
                        
                        
                            
                                
                            
                            
                            
                            
                            
                            
                        
                    
                
                
            
        

        
           
           Posted 
           
            
            
                
                
            
        
    

    

    

    
        
        
            I don't quite follow you, I apologise:  You can use the AutoIt Info Tool to supply the control text. Just add it as a string parameter into ControlClick().

I am supplying "Add Favorite Domain or Non-Browsable Machine" from "status bar text" (found when running autoit info) in place of controlid in controlclick(), as classnamenn and text under "Control Under Mouse" doesn't change.  Please advise.


            
        

        

        
    

    
    

    

                    
                    
                        
                    
                    
                

                    

                    
                    






    

    

    
        
            
                


    
        
    

                
                
                    
                        

                    
                
            
        
        
            
                


MHz
            
            
                Posted 
                
            
        
    
    
        


MHz
            
        
        
            
                
                    


    
        
    

                    
                    
                        

                    
                
            
            
                MVPs
                
                    
                
            
            
                
                    
                        
                            
                                
                            
                                 5.6k
                            
                                
                            
                        
                        
                            
                                
                                    
                                        
                                        30
                                
                                    
                                
                            
                        
                    
                
            
            
                

    
    
        
Just simple
    
    

            
        
    
    
        



    
        
            
                
                    
                    
                    
                    
                    
                
            
            
                
                    
                    
                        
                        
                        
                        
                        
                        
                            
                                
                            
                            
                            
                            
                            
                            
                        
                    
                
                
            
        

        
           
           Posted 
           
            
            
                
                
            
        
    

    

    

    
        
        
            WinWait() would be better to use then the Sleep(2000) as the script waits until the window exists.
AutoIt Info does supply the details needed and yes, add it as a string parameter.
So you are clicking on the statusbar? I can do it with Wordpad for example as below.
WinWait("Document - WordPad","Formatting")
ControlClick("Document - WordPad","Formatting","msctls_statusbar321")

The window jumps into focus, so it seems to work as intended.

Posted

Thanks for the help. Using your example, I would be clicking on the Toolbar, and specifically I would want the first icon for a new document. However, there seems to be no way of specifying the new document icon.

WinWait("Document - WordPad","Formatting")

ControlClick("Document - WordPad","Formatting","ToolbarWindow322")

[\code]

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
×
×
  • Create New...