Author Topic: AppendFile  (Read 4533 times)

jenna

  • Newbie
  • *
  • Posts: 23
    • View Profile
AppendFile
« on: February 24, 2006, 01:19:31 pm »
Can't get the HalBrain.AppendFile to work. Here is a sample of code using the AppendFile command.  

Rem PLUGIN: FUNCTIONS
'Declare Variables
    Dim LastIdleResponse
    Dim AutoChatStatus
    Dim IdleUserName
    Dim IdleComputerName
    Dim WorkingDir
   
'*************************************************************
Rem PLUGIN: PLUGINAREA7
    LastIdleResponse = Now
    IdleUserName = UserName
    IdleComputerName = ComputerName
    Blank = ""
    WorkingDir = "D:Ultra Hal Assistant 6\"
   
Rem PLUGIN: PLUGINAREA1
     
REM PLUGIN: MINUTE_TIMER

If LastIdleResponse <> "" Then
    AutoChatStatus = AutoChatStatus + 1
   
If autochatstatus = 5 Then
  IdleResponse = "Test Number 1  The Auto chat count is = " &autochatstatus & vbCrLf
  IdleResponse2 = "Test Number 1  The Auto chat count is = " &autochatstatus & vbCrLf
   HalMenu.HalCommand "<SPEAK>" & IdleResponse &"</SPEAK>"
   HalBrain.AppendFile WorkingDir & AutoChat_Log.TXT",IdleResponse2
   HalBrain.ReadOnlyMode = True
   Exit Sub   
  End If

Code works fine except that it doesn't write to the "AutoChat_log" file.  Any help would be great.
Thanks
Jenna[8D]
 

onthecuttingedge2005

  • Guest
AppendFile
« Reply #1 on: February 24, 2006, 03:05:51 pm »
You have to use the full path.

HalBrain.AppendFile WorkingDir & "D:\Ultra Hal Assistant 6\AutoChat_Log.TXT", Trim(IdleResponse2)

jenna

  • Newbie
  • *
  • Posts: 23
    • View Profile
AppendFile
« Reply #2 on: February 25, 2006, 04:02:30 pm »
I tried these and still nothing.
HalBrain.AppendFile WorkingDir & "D:Ultra Hal Assistant 6AutoChat_Log.TXT", Trim(IdleResponse2)

HalBrain.AppendFile "D:Ultra Hal Assistant 6AutoChat_Log.TXT", Trim(IdleResponse2)

HalBrain.AppendFile WorkingDir & "D:Ultra Hal Assistant 6AutoChat_Log.TXT", IdleResponse2

It seems that something is missing when using this in the minute timer function.
jenna
 

Ponnfar

  • Full Member
  • ***
  • Posts: 149
    • View Profile
    • http://zabaware.com
AppendFile
« Reply #3 on: March 05, 2006, 01:44:53 am »
Hi Jenna, this would be a nice feature. I still did not see the backslash in the string you posted. I wondered if you were able to find the bug.  
P
One Person can summon the future...

jenna

  • Newbie
  • *
  • Posts: 23
    • View Profile
AppendFile
« Reply #4 on: March 08, 2006, 05:40:28 am »
Hi P;
No I still haven't resolved the problem with this scrip. HalBrain.AppendFile WorkingDir & "D:Ultra Hal Assistant 6AutoChat_Log.TXT", IdleResponse2.
The back slash was just a typo in my post, it is in the real scrip I use. The funny thing is, that this may work once out of ten tries. I use this statement several times in my plug in and once in awhile it will work, but most of the time it won't.  I still believe that in has something to do with the Minute Timer function.
I will still work on it, may someday I'll figure it out.
Jenna
 

onthecuttingedge2005

  • Guest
AppendFile
« Reply #5 on: March 10, 2006, 03:20:36 pm »
I don't know exactly if you had posted all your code or not but you can try something like this, I wrote out some functions and remodified a few things, maybe you can work with it.

Code: [Select]

Rem PLUGIN: PLUGINAREA7
'Variables declared with Dim at the script level are available to all procedures within the script.
Dim LastIdleResponse, AutoChatStatus, IdleUserName, IdleComputerName, WinDirD, Blank
'Our Functions:
LastIdleResponse = LIR() 'Now
IdleUserName = IUN(UserName) 'User's Name
IdleComputerName = ICN(ComputerName) 'Computer Name
Blank = RIV() 'Reset Internal Variable.
WinDirD = IdleWD(IdleXDir) 'Custom Directory

REM PLUGIN: MINUTE_TIMER

If LastIdleResponse <> 0 Then
AutoChatStatus = AutoChatStatus + 1

If autochatstatus = 5 Then
IdleResponse = "Test Number 1 The Auto chat count is = " & autochatstatus & vbCrLf
IdleResponse2 = "Test Number 1 The Auto chat count is = " & autochatstatus & vbCrLf
HalMenu.HalCommand "<SPEAK>" & IdleResponse & "</SPEAK>"
HalBrain.AppendFile WinDirD & "AutoChat_Log.txt", Trim(IdleResponse2)
End If

Rem PLUGIN: FUNCTIONS
'Function: Custom Directory
Function IdleWD(IdleXDir)
IdleXDir = "D:\Ultra Hal Assistant 6\"
IdleWD = IdleXDir
End Function
'Function: Now, 'L_ast I_dle R_esponse'
Function LIR()
LIR = Now
End Function
'Function: User's Name, 'I_dle U_ser N_ame'
Function IUN(UserName)
IUN = UserName
End Function
'Function: Computer's Name, I_dle C_omputers N_ame
Function ICN(ComputerName)
ICN = ComputerName
End Function
'Function: R_eset I_nternal V_ariable
Function RIV()
RIV = ""
End Function


Hint: When posting Directories in this forum use double back slashes so the back slashes will show in your post, Single Back Slashes are filtered out.

Jerry[8D]
« Last Edit: March 10, 2006, 03:24:10 pm by onthecuttingedge2005 »

jenna

  • Newbie
  • *
  • Posts: 23
    • View Profile
AppendFile
« Reply #6 on: March 11, 2006, 02:54:02 pm »
Thanks for the tips, Jere.  I'll try using them, and will let you know if they will work for me.
Jenna[:D]