View Full Version : help in chat code
bmwmpower
06-15-2003, 09:46 AM
i need help in make some change in my code
my chat depend on txt file what i need is when the len > 500 i want delete the first len in the txt
this is the old code
If Len(file) > 500 Then
'archive the old file
'archive name is topic_date put under files/archives
archiveFile = Server.MapPath("chat/" & Replace(Topic, "+", "_") & "_" & Server.URLEncode(Now) & ".txt")
Set inStream = fileObject.CreateTextFile(archiveFile,True)
inStream.Write file
inStream.Close
Set inStream = Nothing
Set inStream = fileObject.CreateTextFile(textFile,True)
inStream.Write " "
Set inStream = Nothing
file = " "
End If
i need now to delete the first line in the txt file
If Len(file) > 500 Then
i need the code here i need the idea or how i can make it
end if
bmwmpower
06-21-2003, 08:44 AM
why no one help me
I don't quite understand what you're trying to do. Are you archiving the file? What's the len() ? You want to "delete fhe first len in the file" :confused:
Can you clarify some more?
bmwmpower
06-22-2003, 01:56 PM
what i need is delete first line form the txt file if the len > 500
whammy
06-22-2003, 04:32 PM
I just went by the number of lines... i.e.:
Set f = fs.OpenTextFile(txtfile, 1)
messagelog = f.ReadAll
messagearray = Split(messagelog,vbCrlf)
howlong = UBound(messagearray)
linelimit = 18
Then obviously, I limit the join() in the linelimit... get it?
bmwmpower
06-24-2003, 10:38 AM
i think this way will not help me i need delete line form txt file coz this txt file i used it in chatting ( i mean what write in the chatting is save in this file )
and i have another problem in window.scroll
<SCRIPT LANGUAGE="JavaScript">
function toBottom(){
if(document.all){
window.scroll(0, document.body.clientHeight);
}else{
window.scroll(0,20000)
}
</SCRIPT>
<BODY BGCOLOR="#ffffff" onLoad="toBottom()">
bmwmpower
06-24-2003, 10:54 AM
this is my old code in this code when the line in txt file >500 the txt file will be make as archive the old file and make new txt file what i need delete this part and i need one file not make new file if line >500
i mean i want use only one txt file so when the line >500 delete form the first line and
bmwmpower
07-19-2003, 01:19 PM
why no one help me
I don't understand what you are trying to do.
I understand you have a textfile. But what are you trying to do if there are more then 500 lines in that file ?
whammy
07-19-2003, 09:05 PM
I gave you an example, that I used in my text chat application. Just split the lines by vbCrLF, and then see what the Len(UBound(NumberOfLines)) is.
Then join them back at 500 if the ubound is over that. I know it works, it works in mine. I took the code straight out of it.
bmwmpower
07-20-2003, 08:50 AM
what i need
in my old code i archiving the txt file if the line >500
but what i need now is "delete the first len in the file" when the line > 500 not archiving the file
and i have another problem with the window scroll " when the page refresh "
this is my old code for the scroll
<SCRIPT LANGUAGE="JavaScript">
function toBottom(){
if(document.all){
window.scroll(0, document.body.clientHeight);
}else{
window.scroll(0,20000)
}
</SCRIPT>
<BODY BGCOLOR="#ffffff" onLoad="toBottom()">
what i need in this part is the scroll go to botton
vBulletin® v3.8.2, Copyright ©2000-2010, Jelsoft Enterprises Ltd.