Author Topic: append file (HELP)  (Read 3091 times)

mikmoth

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
    • http://karigirl.com
append file (HELP)
« on: July 02, 2004, 01:24:17 pm »
So I'm trying to have Hal append some text to a file...

The problem is I'm doing a TopicSearch on it first so the file is "open".

When I try to append to the same file it wont let me because the file is "open".

How can I close the file? Any tips?

Mikmoth
 

Bill819

  • Hero Member
  • *****
  • Posts: 1483
    • View Profile
append file (HELP)
« Reply #1 on: July 02, 2004, 04:30:47 pm »
quote:
Originally posted by mikmoth

So I'm trying to have Hal append some text to a file...

The problem is I'm doing a TopicSearch on it first so the file is "open".

When I try to append to the same file it wont let me because the file is "open".

How can I close the file? Any tips?

Mikmoth
a SUGGESTION: USE THE EXPLOYER TO COPY THE TEXT THAT YOU WANT TO COPY. THEN OPEN THE FILE THAT YOU WANT TO COPY TO AND PASTE. THAT IS ALL THERE IS TO IT.
BILL


 

spydaz

  • Hero Member
  • *****
  • Posts: 670
    • View Profile
    • http://www.spydazweb.co.uk/
append file (HELP)
« Reply #2 on: July 12, 2004, 12:02:10 pm »
'------------------------------------------------------------------------------------
' POST PROCESS : SAVE STATEMENTPOLITICS BRAIN RESPONSE
'------------------------------------------------------------------------------------
'check personal keyword file
If HalBrain.TopicSearch(OriginalSentence, WorkingDir & "KEYWORDPOLITICS.brn") = "TRUE" AND LearningLevel > 1 AND BlockSave <> True THEN

'INITIALIZE VARIABLES
RESPONSE = "" & Trim(UserSentence)

'SAVE STATMENT : for later use
    HalBrain.AppendFile WorkingDir & "statementPOLITICS.BRN" & ".brn", RESPONSE

'DEBUG
    DebugInfo = DebugInfo & "Hal has THOUGHT ABOUT IT AND SAVED A statementPOLITICS :" & RESPONSE & VbCrLf
ELSE
    DebugInfo = DebugInfo & "Hal has THOUGHT ABOUT IT AND NOT SAVED A statementPOLITICS :" & RESPONSE & VbCrLf
END IF
'----------------------------------------------




'------------------------------------------------------------------------------------
'POST PROCESS :  SAVE Q&Areligion BRAIN RESPONSE
'------------------------------------------------------------------------------------

'check personal keyword file
If HalBrain.TopicSearch(OriginalSentence, WorkingDir & "KEYWORDreligion.brn") = "TRUE" AND HalBrain.TopicSearch(PrevSent, WorkingDir & "KEYWORDreligion.brn") = "TRUE" AND LearningLevel > 1 AND BlockSave <> True THEN

'INITIALIZE VARIABLES
KEYWORD = UCase(PrevSent)
RESPONSE = "" & Trim(UserSentence)

'SAVE q&a paired response
    HalBrain.AppendFile WorkingDir & "QAreligion.brn", "@" & RESPONSE & VbCrLf & " " & KEYWORD

'debuG info
    DebugInfo = DebugInfo & "Hal has THOUGHT ABOUT IT AND SAVED .qareligion: " & "@" & RESPONSE & VbCrLf & " " & KEYWORD
Else
   DebugInfo = DebugInfo & "Hal has decided not to SAVE this .qareligion: " & "@" & RESPONSE & VbCrLf & " " & KEYWORD
End If
'------------------------------------------------------------------------------------



IT DEPENDS on HOW you are saving information to the FILE

IT Could be A Q&A file
OR
It could be A SENTENCE file.

HalBrain.AppendFile IS generally the WAY TO GO...

the HALBRAIN dll (OBJECT) Contains Various FUNCTIONS which use the "FILESYSTEM.OJECT" So if you are Appending to a file Referenced by the SCRIPT with the filesystem OBJECT It would already have been opened by the HALBRAIN.Appendfile FUNCTION.

SO USE the BUILT-IN HALBRAIN.Appendfile FUNCTION. and you should have no problems. REMEMBER the .UHP is only a function IN the MAIN HALBRAIN SCRIPT.