how to create text files with a specific name

harshal963

  • Joined: Dec 26, 2010
  • Posts: 7

Fri 12/16/2011 - 8:36

 hi! how can i do the following task?

 

1. ask the user how many text files he want to create?(suppose user enters 20)

2. then 20 txt files should be created with the following names: 1.txt,2.txt ..... till 20.txt

 

(all the files need to be empty)

 

 

And now after these 20 files are created then i run a loop from 1 to 20 and update each file with some different content that is stored in the variables based on loopindex.

 

 

 

#1

t-hex

  • Joined: Nov 13, 2011
  • Posts: 152

Sun 12/18/2011 - 13:33

  Hope this helps :)  
  Job file attached:   WA Console > File > Import Job > Select *.waj file    NOTE:  WA write action always adds/appends carriage return and line feed  while writing to a file :(    CR => 0x0D => \r  LF => 0x0A => \n    Thus can't create a null file (0 byte file) :(    Workaround:  (Use dos command instead)  e.g.: copy NUL "C:\1.txt"

create_multi_files.waj

#2

harshal963

  • Joined: Dec 26, 2010
  • Posts: 7

Mon 12/19/2011 - 15:47

 Yes, it works!!

#3
Not a member yet? Register

Copyright 2013 - Softomotive Ltd