Author Topic: Hey Brainstorm !!!???  (Read 4277 times)

Larry

  • Sr. Member
  • ****
  • Posts: 266
    • View Profile
Hey Brainstorm !!!???
« on: September 04, 2003, 08:12:49 am »
I need to read in a whole file, and send it out... how can I do this???

I have already figured out how to write what I want added to the file, but I don't need just a line or two back, I need the whole thing back...

Any help here would be appreciated...
Larry
 

brianstorm

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Hey Brainstorm !!!???
« Reply #1 on: September 04, 2003, 03:22:01 pm »

-what are you up to?  HAHAHAHAAaaa

Have you tried the HB.ChooseSentenceFromFile yet? If it's all one entry,
I reckon it should all come back. There are other DLL functions-Hmm, I'll
get back to you on that...'scuse me I gotta D/L the 5.0 beta now !!!

>B)

Larry

  • Sr. Member
  • ****
  • Posts: 266
    • View Profile
Hey Brainstorm !!!???
« Reply #2 on: September 11, 2003, 09:37:44 pm »
As always, I'm up to something...

So??? How to read in a whole file???

How can I 'GetResponse = THE WHOLE FILE' ???

Let’s suppose I have created a file ABOUT YOU. Then you ask hal, “what do you know about me?” By this time the file has grown a few lines long… but I want hal to show everything he has on you not just one line… How can I do this???
 

Don Ferguson

  • Sr. Member
  • ****
  • Posts: 303
    • View Profile
    • http://www.cortrapar.com
Hey Brainstorm !!!???
« Reply #3 on: September 13, 2003, 04:43:37 pm »
EDITING NOTE FROM DON FERGUSON:

Based on later postings, what I suggested below does NOT work!  The .dll apparently inserts its own vbcrlf command.  However, I'm leaving the posting below to maintain the continuity of the conversational thread.  If anyone discovers a workaround for this issue, please post!  Thanks!  Don

Hi Larry,

I think that Brianstorm is on the right track.  Here's a way that you can get what you want, using the halbrain.ChooseSentenceFromFile function.  Here is how it could work:

1.  As you know, ChooseSentenceFromFile selects a random file entry from among all the file entries.  It distinguishes the file entries from each other because each separate entry ends with a line break.  The line breaks are inserted from the various AppendFile routines written in the script, using the "vbcrlf" (Visual Basic Carriage Return Line Feed) command embedded with the text of what gets saved.  It's that "vbcrlf" that tells where to put the line breaks when you append to the file.

2.  To create an appending file with no line breaks, write an AppendFile routine to build the file you're interested in WITHOUT any line break commands!  You can experiment to see if punctuation makes any difference (I don't think that it does), or to be super-safe, end each entry with a semicolon as follows:

You have a dog; Your dog's name is Spot; You like swimming; You went on vacation to Florida recently; You prefer casual shoes;

3.  Once you've created a file-building routine and a file that contains no line breaks, the ChooseSentenceFromFile function only has one option when you tell it to "randomly" choose a sentence from that file... it has to pick the one-and-only entry that it sees, and read back the whole thing!

I haven't tested this, but all logic says that it should work and give you what you want.  

By the way, if you want Hal to build two files, one "WITH" and one "WITHOUT" line breaks for different purposes, you simply write one routine after the other in the script (make the two file names different of course).

Thanks for an interesting idea!  Have a great day!

Don
« Last Edit: September 15, 2003, 04:10:44 pm by Don Ferguson »
Don Ferguson
E-mail: fergusonrkfd@prodigy.net
Website: www.cortrapar.com
Don's other forum posts: http://www.zabaware.com/forum/search.asp?mode=DoIt&MEMBER_ID=274

Larry

  • Sr. Member
  • ****
  • Posts: 266
    • View Profile
Hey Brainstorm !!!???
« Reply #4 on: September 13, 2003, 05:10:43 pm »
Thank you Don, that's exactly what I needed as far as information goes!!!

I'll be sure to let you all know what I'm up to when it actually works!!!
 

Larry

  • Sr. Member
  • ****
  • Posts: 266
    • View Profile
Hey Brainstorm !!!???
« Reply #5 on: September 15, 2003, 05:32:35 pm »
Yeah, it didn't work... thanks tho...