strider3700 Posted September 3, 2014 Share Posted September 3, 2014 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. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted September 4, 2014 Moderators Share Posted September 4, 2014 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? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
strider3700 Posted September 4, 2014 Author Share Posted September 4, 2014 (edited) 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 September 4, 2014 by strider3700 Link to comment Share on other sites More sharing options...
232showtime Posted September 4, 2014 Share Posted September 4, 2014 where is your code??? ill get to that... i still need to learn and understand a lot of codes Correct answer, learn to walk before you take on that marathon. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted September 4, 2014 Moderators Share Posted September 4, 2014 (edited) 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 September 4, 2014 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Bert Posted September 4, 2014 Share Posted September 4, 2014 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. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Bert Posted September 4, 2014 Share Posted September 4, 2014 (edited) Why do I think this thread will need the Jos© 2x4? Edited September 4, 2014 by MBALZESHARI The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
strider3700 Posted September 4, 2014 Author Share Posted September 4, 2014 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. Link to comment Share on other sites More sharing options...
bogQ Posted September 4, 2014 Share Posted September 4, 2014 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 connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) 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. Link to comment Share on other sites More sharing options...
strider3700 Posted September 4, 2014 Author Share Posted September 4, 2014 (edited) 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 September 4, 2014 by strider3700 Link to comment Share on other sites More sharing options...
Bert Posted September 4, 2014 Share Posted September 4, 2014 what happens when you use the macro recorder? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
strider3700 Posted September 4, 2014 Author Share Posted September 4, 2014 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. Link to comment Share on other sites More sharing options...
Solution bogQ Posted September 4, 2014 Solution Share Posted September 4, 2014 (edited) putWinWaitActive after WinActivate and some sleep 1 second or somethingtry 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 September 4, 2014 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) 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. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 4, 2014 Moderators Share Posted September 4, 2014 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
strider3700 Posted September 4, 2014 Author Share Posted September 4, 2014 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? Link to comment Share on other sites More sharing options...
bogQ Posted September 4, 2014 Share Posted September 4, 2014 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 connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) 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. Link to comment Share on other sites More sharing options...
strider3700 Posted September 4, 2014 Author Share Posted September 4, 2014 Either I don't have permission to send PM's or I'm not finding where to do it. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 4, 2014 Moderators Share Posted September 4, 2014 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 4, 2014 Moderators Share Posted September 4, 2014 strider3700,Thanks for the PM. All,I am happy this thread is legitimate so help away! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
strider3700 Posted September 4, 2014 Author Share Posted September 4, 2014 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now