20 kwi 2008

Wczytanie pliku do zmiennej

'Constant  Value  Description
'TristateUseDefault  -2  Opens the file using the system default.
'TristateTrue  -1  Opens the file as Unicode.
'TristateFalse   0  Opens the file as ASCII.
Dim fso, stream, str, re, name
name = "moa.html"
Const ForReading = 1, ForWriting = 2, TristateTrue = -1, TristateFalse = 0, TristateUseDefault = -2
Set fso = CreateObject("Scripting.FileSystemObject")

Set stream = fso.OpenTextFile(name , ForReading, False, TristateFalse)
str = stream.ReadAll()
stream.Close
Set stream = Nothing
17 kwi 2008

Znaki cudzysłowia w VBS

myResult = "<table border=" & Chr(34) & "1" & Chr(34) & ">" & myResult & "</table>"
17 kwi 2008

Usunięcie ze stringa znaków sterujących

Dim strValue As String
          
strValue = Replace(strValue, Chr(13), "") 'enter
strValue = Replace(strValue, Chr(9), "") 'tab
strValue = Replace(strValue, Chr(10), "") 'newline
strValue = Replace(strValue, ":", "") 'colons
strValue = Trim(strValue) 'rtim
5 kwi 2008

Generowanie losowej nazwy obrazka

rnd = Math.ceil(Math.random()*131) + 10000
obrazek_anim = '' + rnd
obrazek_anim = '<img decoding="async" src="anim/'+obrazek_anim.substr(1,4)+'.gif">'