InsaneArturo Posted July 6, 2010 Share Posted July 6, 2010 Hello I have a problem using variables in ControlClick() I want to read some info from ini file and then use it in ControlClick() but it doesn't click the button. It works perfect when I use pure text. Example: ControlClick("Some title", "window text or button text", controlid) this doesn't work: ControlClick($var1, $var2, $var3) Please help me Link to comment Share on other sites More sharing options...
Yoriz Posted July 6, 2010 Share Posted July 6, 2010 Hi, welcome to the forum. That should work using variables , maybe your variables dont contain what you think they do check by outputing them in a message box, compare them to a string you think you should be getting something like this. $var1 = "Some title" $var2 = "window text or button text" $var3 = "controlid" MsgBox(0, "", "Some title" & "-" & "window text or button text" & "-" & "controlid" & @CR & _ $var1 & "-" & $var2 & "-" & $var3) GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF. Link to comment Share on other sites More sharing options...
InsaneArturo Posted July 7, 2010 Author Share Posted July 7, 2010 Hi, welcome to the forum. That should work using variables , maybe your variables dont contain what you think they do check by outputing them in a message box, compare them to a string you think you should be getting something like this. $var1 = "Some title" $var2 = "window text or button text" $var3 = "controlid" MsgBox(0, "", "Some title" & "-" & "window text or button text" & "-" & "controlid" & @CR & _ $var1 & "-" & $var2 & "-" & $var3) Hi, thank you for your fast answer. I tried that. Data in variable and string look the same, but somehow they're not the same, cause it doesn't work with variables. $Step = IniReadSection ( "filename.ini", "Step 0") $Title = $Step[1][1] ;I method $Control = $Step[2][1] $Id = $Step[3][1] ;$Title = IniRead("filename.ini", "Step 0", "Title", 0) ;II method ;$Control = IniRead("filename.ini", "Step 0", "Control", 0) ;$Id = IniRead("filename.ini", "Step 0", "Id", 0) ;$Title = "'window title'" ; III method ;$Control = "'Dalej >'" ;$Id = 1 MsgBox(0, "dfbfdb", string($Title) & $Control & $Id & @CRLF & "'window title''Dalej >'1") ControlClick ( $Title, $Control, $Id ) Non of those 3 methodes work I can understand that there can be a problem with string in variable but why this doesn't work? $ctrl = ControlClick ( "window title", "Dalej >", $Id ) MsgBox(0,"sdg",$ctrl) where $Id=1 as it should be Maybe there's a diffrent way to click a button? (i don't want to use cords) Link to comment Share on other sites More sharing options...
InsaneArturo Posted July 7, 2010 Author Share Posted July 7, 2010 (edited) I can't edit above post Ok I found solution on this threat http://www.autoitscript.com/forum/index.php?showtopic=113055&st=0&p=791507&hl=controlclick%20variables&fromsearch=1&#entry791507 It works perfect with this code: $Step = IniReadSection ( "filename.ini", "Step 0") $Title = $Step[1][1] $Control = $Step[2][1] $Id = $Step[3][1] $Id = Number ( $Id ) ControlClick(""&$Title&"", ""&$Control&"", $Id) So my problem is solved Thanks for your help Yoriz! Edited July 7, 2010 by InsaneArturo 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