[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: A question



On Wed, 17 Jun 1998 06:57:30 -0400, "James D. Besser"
 wrote:

>Hey power-XYers, I have a question.
>I am in the process of turning old XYwrite files into AskSam data base
>files for easy
>retrieval. It's working fine, but AskSam doesn't retain the file name.
>
>Hence my question: is there an XPL routine I can do to take each XyWrite
>file
>and enter the filename at the beginning of the file itself, so it will show
>up when
>I move it over into AskSam?
>
>I could do this manually, of course, but there are over 6000 files, and I
>already have
>a fulltime job.

The VA $FI command (VAlue FIlename) inserts the filename into the
document. If all the files are in one directory, I would use this
quick and dirty XPL routine:

≪LB loop≫BC call
≪IF≪ER≫≫≪EX≫
≪EI≫BC va $fi

BC save
BC abort
CD ≪GL loop≫

Save this as prog.pm (or whatever). Get a dir listing of the files you
want to modify. Then do F5 run prog.pm (don't press ENTER), press F10,
position the cursor on the first file in the list, and press F9 to
execute the command line (start the program running).

Each document will end up with its own filename on a separate line at
the beginning of the file. This routine is dumb - it opens all files
in turn until an error occurs (i.e. it can't open any more files). It
will try to change *all* files, so don't run it if there are any
binary files in the directory. If the files you want to change are,
e.g., *.txt, then do "dir *.txt" to get the file listing. Make a
backup of the files first of course.

If the files are stored in different directories, we can have a go at
accommodating that as well.

--
James    _  To mail me, spell "nomed" in my address backwards
Eibisch,  ('v')
'Ivan'   (,_,)    N : E : T : A : D : E : L : I : C : A
on FIBS. =======     http://www.revolver.demon.co.uk