• Welcome to Valhalla Legends Archive.
 

Something simple is wrong

Started by CrAz3D, December 29, 2003, 11:15 AM

Previous topic - Next topic

CrAz3D

       Case "ccadd"

   jo() = Split(strText, "¤")
   jo(0) = Right(jo(0), Len(jo(0)) - Len(pA(0)) - 1)
           Open (App.Path & "\scripts.txt") For Append As #4
           Print #4, jo(0) & vbCrLf & jo(1)
           Close #4
           Send "Added " & jo(0) & " to the CustomCommand list", True
           Close #4
                           
''''''''''''''''''''''''''''''''''''''''''''
Case Else
On Error GoTo nexto
Dim cz As String, cHeader As String, g() As String, s() As String, CheeseWeasel As String
CheeseMonKey = False
Close #4

Open (App.Path & "\scripts.txt") For Input As #3
   Do
       Input #3, cz
       If CheeseMonKey = True Then
           Call CustomCommands(cHeader, cz, Command, strAccount, pA(1))
               Exit Sub
nexto:      Call CustomCommands(cHeader, cz, Command, strAccount)
               Exit Sub
       Else
           g() = Split(cz, "=", , vbTextCompare)
               If LCase(g(0)) = "command" Then
                   If LCase(Command) = LCase(g(1)) Then
                       cHeader = LCase(g(1))
                       CheeseMonKey = True
                   End If
               End If
       End If
       Loop Until EOF(3)
       
       Close #3



The error I receive is that the scripts.txt is already open when I try to run a cmd after adding one.  Each section works fine in itself but doesn't work when used close together.  Any ideas on what I'm doing wrong?
rebundance - having or being in excess of sheer stupidity
(ré-bun-dance)
Quote from: Spht on June 22, 2004, 07:32 PMSlap.
Quote from: Adron on January 28, 2005, 09:17 AMIn a way, I believe that religion is inherently evil, which includes Christianity. I'd also say Christianity is eviller than Buddhism (has more potential for evil).
Quote from: iago on April 19, 2005, 01:06 PM
CrAz3D's ... is too big vertically, at least, too big with ... iago ...

Adron

Quote from: CrAz3D on December 29, 2003, 11:15 AM
       Case "ccadd"

   jo() = Split(strText, "¤")
   jo(0) = Right(jo(0), Len(jo(0)) - Len(pA(0)) - 1)
           Open (App.Path & "\scripts.txt") For Append As #4
           Print #4, jo(0) & vbCrLf & jo(1)
           Close #4
           Send "Added " & jo(0) & " to the CustomCommand list", True
           Close #4


Any ideas on what I'm doing wrong?

You have two closes in a row for #4 there. Remove one of them!

Adron

Quote from: CrAz3D on December 29, 2003, 11:15 AM

Open (App.Path & "\scripts.txt") For Input As #3
   Do
       Input #3, cz
       If CheeseMonKey = True Then
           Call CustomCommands(cHeader, cz, Command, strAccount, pA(1))
               Exit Sub
nexto:      Call CustomCommands(cHeader, cz, Command, strAccount)
               Exit Sub
       Else
                       ......
       End If
       Loop Until EOF(3)
       
       Close #3

Any ideas on what I'm doing wrong?

The exit subs will cause the file to not be properly closed.

CrAz3D

OK, I also didn't have a Close for #3, or which ever I was missing, can't remeber now though.
rebundance - having or being in excess of sheer stupidity
(ré-bun-dance)
Quote from: Spht on June 22, 2004, 07:32 PMSlap.
Quote from: Adron on January 28, 2005, 09:17 AMIn a way, I believe that religion is inherently evil, which includes Christianity. I'd also say Christianity is eviller than Buddhism (has more potential for evil).
Quote from: iago on April 19, 2005, 01:06 PM
CrAz3D's ... is too big vertically, at least, too big with ... iago ...