Jump to content
Sign in to follow this  
strider3700

trying to click a button not working (2 different issues)

Recommended Posts

strider3700

I'm trying to write a script to automate a test.  Basically after entering some info I need to click the save button. Usually this is trivial just use something like controlclick("window title","","[NAME:ButtonName]") windows title of course changes but I tend to rename the windows and just pass the name around as $title, I never have used the text field it doesn't seem to matter, and the button name comes from window info.

On a couple of my programs it doesn't however work.

First in 1 of the programs in the window there are multiple panels. there is a NAME:Button1 on each of those panels. sending the control click to that name is clicking the wrong button1. I can't figure out how to uniquely identify the first one. I've tried instance:17 which comes back from the window info tool but nothing happens then. I tried throwing the CLASS:.... in but same thing nothing happens. 

In the other instance of not being able to click/read a button the window has a tabpanel. The button isn't on the tab and I can click it and read it's text just fine. But after entering text into fields on the tab the click to the button no longer works. I also can't read it's text.  Again I can't figure out how to specify that button.    I've got around this for saving by setting the cursor to a field then blindly throwing {TAB} at it until the focus returns to that button then send {ENTER}  but the buttons functionality changes depending on the state of the program and I need to read the text on it to know what state we're in.

Any suggestions?  I'm assuming there is a better way to uniquely identify these buttons and I'm just not seeing it.

 

Share this post


Link to post
Share on other sites
JLogan3o13

Can you please show the AutoIt Window Info Tool output for those controls, and possible a screenshot, so we can see what you're seeing?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
strider3700

Can you please show the AutoIt Window Info Tool output for those controls, and possible a screenshot, so we can see what you're seeing?

Hmm I can't show a screenshot of the program but can probably mock up something similar.   I can however show the info tool controls I'll whip that up as soon as I can

 

'>

'>

That's the window and the control tabs of the info tool for the case where clicking on the textboxes on the lables means I can't see the controls not on the tab.

'>

'>

'>

'>

And those are the buttons where there is two of them both with name button1 in the same window but on separate panels.  The top two are the button I'm trying to click when I say controlclick NAME:button1 and the bottom 2 are the ones that actually click when I do that. 

Edited by strider3700

Share this post


Link to post
Share on other sites
232showtime

where is your code???


ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Share this post


Link to post
Share on other sites
JLogan3o13

I am always curious when someone asks for help on an application, but can't tell you the name - or blocks it out entirely. I have worked in a number of corporate environments, with a number of different proprietary applications, and would ask what (short of some DOD tool) would you need to obfuscate to the point where we cannot be allowed to see the name?

Seems counterintuitive to me - "I want your help but am unwilling to provide you with any information..."

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Bert

Hmm I can't show a screenshot of the program ...

 

Why? It is a simple holding down the alt key and pressing the printscreen button to take a screenshot of the window in question. If you do Ctrl+printscreen it does this with everything displayed on your screen in a screenshot. Paste what is on the clipboard to the windows>paint app and save it as a jpg. You can then show us a screenshot.

Share this post


Link to post
Share on other sites
strider3700

The reason I can't release a screenshot is pretty simple.   Company policy says I can't without permission and that's likely to take a few weeks assuming I get it at all.  Personally I believe it's a stupid rule but it's the rule and I happen to like getting paid so I won't be breaking it.    If screen shots to recreate the issue are necessary then I'll make a mockup that recreates the issue. 

Share this post


Link to post
Share on other sites
bogQ

While i dont like that you did not post your reason for not releasing what have you try so far in code form, my suggestionm is try to use ClassnameNN and i hardly think youl get more help than this if you dont post something that can replicate problem...


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
strider3700

Here's a screen shot of a mockup of the tab program.   '>

Basically the program starts and the textboxes on the tab are all inactive.  The user clicks the button and the textboxes become active with focus changing to the first text box.   After doing that however Auto it doesn't ever seem able to click the button again.

All that I'm trying to do is when focus is on the textbox is 

controlclick("Form1,"","[NAME:Button1]")   

Edited by strider3700

Share this post


Link to post
Share on other sites
strider3700

While i dont like that you did not post your reason for not releasing what have you try so far in code form, my suggestionm is try to use ClassnameNN and i hardly think youl get more help than this if you dont post something that can replicate problem...

 

I tried 

WinActivate($title)

ControlClick($title,"","[ClassnameNN:WindowsForms10.BUTTON.app.0.3598b65_r13_ad18]")
 
The window activates, but the button click doesn't happen.
 
macro recorder just records mouseclick("left",259,44,1)   but the click did work.     Unfortunately because the window opens in different locations on screen and can't be full screened to force consistent layout blind clicking at a coordinate won't work. 

Share this post


Link to post
Share on other sites
bogQ

put

WinWaitActive after WinActivate and some sleep 1 second or something

try ControlFocus and check do correct control got the focus with ControlGetFocus if that part worked do a ControlSend {space} instead of ControlClick, if it did not worked tell us what ControlGetFocus returned

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
Melba23

strider3700,

Please PM me and at least let me know the name of your company and roughly what the app is intended to do. Otherwise I am locking the thread - if you will not give is any info to work on other than a mockup of a screen there is no point in continuing. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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
strider3700

ok that worked but seems really weird.  The script had been working in the same window for a bunch of commands  already but adding a winActivate, winwaitactive and a sleep(1000) made the controlclick work.    Does working on a tab take the window that the tab is on out of being the active one somehow?  

Share this post


Link to post
Share on other sites
bogQ

Please, do what Melba23 requested first, if he say its ok im shure someone will continue conversation with you.


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
strider3700

Either I don't have permission to send PM's or I'm not finding where to do it. 

Share this post


Link to post
Share on other sites
Melba23

strider3700,

I have just sent you a PM so all you need to do is reply. You open the PM page via the drop-down next to your username at top right. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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
Melba23

strider3700,

Thanks for the PM. :)

All,

I am happy this thread is legitimate so help away! :thumbsup:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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
strider3700

Thanks Melba,

So at this point I've added the winactivate, winwaitactive, sleep(100) and controlclick is working on the second issue.  I can't explain why it is any different but to be honest I don't overly care so long as it works. 

For the first issue where the window has two buttons both that have the same name I'll try the ClassnameNN and see what happens.   I'm not sure how the programmers even got that to happen as Vstudio complains if I attempt to add the same named button to the same form. I thought it had to do with panels but that makes no diffence. 

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  

×