Jump to content

Recommended Posts

Posted (edited)

i have a chatroom.. that runns off of a shared drive, there is one file that every one reads from.. an example is LANCR in my sig.. but im working on a new one AIOCR which is also in my sig.. and im working on PMs and i need to find the line... assign it to a $var.. and then rewrite the txt without the PM in it... here is what i have

here is an example of a PM

*ToClient_Message_FromClient^

If StringInStr ($File, @CRLF & '*' & @UserName) Or StringInStr ($File, @CRLF & '*' & $Name_S) Then
                Dim $FileA, $i, $pm
                _FileReadToArray ($S_TXT, $FileA)
                For $i=1 To $FileA[0]
                    $FileA[$i]=_HexToString ($FileA[$i])
                    _ArrayDisplay ($FileA[$i])
                    If StringInStr ($FileA[$i], @CRLF & '*' & @UserName) Or StringInStr ($FileA[$i], @CRLF & '*' & $Name_S) Then
                        $pm=_Stringbetween ($FileA[$i], '*', '^')
                        $FileA[$i]=_StringToHex('')
                        FileDelete ($S_TXT)
                        FileWrite ($S_TXT, '')
                        _FileWriteFromArray ($S_TXT, $FileA[0])
                    EndIf                   
                Next
            Else

the TXT file is HEX... so i just use _Stringtohex(Fileread($S_TXT) to read it.. and viseversa to write.. but im having troubles with this string maniputaion.. ive searched and helpfiled it lol any ideas? :D

Edited by CodyBarrett
Posted (edited)

BUMP

when i try fileread and stringreplace... or stringbetween it doest write the New filedata to the file..

EDIT

alright i think i know the problem.. its writen in HEX and filereadtoarray reads the file lines.. HEX is ONE complete string no spaces.. no @CRLFs, so FILEreadtoarray doesnt seem to work. am i right? or is it something entirely different? and how would i fix this to it does it correctly?

Edited by CodyBarrett
Posted

ok.. ive fixed it on my own... here is the code NOW incase anyone cares lol

If StringInStr ($File, @CRLF & '*' & @UserName) Or StringInStr ($File, @CRLF & '*' & $Name_S) Then
                Dim $pm, $string, $PerMes, $Reply, $From, $To
                $pm=_StringBetween ($File, '*', '^')
                $PerMes=$pm[0]
                $string=StringReplace ($File,@CRLF & '*' & $pm[0] & '^' & @CRLF, '')
                FileDelete ($S_TXT)
                FileWrite ($S_TXT, _StringToHex ($string))      
                $Reply=InputBox ('Personal Messenger...', $PerMes, 'Reply...', '', 400, 120, -1 ,-1 ,60 ,$SHARED_Chat_GUI)              
                If @error Then
                Else
                    FileWrite ($S_TXT, _StringToHex ( @CRLF & '*' & $Reply & ' : From ' & $Name_S & '^' & @CRLF))
                EndIf

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...