gordy.tech Posted August 30, 2020 Report Share Posted August 30, 2020 my csv file has one entry per line, 99 lines deep - i need to copy those to a spreadsheet like program - once the variables are loaded, the data will be entered one at a time then <ENTER>, then <ARROW DOWN>, then repeat - - - - i cant even get the first one to copy, all i get is %T1% Quote Link to comment Share on other sites More sharing options...
terrypin Posted August 31, 2020 Report Share Posted August 31, 2020 Please use the Code tool (<>) to show us your macro’s - Commands (right click menu) - Code (Ctrl+c) Quote Link to comment Share on other sites More sharing options...
gordy.tech Posted August 31, 2020 Author Report Share Posted August 31, 2020 <TEXT FILE BEGIN PROCESS Filename="C:\\1\\source.txt" Start_Record="1" Process_All="TRUE" Records="1" Variable="%test%"/> <MOUSE LEFT DOUBLE CLICK/> <TEXT TYPE Action="0" Text="%t1%<ENTER><ARROW DOWN>"/> <DELAY Flags="\x12" Time="250"/> <MOUSE LEFT DOUBLE CLICK/> <TEXT TYPE Action="0" Text="%t2%<ENTER><ARROW DOWN>"/> <DELAY Flags="\x12" Time="250"/> <MOUSE LEFT DOUBLE CLICK/> <TEXT TYPE Action="0" Text="%t3%<ENTER><ARROW DOWN>"/> <DELAY Flags="\x12" Time="250"/> <MOUSE LEFT DOUBLE CLICK/> <TEXT TYPE Action="0" Text="%t4%<ENTER><ARROW DOWN>"/> <DELAY Flags="\x12" Time="250"/> <MOUSE LEFT DOUBLE CLICK/> <TEXT TYPE Action="0" Text="%t5%<ENTER><ARROW DOWN>"/> <DELAY Flags="\x12" Time="250"/> <MOUSE LEFT DOUBLE CLICK/> <TEXT TYPE Action="0" Text="%t6%<ENTER><ARROW DOWN>"/> <DELAY Flags="\x12" Time="250"/> <TEXT FILE END PROCESS/> Quote Link to comment Share on other sites More sharing options...
acantor Posted August 31, 2020 Report Share Posted August 31, 2020 Maybe something like this? Text File Begin Process: C:\Test Folder\Test.txt Text Type (Simulate Keystrokes): %Line%<ENTER> Text File End Process <TEXT FILE BEGIN PROCESS Filename="C:\\Test Folder\\Test.txt" Start_Record="1" Process_All="TRUE" Records="5" Variable="%Line%"/> <TEXT TYPE Action="0" Text="%Line%<ENTER>"/> <TEXT FILE END PROCESS/> Quote Link to comment Share on other sites More sharing options...
gordy.tech Posted August 31, 2020 Author Report Share Posted August 31, 2020 THANKS, Quote Link to comment Share on other sites More sharing options...
terrypin Posted August 31, 2020 Report Share Posted August 31, 2020 I'm not confident I fully understand what you're trying to achieve, but see if the working macro below can get you started. COMMANDS // Assumes a new, blank 'spreadsheet like' file is open, with text cursor at the start of the top line. // For this demo it is the file 'C:\1\Gordy-WorkSheet..xlsx' // Now get each line of source.txt into the ARRAY variable %Line% // And copy each line into the spreadsheet. So the first variable will be %Line[1]%, followed by %Line[2]%, etc. (This would be a long-winded way to simply copy a text file into Excel, of course, but I assume you have other purposes for the variables in mind.) Variable Set Integer %x% to 1 Text File Begin Process: C:\1\source.txt Window Activate: Gordy-WorkSheet Delay: 0.2 seconds Text Type (Simulate Keystrokes): %Line[%x%]%<ENTER> Variable Modify Integer %x%: Increment Text Type (Simulate Keystrokes): <ARROW DOWN> Delay: 0.1 seconds Text File End Process CODE <COMMENT Value="Assumes a new, blank 'spreadsheet like' file is open, with text cursor at the start of the top line."/> <COMMENT Value="For this demo it is the file 'C:\\1\\Gordy-WorkSheet..xlsx'"/> <COMMENT Value="Now get each line of source.txt into the ARRAY variable %Line%"/> <COMMENT Value="And copy each line into the spreadsheet. So the first variable will be %Line[1]%, followed by %Line[2]%, etc.\r\n(This would be a long-winded way to simply copy a text file into Excel, of course, but I assume you have other purposes for the variables in mind.)"/> <VARIABLE SET INTEGER Option="\x00" Destination="%x%" Value="1"/> <TEXT FILE BEGIN PROCESS Filename="C:\\1\\source.txt" Start_Record="1" Process_All="TRUE" Records="5" Variable="%Line[%x%]%"/> <WINDOW ACTIVATE Title="Gordy-WorkSheet" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/> <DELAY Flags="\x01" Time="0.2"/> <TEXT TYPE Action="0" Text="%Line[%x%]%<ENTER>"/> <VARIABLE MODIFY INTEGER Option="\x07" Destination="%x%"/> <TEXT TYPE Action="0" Text="<ARROW DOWN>"/> <DELAY Flags="\x01" Time="0.1"/> <TEXT FILE END PROCESS/> Terry, UK Quote Link to comment Share on other sites More sharing options...
gordy.tech Posted August 31, 2020 Author Report Share Posted August 31, 2020 thanks Quote Link to comment Share on other sites More sharing options...
gordy.tech Posted September 1, 2020 Author Report Share Posted September 1, 2020 unfortunately, I cannot cut n paste directly to the end application. It is excel like, that is a grid, but the data must be entered one cell at a time and then navigate (arrow down) to the next cell. When I am manually entering the data, the sequence is 1. enter or double click 2. type data ( 4 to 6 digit number OR 8 to 16 character string) 3.enter or click ok 4. arrow down repeat Quote Link to comment Share on other sites More sharing options...
terrypin Posted September 1, 2020 Report Share Posted September 1, 2020 Sorry, but I can't really follow what you are trying to do. Where does 'cut n paste' come into it? Did you try running my macro? Did you then edit it to suit your app (instead of Excel). Maybe a series of carefully explained screenshots would make it all clearer. Quote Link to comment Share on other sites More sharing options...
gordy.tech Posted September 1, 2020 Author Report Share Posted September 1, 2020 thanks, i will try your macro next Quote Link to comment Share on other sites More sharing options...
gordy.tech Posted September 1, 2020 Author Report Share Posted September 1, 2020 here is what i get %Line[1]% %Line[2]% %Line[3]% %Line[4]% %Line[5]% %Line[6]% %Line[7]% %Line[8]% %Line[9]% %Line[10]% Quote Link to comment Share on other sites More sharing options...
terrypin Posted September 1, 2020 Report Share Posted September 1, 2020 And your code...? Quote Link to comment Share on other sites More sharing options...
gordy.tech Posted September 1, 2020 Author Report Share Posted September 1, 2020 <COMMENT Value="Assumes a new, blank 'spreadsheet like' file is open, with text cursor at the start of the top line."/> <COMMENT Value="For this demo it is the file 'C:\\1\\Gordy.xlsx'"/> <COMMENT Value="Now get each line of source.txt into the ARRAY variable %Line%"/> <COMMENT Value="And copy each line into the spreadsheet. So the first variable will be %Line[1]%, followed by %Line[2]%, etc."/> <VARIABLE SET INTEGER Option="\x00" Destination="%x%" Value="1"/> <TEXT FILE BEGIN PROCESS Filename="C:\\1\\source.txt" Start_Record="1" Process_All="TRUE" Records="5" Variable="%Line[]%"/> <WINDOW ACTIVATE Title="Gordy" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/> <DELAY Flags="\x01" Time="0.2"/> <TEXT TYPE Action="0" Text="%Line[%x%]%<ENTER>"/> <VARIABLE MODIFY INTEGER Option="\x07" Destination="%x%"/> <TEXT TYPE Action="0" Text="<ARROW DOWN>"/> <DELAY Flags="\x01" Time="0.1"/> <TEXT FILE END PROCESS/> Quote Link to comment Share on other sites More sharing options...
terrypin Posted September 1, 2020 Report Share Posted September 1, 2020 Your lines 6 and 9 are not the same as those in my macro. Read up on arrays and try the simple examples in Help. X is the ‘index’ defining the element of the array variable. When you first define the variable take care to specify that it is an array. Quote Link to comment Share on other sites More sharing options...
gordy.tech Posted September 2, 2020 Author Report Share Posted September 2, 2020 thanks, i got it to work Quote Link to comment Share on other sites More sharing options...
terrypin Posted September 3, 2020 Report Share Posted September 3, 2020 Well done, pleased to hear it! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.