Jump to content
Sign in to follow this  
Ankit0607

Control* problems

Recommended Posts

Ankit0607

Hi I am trying to automate a GUI form which is developed in C#......Autoit standard functions like "ControlSend ","ControlSetText" are not working properly on the window. When i tried to spy objects it is showing as"WindowsForms10.EDIT.app".......Can you please help me out

Share this post


Link to post
Share on other sites
Melba23

Ankit0607,

Welcome to the AutoIt forums. :)

But please start a new thread like this in future rather then hijacking an old one. ;)

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______Open Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Ankit0607

Ok...I ll take care of that....

 

There is edit box on GUI .....when i tried to enter test using ControlSetText and  ControlSend ....Nothing is happening.......

Share this post


Link to post
Share on other sites
Ankit0607

Right now i dont hv code with me....even when i tried to check existence ...it is giving false......

Share this post


Link to post
Share on other sites
Ankit0607

Its ok....i can understand.....i ll share code ASAP......

BTW thanks for replying 

Share this post


Link to post
Share on other sites
Ankit0607

Here is code......
 
There is edit box called 'Database IP' on GUI....i spied the same....please see attachment.......

I have tried different way to enter value in same edit box ...below is code

 
WinActivate("CPACS Connector Configuration Tool")
 
 
;First way with and without window Title
ControlSetText("CPACS Connector Configuration Tool","","[CLASS:WindowsForms10.EDIT.app.0.378734a; INSTANCE:15]","11")
ControlSetText("","","[CLASS:WindowsForms10.EDIT.app.0.378734a; INSTANCE:15]","11")
 
;Second Way with or without title
ControlSetText("CPACS Connector Configuration Tool","","[ClassnameNN:WindowsForms10.EDIT.app.0.378734a15]","11")
ControlSetText("","","[ClassnameNN:WindowsForms10.EDIT.app.0.378734a15]","11")
 
;Third way with or without title
ControlSetText("CPACS Connector Configuration Tool","","[iD:262810]","11")
ControlSetText("","","[iD:262810]","11")
 
;Fourth way with or without title
ControlSend("CPACS Connector Configuration Tool","","[CLASS:WindowsForms10.EDIT.app.0.378734a; INSTANCE:15]","11")
ControlSend("","","[CLASS:WindowsForms10.EDIT.app.0.378734a; INSTANCE:15]","11")
 
;Fifth way with or without title
ControlSend("CPACS Connector Configuration Tool","","[ClassnameNN:WindowsForms10.EDIT.app.0.378734a15]","11")
ControlSend("","","[ClassnameNN:WindowsForms10.EDIT.app.0.378734a15]","11")
 
;Sixth way with or without title
ControlSend("CPACS Connector Configuration Tool","","[iD:262810]","11")
ControlSend("","","[iD:262810]","11")
 
 
 
 
 

post-87331-0-04597600-1410244811_thumb.p

Share this post


Link to post
Share on other sites
bogQ

I presume that your post was connected to post i replied to so that is why you pm-ed me with link.

So im gonna tell you something similar to what i told him.

Use ControlFocus and ControlGetFocus to confirm that you can set focus to the control.
if it did not work first time, try WinActivate and WinWaitActive with some sleep before ControlFocus and ControlGetFocus.
post heare what happend after that test.

If you can set focus try to set focus and after that use ControlSend and ControlSetText to see can you use Control*(commands) only on Controls that have focus.


TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites
Ankit0607

Hi i have tried Controlfocus and controlgetfocus ......still issue is there...... please find attachment 

post-87331-0-58496900-1410247725_thumb.p

Edited by Ankit0607

Share this post


Link to post
Share on other sites
bogQ

try to run this from scite and copy paste console output for us to see

test('[CLASS:WindowsForms10.EDIT.app.0.378734a; INSTANCE:15]', 1)
test('[CLASSNN:WindowsForms10.EDIT.app.0.378734a15]', 2)
test('[INSTANCE:15]', 3)

Func test($data, $try)
    ConsoleWrite('!> ---------------test:' & $try & ':' & $data & @CRLF)
    Local $winHwnd = WinGetHandle("CPACS Connector Configuration Tool")
    If IsHWnd($winHwnd) Then
        WinActivate($winHwnd)
        WinWaitActive($winHwnd)
        Sleep(1000)
        If ControlFocus($winHwnd, '', $data) Then
            Sleep(1000)
            Local $focus = ControlGetFocus($winHwnd)
            If @error Then
                ConsoleWrite('!> ' & "ControlGetFocus error!" & @CRLF)
            Else
                ConsoleWrite('!> ' & $focus & @CRLF)
                If $focus == 'WindowsForms10.EDIT.app.0.378734a15' Then
                    ConsoleWrite('!> ' & 'Looks ok from heare.' & @CRLF)
                    Sleep(1000)
                    ControlSend($winHwnd, '', $data, '11')
                    If @error Then ConsoleWrite('!> ' & "ControlSend error!" & @CRLF)
                    Sleep(1000)
                    Local $text = ControlGetText($winHwnd, '', $data)
                    If @error Then
                        ConsoleWrite('!> ' & "ControlGetText error!" & @CRLF)
                        Exit
                    EndIf
                    ConsoleWrite('!> ControlGetText:' & $text & @CRLF)
                Else
                    ConsoleWrite('!> ' & ControlGetFocus($winHwnd) & ' VS WindowsForms10.EDIT.app.0.378734a15' & @CRLF)
                EndIf
            EndIf
        Else
            ConsoleWrite('!> ' & "ControlFocus error!" & @CRLF)
        EndIf
    Else
        ConsoleWrite('!> ' & "CPACS win error!" & @CRLF)
    EndIf
EndFunc   ;==>test
Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites
Ankit0607

Hi

Run the code ...below is output on console

!> ---------------test:1
!> ControlFocus error!
!> ---------------test:2
!> ControlFocus error!

post-87331-0-28810900-1410252547_thumb.p

Edited by Ankit0607

Share this post


Link to post
Share on other sites
bogQ

my bad, edited upper code, can you retry updated code one more time?


TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites
Ankit0607

Tried updated code.....

Output:

!> ---------------test:1:[CLASS:WindowsForms10.EDIT.app.0.378734a; INSTANCE:15]
!> ControlFocus error!
!> ---------------test:2:[CLASS:WindowsForms10.EDIT.app.0.378734a15]
!> ControlFocus error!

Share this post


Link to post
Share on other sites
bogQ

edit forth edit, so many mistakes when typing >_< try now

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites
Ankit0607

O/p 

 

!> ---------------test:1:[CLASSNN:WindowsForms10.EDIT.app.0.378734a; INSTANCE:15]
!> ControlFocus error!
!> ---------------test:2:[CLASS:WindowsForms10.EDIT.app.0.378734a15]
!> ControlFocus error!
!> ---------------test:3:[iNSTANCE:15]
!> ControlFocus error!

Share this post


Link to post
Share on other sites
Ankit0607

BTW

ClassNameNN  : WindowsForms10.EDIT.app.0.378734a15

Class : WindowsForms10.EDIT.app.0.378734a

Instance: 15

Id: 262810

Share this post


Link to post
Share on other sites
bogQ

yea i know, i mesed up NN and with no NN :) you get the point try to test to see if you get the focus, try ids and what ever you have

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites
Ankit0607

Tried 

Please see attachment 

post-87331-0-81238800-1410254077_thumb.p

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  

×