Jump to content
Sign in to follow this  
PBear

How to read a file into a SplashText box?

Recommended Posts

PBear

I searched through the forums last night and found two messages asking the same basic question, but neither had any replies [tsk tsk :rolleyes: ].

How do you read the contents of a file into a SplashText box? I've tried for hours, with embedding FileReadLine and SplashTextOn/ControlSetText in all different combinations of For ... Next and While ... Wend, but the best restult I can get is to display each line, as it's read in from the file, at the top of the SplashText box - where it always replaces the previous line.

I tried using _FileReadToArray also, but all that got me was zeros displayed!

I want to read in a simple, short file and have each new line display below the one before it, i.e., just read the whole file into the box as a text block.

If anyone could help, I'd be grateful.

Thanks.

Share this post


Link to post
Share on other sites
killaz219

Is this what you want?

$file = "file.txt"
$chars = FileRead($file, FileGetSize($file))
SplashTextOn ("whateveryouwant", $chars)

While 1
   sleep(1)
  ;just so the splash stays up
WEnd

Share this post


Link to post
Share on other sites
PBear

Is this what you want?

That's exactly what I want. (I'm embarassed how simple it was - I just didn't pick up on how to use of the FileGetSize() function to circumvent FileRead() needing to read each character in at a time, thinking FileReadLine() was the biggest chunk I could get.)

Thanks a bunch.

[Normeus: Thank you, too, for your add'l help. I don't want scrolling text for this particular project, but I will download the code and keep it around for future use.]

Edited by PBear

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.