jack71 Posted July 24, 2014 Share Posted July 24, 2014 I find it interesting that ControlClick can find the Control I want and click it, but ControlGetText can't use the ControlID to get the text that I need for my script...argh... What are my options besides going through 30 machines to see what other variances of ClassnameNN there are? Link to comment Share on other sites More sharing options...
careca Posted July 24, 2014 Share Posted July 24, 2014 The other option is showing us the code, so we can try to spot any error that might be. Best regards Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
junkew Posted July 24, 2014 Share Posted July 24, 2014 See example section iuiautomation thread if that can help FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
jack71 Posted July 24, 2014 Author Share Posted July 24, 2014 The other option is showing us the code, so we can try to spot any error that might be. Best regards Here's the part that pertains to my problem: Global $recordstatus Global $mWindow = WinGetTitle("[REGEXPCLASS:Afx:00400000:b:00010003:00000006:.]") ; get dynamic window title $recordstatus = ControlGetText($mWindow, "", 11301) ; find out if the program is running or if it is stopped. There's a gui button that reads either "Start" or "Stop" depending on if it is actively recording or not. The control ID for the button is 11301. If $recordstatus = "stop", this means that the program is actively recording and it is OK to continue stopping/restarting the recording. If $recordstatus = "start" that means the program is not actively recording and we don't need to stop anything, just exit. Later on in the script where I have it stop/start the recording: WinActivate($mWindow) ControlFocus($mWindow, "Stop", 11301) ControlClick($mWindow, "Stop", 11301) The above works fine, it clicks on the stop button. Then latter I have it start it back up with the same ControlID which is not dynamic. It stays the same no matter what. Here's my code prior to me finding out that the ClassnameNN isn't always the same on all 30 machines: $RecordStatus = ControlGetText($mWindow, "", "Button61"). This will get me the text "Start" or "Stop" depending on what's going on with the recording, if the ClassnameNN is Button61. Link to comment Share on other sites More sharing options...
careca Posted July 24, 2014 Share Posted July 24, 2014 I probably missed something, so the code works, and the controlid is static, but if you use the id, you don't get the text? How can i reproduce? Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
jack71 Posted July 24, 2014 Author Share Posted July 24, 2014 The code works, meaning controlgettext returns the values I need ONLY if I use the ClassnameNN of the button, and not the ControlID of the button! This would be fine if the classnameNN was static, but it isn't it is dynamic across the 30 machines this code would be used. Link to comment Share on other sites More sharing options...
careca Posted July 24, 2014 Share Posted July 24, 2014 (edited) Understood, sorry, i can't help you, can't think of any solution.. maybe, as a last resort.. pixelsearch, search for a specific shade of the button in the two states, or in a specific coordinate, for example, search for black in a small rectangle, where the start word covers, but not the stop, or the other way around, know what i mean? Edit: typo Edited July 24, 2014 by careca Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
jack71 Posted July 25, 2014 Author Share Posted July 25, 2014 Is there anyway to search for the text "Start" or "Stop" which is the only two options for that button and the only place "Start" or "stop" would show up on the window and somehow grab the control handle or get the classnamenn? Link to comment Share on other sites More sharing options...
jack71 Posted July 25, 2014 Author Share Posted July 25, 2014 Ok so maybe I can loop through an array of numbers, 0-100 until controlgettext gives a result of "stop" or "start" otherwise next. I'm just not sure how to code a standalone array. ex: While 1 For $i = 0 to 100 $ButtonArray[x] = 0 - 100 (How do I assign an array the values 0-100?) $recstatusresult = ControlGetText($mWindow, "", $ButtonArray[x]) If $recstatresult = Start or If $recstatresult = Stop then $recordstatus = $recstatresult[$i] Else Next Endif Need a little help here... Thanks Link to comment Share on other sites More sharing options...
careca Posted July 25, 2014 Share Posted July 25, 2014 Good idea, from what i understood, you want to go through a range of id's? Local $mWindow, $Buttons, $recstatresult While 1 For $Buttons = 40 to 300 ;Or whatever the ID range you want to search for ConsoleWrite('$Buttons '& $Buttons &@CRLF) $recstatusresult = ControlGetText($mWindow, "", $Buttons) If $recstatresult = 'Start' or $recstatresult = 'Stop' then $recordstatus = $Buttons Endif If $Buttons = 300 Then Exit Next WEnd Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
jack71 Posted July 25, 2014 Author Share Posted July 25, 2014 (edited) Good idea, from what i understood, you want to go through a range of id's? Local $mWindow, $Buttons, $recstatresult While 1 For $Buttons = 40 to 300 ;Or whatever the ID range you want to search for ConsoleWrite('$Buttons '& $Buttons &@CRLF) $recstatusresult = ControlGetText($mWindow, "", $Buttons) If $recstatresult = 'Start' or $recstatresult = 'Stop' then $recordstatus = $Buttons Endif If $Buttons = 300 Then Exit Next WEnd Yes a simple for loop. Durr....man I'm dumb sometimes hah. I changed yours up a little bit, going to try it later tonight: Func FindClassNN() Local $x, $recstatresult While 1 For $x = 0 to 300 $recstatusresult = ControlGetText($mWindow, "", "Button" & $x) ; ClassnameNN is always "ButtonXX" If $recstatresult = "Start" or $recstatresult = "Stop" Then $recordstatus = "Button" & $x ExitLoop ElseIf $x = 300 Then msgbox(0, "Ooops", "Button ClassnameNN is outside of range!") ; For debugging purposes ExitLoop Endif Next WEnd EndFunc Edited July 25, 2014 by jack71 Link to comment Share on other sites More sharing options...
careca Posted July 25, 2014 Share Posted July 25, 2014 We're here if you need help. Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe 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