JCMCNL Posted June 22, 2006 Share Posted June 22, 2006 Hey, this is my first post on the forums so I apologize if I happen to break any rule or piece of ettiquette but here is my question. Do $Itemsfound = 0 Func Search() WinActivate("App Window") $Count = ControlListView ( "App Window", "", "SysListView321", "GetItemCount") WinActivate ("Untitled") send ("Trial: " & $Trial & " Line Count: " & $Count & "{Enter}" & "{Enter}") $Line = 0 while $Line < $Count WinActivate("App Window") if $Itemsfound < 10 Then if ControlListView ("App Window", "", "SysListView321", "GetText", $Line, 1) = "test" Then if Number(ControlListView ( "App Window", "", "SysListView321", "GetText", $Line, 2)) < 9 Then if Number (ControlListView ( "App Window", "", "SysListView321", "GetText", $Line, 2)) > 5 Then $Itemsfound =$Itemsfound + 1 WinActivate ("Untitled") Send (ControlListView ( "App Window", "", "SysListView321", "GetText", $Line, 0) & " ") Send (ControlListView ( "App Window", "", "SysListView321", "GetText", $Line, 1) & " ") Send (ControlListView ( "App Window", "", "SysListView321", "GetText", $Line, 2) &{Enter}") EndIf EndIf EndIf EndIf $Line = $Line + 1 WEnd Until $Trial = 3 Now, the code works as desired to the extent of this code. The "untitled" window is just notepad... what I want to do is have the program be able to select the line on which a given piece of information is on and double click it or open it in any way possible. Any help with this problem or any info that points me in the right direction would be greatly appreciated... and feel free ti rip apart the code, I have been using Auto It for an amazing week. lol. Thank you for your time. JCMCNL Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 22, 2006 Moderators Share Posted June 22, 2006 Wow, I must say, your explination of what you want is more confusing then the code itself. Can you re-word that differently and maybe give an actual application name? If this if for Notepad, then why are you using ControlListView? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Skruge Posted June 23, 2006 Share Posted June 23, 2006 First off, welcome to the forums. Please try to comment your code and explain the overall goal. This my interpretation of what you're trying to accomplish: Dim $Itemsfound, $Item[3] ; Try 3 times For $Trial = 1 To 3 $Itemsfound = 0 $Count = ControlListView("App Window", "", "SysListView321", "GetItemCount") ; Print Header info WinActivate("Untitled") Send("Trial: " & $Trial & " Line Count: " & $Count & "{Enter}" & "{Enter}") ; Loop through each ListView line For $Line = 0 To $Count ; Stop when 10 matches are found If $Itemsfound >= 10 Then ExitLoop ; Read the subitems of the current line For $X = 0 To 2 $Item[$X] = ControlListView("App Window", "", "SysListView321", "GetText", $Line, $X) Next ; Record the results if sub[1]="test" and sub[2] is 6, 7, or 8 If $Item[1] = "test" And $Item[2] < 9 And $Item[2] > 5 Then $Itemsfound = $Itemsfound + 1 WinActivate("Untitled") Send($Item[0] & " " & $Item[1] & " " & $Item[2] & "{Enter}") EndIf Next Next Not tested, and not 100% sure, since there were many errors with your original code. - $Trial wasn't declared, nor did its value ever change - Missing a quote on your last Send line - Use For...Next instead of While...Wend when you want to loop a specific amount of times - No need for WinActivate if you're interacting with a control directly - Don't declare functions within a loop. Func Search()? [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font] Link to comment Share on other sites More sharing options...
JCMCNL Posted June 23, 2006 Author Share Posted June 23, 2006 Sorry guys, let me have a little time and i'll clean up the code and my question. But thanks skruge for the layout of the code you posted it gave me an idea that may solve my problem. JCMCNL 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