Sign in to follow this  
Followers 0
Guest Olli

Alter Text In File

5 posts in this topic

Hi Guys,

i started some work with AutoIt and so far it works good for me. But now i have a liitle question.

I'd like to take a text file, go to a desired postion, enter some text and save the new file under a new name. So how can i do this with AutoIOv3??

Maybe there exists a quite simple way, but i'm a newbie and don't know how, so please help me. ;-)

Best regards,

Olli

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Or do you have the freedom to indicate the desired position via a token of some sort? Eg ..

The quick brown fox jumps @target the lazy dog

.. and then you can replace "@target" with "Rover," ... ?

EDIT: oops, sorry Larry - I see you got that base covered already :whistle:

Edited by trids

Share this post


Link to post
Share on other sites

Hi Guys,

thanks for the fast answer. Actually i'm free about how i'll insert my text. One solution would be a a keyword like @target, but it would also be possible to split the hardcoded text in different parts and the variable text would be merge between both parts into a third file, but i think the first way would be the finest. So if you have any ideas or documentation where you could point me, i would be happy. :-))

Best regards,

Olli

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

aye, for this example, we shall split each word up (by space) off he top of my head.

$file="text.txt"
$text=fileread($file,FileGetSize($file))
$text=Stringreplace($text,@cr," "&@cr); to compensate for lines.
$text=Stringreplace($text,@lf,@lf&" "); to compensate for lines.

$words=Stringsplit($text," ")
for $i=1 to $words[0] 
tooltip($words[$i],0,0) 
if $words[$i]<>"" then sleep(500); display each word for half a second. You can do whatever.
next
Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

Hi Scriptkiddy,

thanks for the support. I'll take it and do with it 'whatever i want'. :D

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0