WinAutomation - windows automation software with macro recorder
      3 replies [Last post]
      tonywinauto
      User offline. Last seen 2 weeks 4 days ago. Offline
      Joined: 04/12/2010
      Posts: 12

      The attached waj will take a file with comma separated content in the following format:

      textA1,textB1,textC1

      textA2,textB2,textC2

      textA3,textB3,textC3

      and output the data, from between the commas, one chunk at a time i.e.

      textA1 then ..

      textB1 then ..

      textC1 etc ..

      textA2 

      textB2 

      textC2 

      textA3 

      textB3 

      textC3 

      It will work for any number of rows, and any number of data items per row in your file.

      The file name is hard-coded.

      Can anyone improve it?

      Tony

      AttachmentSize
      Split csv rows into data chunks.waj15 KB
      f1234k
      User offline. Last seen 17 weeks 3 days ago. Offline
      Joined: 04/28/2010
      Posts: 7
      Re: Simple CSV file processor

       What improvements would you like to see implemented exactly? If you can describe the desired functionality, we will be able to provide you with a sample job. For example, would you like to be prompted by the job to select the file? 

      tonywinauto
      User offline. Last seen 2 weeks 4 days ago. Offline
      Joined: 04/12/2010
      Posts: 12
      Re: Simple CSV file processor

      f1234k wrote:

       What improvements would you like to see implemented exactly? If you can describe the desired functionality, we will be able to provide you with a sample job. For example, would you like to be prompted by the job to select the file? 

      Actually I'm happy with this little script and will use it as the basis of other projects.  Just wondered if anyone had any further suggestions.

      I would not want to have to pick files manually because I want to run everything fully on autopilot.

      ---

      I have thought of an enhancement.  Imagine I was using the data to open a number of websites and each row contained this data:

      url,username,password,some-text-to-paste

      My script would work if the data stayed like that, four 'columns'.  But if I added an extra column in one of the rows it would stop working.  Is there a way to know when I have come to the end of a record?  Or when I start a new record?

       

      Tony 

       

       

       

      f1234k
      User offline. Last seen 17 weeks 3 days ago. Offline
      Joined: 04/28/2010
      Posts: 7
      Re: Simple CSV file processor

       

      Quote:
      I would not want to have to pick files manually because I want to run everything fully on autopilot.

      There are multiple ways to do that:
      - You can create a "File Monitor Trigger" that will monitor the creation of csv files in a specific folder
      - You can use the "Keyboard Monitor Trigger" to start the job with a hotkey and then get all the csv files from inside your job and manipulate them. 

      Quote:
      My script would work if the data stayed like that, four 'columns'.  But if I added an extra column in one of the rows it would stop working.  Is there a way to know when I have come to the end of a record?  Or when I start a new record?

      The script should not stop working if you add an extra column. Since you are using a "For Each" action to loop through the items that are retrieved with the "Split Text" action, if you add another column, the item of this column will also be separated with a comma character. This practically means that the job should work for any number of rows and any number of columns (as long as the csv file is properly structured of course).