kmaster Posted December 21, 2008 Report Share Posted December 21, 2008 Okay I have written a macro that goes online and populates a web page with information from one .csv file, but I it to open another .csv file. I am making it repeat using the ascii loop feature. Can I nest these. Can I have one ascii file begin process nested into another. I hope that make sense. Thanks Kris Quote Link to comment Share on other sites More sharing options...
stevecasper Posted December 21, 2008 Report Share Posted December 21, 2008 Okay I have written a macro that goes online and populates a web page with information from one .csv file, but I it to open another .csv file. I am making it repeat using the ascii loop feature. Can I nest these. Can I have one ascii file begin process nested into another. I hope that make sense. Thanks Kris Nesting is easy if you know the trick. Assuming I understand your question, I know the trick. And I'm willing to share. On the first ASCII Begin Process, you can designate the process to begin wherever you think it best (such as on the first line). When the second (AKA the nested process) ASCII Begin Process starts, however, you'll need to specify an integer variable (for example: %N1%). In order for this to work right, of course, you'll have to have already established a value for %N1%... for this example, let's stick with a value of 1 (to start it on the first line of your second .csv file). Before you end the nested process you need to first use the Variable Modify Integer command to increment %N1%. After which, use a Break command (from the Repeat commands menu). This will cause the nested process to end, taking you directly to the non-nested Text File End Process command. The process will now continue. The first process will move to the second line, and the nested process will move to the incremented value of %N1% (aka also the second line). For my example below, I created two .csv files in a spreadsheet, each with 3 columns and three rows. I use a Text Box Display command to test that the macro is working. Where the Display is located in my macro is where you would put the bulk of your macro (inserting the information wherever it is that you need it to go). One thing to keep in mind when dealing with nested Processes like this, however, is that when dealing with ASCII processes from a .csv you'll have to make allowances for the Text Variable receiving the information. Example, if you use %T1% to receive the information for the first .csv, then the information prior to the first comma will go into T1, the information prior to the second comma will go into T2, etc. (if you are viewing your .csv in a spreadsheet, the first column will be in T1, the second in T2, etc.). Because of this, you'll want to make sure the Text Variable receiving the information from the embedded ASCII process is a high enough Text Variable that it will be able to handle the command without over-writing the information in the first ASCII process (example: since my 001.csv is 3 columns, I have my nested process put information into %T4%, since %T1%, %T2%, and %T3% will each be receiving information from the 001.csv). Good luck! Scripting Editor Code Variable Set Integer %N1% to 1 ASCII File Begin Process: "textfileprocess001.csv" (Comma Delimited Text ) ASCII File Begin Process: "textfileprocess002.csv" (Comma Delimited Text ) Text Box Display: Example Variable Modify Integer: Inc (%N1%) Break ASCII File End Process ASCII File End Process Direct Editor Code <IVAR2:01:01:1><ADFBEG:F10:001:000001:000000:C:\Users\Steven\Documents\Macros\Macro Test Files\textfileprocess001.csv><ADFBEG:F10:004:N00001:000000:C:\Users\Steven\Documents\Macros\Macro Test Files\textfileprocess002.csv><TBOX4:T:1:CenterCenter000278000200:000:ExampleT1 = %T1% T4 = %T4% T2 = %T2% T5 = %T5% T3 = %T3% T6 = %T6%><NMVAR:08:01:0:0000001:0:0000000><BREAK><ADFEND><ADFEND> 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.