AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

word document

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
nobody
Guest





PostPosted: Thu Mar 18, 2010 8:53 am    Post subject: word document Reply with quote

Hi ppl..
I am trying to solve write a text fle to a word doc. But seems like my program can't work. Is not writing into the doc file though i have tried the following code:

Code:

fileread,data,%A_ScriptDir%/data.txt
Loop, parse, data, `,
{
        read= %A_loopfield%
        FileAppend,%read%,%A_ScriptDir%/transfer.doc
}


the following is the format of my data.txt:
blue,Medium,32,red,large,33
it is seperated by the comma.
As of now it can read the text file seperated by the comma but is not wring into the doc file.

I am using fileappend to write to the doc file. Is it correct?
appreciate the help here.
Back to top
SoLong&Thx4AllTheFish



Joined: 27 May 2007
Posts: 4999

PostPosted: Thu Mar 18, 2010 9:33 am    Post subject: Reply with quote

use \ not / it isn't linux/unix or website you're working on.
_________________
AHK Wiki FAQ
TF : Text files & strings lib, TF Forum
Back to top
View user's profile Send private message
Leef_me



Joined: 08 Apr 2009
Posts: 5336
Location: San Diego, California

PostPosted: Thu Mar 18, 2010 9:42 am    Post subject: Reply with quote

Did you know that Word 'doc' files are not just text? Word adds a lot of formatting.

Your script seems to work for me:

data.txt wrote:
blue,Medium,32,red,large,33
transfer.txt wrote:
blueMedium32redlarge33

I'd probably prefer the results on separate lines by adding `n

Code:
FileAppend,`n%read%,%A_ScriptDir%/transfer2.txt

transfer2.txt wrote:

blue
Medium
32
red
large
33
Back to top
View user's profile Send private message
nobody
Guest





PostPosted: Fri Mar 19, 2010 12:42 am    Post subject: Reply with quote

Hi Leef_me
Thanks for your help.
But is there a way for me to input the text in the text file to MS word?
Seems like it works only for text format using my script..

I need it in word format...
Need your advice..
thanks!
Back to top
jaco0646



Joined: 07 Oct 2006
Posts: 3113
Location: MN, USA

PostPosted: Fri Mar 19, 2010 1:09 am    Post subject: Reply with quote

MS Office Automation Functions (via COM) [thanks Sean]
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group