I have a word file with text something like this:
Name:: Xyz
Address1:: Street 1
Pin:: 48429
I need to open this file read line by line. Split line on '::'. Then get the splitted elements separately.
Any help on this???
I have a word file with text something like this:
Name:: Xyz
Address1:: Street 1
Pin:: 48429
I need to open this file read line by line. Split line on '::'. Then get the splitted elements separately.
Any help on this???
define "help" - what do you have so far? If you have nothing then why do you require autoIT?
Why AutoIT, convert the doc to a text file and use VBS, tonnes of good info available on net on how to open a text file, how to find the position of a string and how to break it into separate chunks, lots & lots!
Open the file in Excel, tell it that it's delimited and the delimiter is :: or whatever. You'll then get nice tidy columns which you can do with what you please :-)
Very good idea but depends on what he wants to do with it after, but CSV is the simplest suggestion!:D
Not sure what you're commenting on but if he hasn't got a CSV file but has one with an odd layout and colon delimiters then he needs some way of getting that to CSV or something else which can be processed.
This is the kind of thing where the route you take depends on how often you need to do it. For a one off, you'll probably put in less effort than if you're doing it multiple times.
if you're familiar with grep, sed and the other Unix text processing commands then you could probably do it all with them!
Import data in Excel and use the :: as the delimiter and resave as CSV or just export the data/manipulate as needed with Excel... not rocket science... horses for courses... but, why reinvent the wheel?
As it's currently a word doc he'd need to get it into a plain text format then onto a unix box/open from a unix machine, i think my way might be a bit easier in this scenario ;-)
Thanks all..
i'm a newbie to scripting world..
The info contained in the file will be used for further processing. The file may be word or text.
I have idea with opening the word file:
$oWordApp = _WordCreate(@ScriptDir & "\File1.doc")
$oDoc = _WordDocGetCollection($oWordApp, 1)
I want to know if there is any commands to read line by line from word file and split lines on certain characters.
Else let me know if anything i can do with text file only.
Thanks in advance...
vbscript
Then have a macro that launches when its opened to check the data in the word document and split it up and put it how you want into a text file or do whatever you want with it ?Code:Set Word = CreateObject("Word.Application")
Word.Visible = TRUE
Word.Documents.Open("C:\My Path\myfile.doc")
Description of behaviors of AutoExec and AutoOpen macros in Word
Then once the macro has done everything you want just save it and quit word and that should be it ?
Short of that you would most likely need to put it into a text file as vbscript and im sure autoit can do a lot with the data if it was in a text file.