BatMan22 Posted March 8, 2018 Share Posted March 8, 2018 Hey guys.. I'm trying to figure out the logic of my loop and I'm changing the values and in my head it makes sense but my program isn't doing what I need it to do. So the idea is this... Copy a value from a cell, save in array, send down key, and repeat until either the clipboard doesn't copy anything or until it copies duplicate data. ;~ BatchFixer #include <Array.au3> WinWait("Sample Selection Box") WinActivate("Sample Selection Box") Sleep(500) Global $var[1]= ["SampleID's"] $counter = 1 While $var[$counter-1] <> "" ;OR $var[$counter] <> $var[$counter-1] Send("^c") Send("{Down}") $var[$counter-1] = ClipGet() ConsoleWrite("Var is: " & $var[$counter-1] & " this cycle." & "Counter is:" & $counter & @CRLF) $counter = $counter + 1 ReDim $var[UBound($var) + 1] WEnd _ArrayDisplay($var, "Total Copied From Available") Link to comment Share on other sites More sharing options...
Subz Posted March 8, 2018 Share Posted March 8, 2018 Couple of examples: expandcollapse popup#include <Array.au3> _Example1() MsgBox(32, "Reset Selection", "Reset Selection for Example 2") _Example2() Exit Func _Example1() Local $sClip WinWait("Sample Selection Box") WinActivate("Sample Selection Box") Sleep(250) Local $aArray[1]= ["SampleID's"] Local $i = 1 While 1 Send("^c") Send("{Down}") Sleep(250) $sClip = StringStripWS(ClipGet(), 7) If StringStripWS($sClip, 8) = "" Then ExitLoop Else ReDim $aArray[UBound($aArray) + 1] $i += 1 $aArray[$i-1] = $sClip EndIf ConsoleWrite("Var is: " & $aArray[$i-1] & " this cycle." & "Counter is:" & $i - 1 & @CRLF) WEnd _ArrayDisplay($aArray, "Total Copied From Available") EndFunc Func _Example2() Local $sClip WinWait("Sample Selection Box") WinActivate("Sample Selection Box") Sleep(250) Local $aArray[1]= ["SampleID's"] Local $i = 0 Do Send("^c") Send("{Down}") Sleep(100) $sClip = StringStripWS(ClipGet(), 7) If StringStripWS($sClip, 8) <> "" Then ReDim $aArray[UBound($aArray) + 1] $i += 1 $aArray[$i] = $sClip EndIf ConsoleWrite("Var is: " & $aArray[$i] & " this cycle." & "Counter is:" & $i & @CRLF) Until StringStripWS($sClip, 8) = "" _ArrayDisplay($aArray, "Total Copied From Available") EndFunc BatMan22 1 Link to comment Share on other sites More sharing options...
Zedna Posted March 8, 2018 Share Posted March 8, 2018 Look here how to monitor ClipBoard changes and call your code only at changes: BatMan22 1 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
BatMan22 Posted March 8, 2018 Author Share Posted March 8, 2018 Thank you both, you guys replied while I was asleep. I’ll check it out more in detail when I get to work. Thanks guys. 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