Jump to content

To find Text & click on it


Recommended Posts

Hi friends, 

       i have an application, which has non standard Class Name & Controls, i cant able to use controlclick as it is not capturing any visible texts, 

Please help me with some sample scripts like......finding the text & clicking on it......

Please check the below image for the reference, actually i need to click on the word "Pre Con"

image.png.7f2e5a1a370330ee27945d21b03f1b2c.png

Link to comment
Share on other sites

14 hours ago, markyrocks said:

is it in the same place every time? is there anyway that you can force it to be in the same place every time via a window move or other window manipulation?

Hi markyrocks, 

thanks for looking on this post, actually its not same place at every time, so could you please suggest any solution 

Link to comment
Share on other sites

14 hours ago, markyrocks said:

is it in the same place every time? is there anyway that you can force it to be in the same place every time via a window move or other window manipulation?

Hi FrancescoDiMuro

      i am not aware of UI Automations, could you please explain me that one..

Link to comment
Share on other sites

@Zedna

#include <ImageSearch.au3>
#include <ImageListConstants.au3>
#include <ImageSearch2015.au3>

$x1=0
$y1=0
MsgBox(0,"start","start")
do
$result = _ImageSearch("\\corp.ads\users\VDIUserDataKIDC1\x173795\Desktop\6004917_IPSF\test1.png",1,$x1,$y1,0)
until $result = 1;
if $result=1 Then
    MouseMove($x1,$y1,3)
    MouseClick("left", $x1,$y1, 1)
    WinWait("[Title:TightVNC File Transfer]", "", 10)
 else
    MsgBox(0,"MSG","End")
EndIf
EndFunc

i tried with  _ImageSearch() + MouseClick(),  it shows some error as shown below, could you please check it.....

 

"\\corp.ads\users\VDIUserDataKIDC1\x173795\Desktop\SNET Reports fetch tool.au3" (18) : ==> "Func" statement has no matching "EndFunc".:
EndFunc

>Exit code: 1    Time: 0.7089

  

Link to comment
Share on other sites

2 hours ago, amb2301 said:

@Zedna

#include <ImageSearch.au3>
#include <ImageListConstants.au3>
#include <ImageSearch2015.au3>

$x1=0
$y1=0
MsgBox(0,"start","start")
do
$result = _ImageSearch("\\corp.ads\users\VDIUserDataKIDC1\x173795\Desktop\6004917_IPSF\test1.png",1,$x1,$y1,0)
until $result = 1;
if $result=1 Then
    MouseMove($x1,$y1,3)
    MouseClick("left", $x1,$y1, 1)
    WinWait("[Title:TightVNC File Transfer]", "", 10)
 else
    MsgBox(0,"MSG","End")
EndIf
EndFunc   <~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~DELETE THIS

i tried with  _ImageSearch() + MouseClick(),  it shows some error as shown below, could you please check it.....

 

"\\corp.ads\users\VDIUserDataKIDC1\x173795\Desktop\SNET Reports fetch tool.au3" (18) : ==> "Func" statement has no matching "EndFunc".:
EndFunc

>Exit code: 1    Time: 0.7089

  

When i talk about forcing it into the same position.  A trick i use to manipulate windows that i have issues with is either making sure theyre maximized so that theyre the same size and the same position everytime hence everything inside usually is too (unless stuff is just moving around the window randomly....never really ran into that issue but anything is possible).  also if the window cannot be maximized for whatever reason then i'll use winmove and put the window at the same position everytime so again in theory everything inside should be in the same position.  These things should hopefully get you one step closer.  also to use with these methods is if the button needing clicked could be in a few separate places, not random just the same couple of different spots.  I'll just use pixelgetcolor and check one pixel in a specific image in the box im trying to click (figure out whatever color that is using msgbox or consolewrites) then set up conditional statements to determine where the thing needs to  click.  It can be a real pita to do what your describing.  I've definitely been there, but i've never found a program that i couldnt get something to work.  Also a useful trick all these other techniques in mind you can also use a cursor change as an indication that it is getting ready to click on the right thing.  

Link to comment
Share on other sites

50 minutes ago, markyrocks said:

When i talk about forcing it into the same position.  A trick i use to manipulate windows that i have issues with is either making sure theyre maximized so that theyre the same size and the same position everytime hence everything inside usually is too (unless stuff is just moving around the window randomly....never really ran into that issue but anything is possible).  also if the window cannot be maximized for whatever reason then i'll use winmove and put the window at the same position everytime so again in theory everything inside should be in the same position.  These things should hopefully get you one step closer.  also to use with these methods is if the button needing clicked could be in a few separate places, not random just the same couple of different spots.  I'll just use pixelgetcolor and check one pixel in a specific image in the box im trying to click (figure out whatever color that is using msgbox or consolewrites) then set up conditional statements to determine where the thing needs to  click.  It can be a real pita to do what your describing.  I've definitely been there, but i've never found a program that i couldnt get something to work.  Also a useful trick all these other techniques in mind you can also use a cursor change as an indication that it is getting ready to click on the right thing.  

Actually the sizes are not getting changed, because its a button kind of thing in Autocad Application, even if i maximize the size of picture snipped should match with it.

so any suggestions..

Edited by amb2301
Link to comment
Share on other sites

1 hour ago, amb2301 said:

Actually the sizes are not getting changed, because its a button kind of thing in Autocad Application, even if i maximize the size of picture snipped should match with it.

so any suggestions..

Can you explain why the item you're describing isn't in the same position everytime?  Obviously by no means do I suggest abandoning the idea of using imagesearch.  I've just never had very much luck with it.  In addition to my other suggestions using a programs hotkeys is also useful.   Like it's easier to send a hotkey than it is to find a button to click on.

Also I'd like to point out that using a screenshot to capture an image and then searching the image from memory seems like a more reliable path than just searching the screen.  Obviously this is kinda a pita but I've had better results with that than just using pixelsearch or imagesearch on the screen.   

Edited by markyrocks
Link to comment
Share on other sites

1 hour ago, markyrocks said:

Can you explain why the item you're describing isn't in the same position everytime?  Obviously by no means do I suggest abandoning the idea of using imagesearch.  I've just never had very much luck with it.  In addition to my other suggestions using a programs hotkeys is also useful.   Like it's easier to send a hotkey than it is to find a button to click on.

Also I'd like to point out that using a screenshot to capture an image and then searching the image from memory seems like a more reliable path than just searching the screen.  Obviously this is kinda a pita but I've had better results with that than just using pixelsearch or imagesearch on the screen.   

As you suggested, i tried using hotkeys, its done now, Thank you so much for your help :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...