ionut Posted April 14, 2010 Posted April 14, 2010 Hello, I am trying to click on different parts of a GUI defined as values of an array. Here's my script: #include <array.au3> #include <String.au3> global $activity[6], $text $activity[0]="VoIPSipPeer1" $activity[1]="VoIPSipPeer2" $activity[2]="VoIPSipPeer3" $activity[3]="VoIPSipPeer4" $activity[4]="VoIPSipPeer5" $activity[5]="VoIPSipPeer6" Opt("WinTitleMatchMode", 2) Opt("SendKeyDelay", 500) WinActivate("IxLoad") WinWaitActive("IxLoad") ;Send("!Vd") ;sleep(5000) For $i = 0 to 5 $text=String($activity[$i]) ControlClick("IxLoad","", "[TEXT:$text]") ConsoleWrite("Text:" & $text & @CRLF) Sleep(500) Next Exit I am seeing that the value of $text variable is correct but the ControlClick function fails to click on the right area of the GUI. If I replace the $text with any of the values of my array then the command is executed properly. I have also tried enclosing the $text variable in double "" and also tried without the String function. My question: can we use variables after TEXT: in the ControlID? Any reply is welcomed. Thank you, Ionut
KaFu Posted April 14, 2010 Posted April 14, 2010 This might work... #include <array.au3> #include <String.au3> Global $activity[6], $text $activity[0] = "VoIPSipPeer1" $activity[1] = "VoIPSipPeer2" $activity[2] = "VoIPSipPeer3" $activity[3] = "VoIPSipPeer4" $activity[4] = "VoIPSipPeer5" $activity[5] = "VoIPSipPeer6" Opt("WinTitleMatchMode", 2) Opt("SendKeyDelay", 500) WinActivate("IxLoad") WinWaitActive("IxLoad") ;Send("!Vd") ;sleep(5000) For $i = 0 To UBound($activity) - 1 $text = String($activity[$i]) ControlClick("IxLoad", "", "[TEXT:" & $activity[$i] & "]") ConsoleWrite("Text:" & $text & @CRLF) Sleep(500) Next Exit OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2025-May-18) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
bo8ster Posted April 14, 2010 Posted April 14, 2010 (edited) ControlClick("IxLoad","", "[TEXT:$text]") is sending [TEXT:$text] as a string literal to the function - which will not work. Try something like: #include <array.au3> #include <String.au3> Global $activity[6], $text $activity[0] = "VoIPSipPeer1" $activity[1] = "VoIPSipPeer2" $activity[2] = "VoIPSipPeer3" $activity[3] = "VoIPSipPeer4" $activity[4] = "VoIPSipPeer5" $activity[5] = "VoIPSipPeer6" Opt("WinTitleMatchMode", 2) Opt("SendKeyDelay", 500) WinActivate("IxLoad") WinWaitActive("IxLoad") ;Send("!Vd") ;sleep(5000) For $i = 0 To 5 $text = String($activity[$i]) ControlClick("IxLoad", "", "[TEXT:" & $text & " ]") ConsoleWrite("Text:" & $text & @CRLF) Sleep(500) Next Exit Edit: KaFu just beat me to it Edited April 14, 2010 by bo8ster Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]
kaotkbliss Posted April 14, 2010 Posted April 14, 2010 (edited) ControlClick("IxLoad","", "[TEXT:"&$text&"]") *Edit* well, looks like I was beat twice Edited April 14, 2010 by kaotkbliss 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy!
ionut Posted April 14, 2010 Author Posted April 14, 2010 The script is working now superbly !!! I would like to thank each one of you for your quick reply. Best regards, Ionut
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