Jump to content
Macro Express Forums

just need a simple csv file process to a special spreadsheet type program


Recommended Posts

<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/>
 

Link to comment
Share on other sites

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/>

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.
 

 

Link to comment
Share on other sites

<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/>
 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...