'Html2js conversion script. Usage: place the file in the sendto file, right-click the HTM file, and send it to html2js. vbs: Enter the JS or ASP script to generate a file with the same name, but the extension is. JS or. ASP or drag and drop an HTML file on this file.
'Baby @ http://www.51windows.Net
Set argobj = wscript. Arguments
Filepath = argobj (0)
Dim FSO, file, str1, STR
Set FSO = Createobject ("scripting. FileSystemObject ")
Set file = FSO. opentextfile (filepath, 1)
Converttype = inputbox ("Enter the type to change, JS or ASP", "Enter the type to change, JS or ASP", "JS ")
If trim (lcase (converttype) = "JS" then
STR = "// 51windows. Net html2js conversion script @" & now () & vbnewline
While not file. atendofstream
Str1 = file. Readline
If Len (str1)> 0 then
Str1 = Replace (str1 ,"\","\\")
Str1 = Replace (str1 ,"/","\/")
Str1 = Replace (str1 ,"""","\""")
Str1 = "document. writeln (" "& str1 &" ");" & vbnewline
STR = STR & str1
End if
Wend
Set fout = FSO. createtextfile (filepath & ". js ")
Fout. writeline Str
Fout. Close
Msgbox "generated"
Elseif trim (lcase (converttype) = "asp" then
STR = "'51windows. Net html2js conversion script @" & now () & vbnewline
While not file. atendofstream
Str1 = file. Readline
If Len (str1)> 0 then
Str1 = Replace (str1, "%>", "% \> ")
Str1 = Replace (str1 ,"""","""""")
Str1 = "response. Write" "& str1 &" "& vbnewline" & vbnewline
STR = STR & str1
End if
Wend
Set fout = FSO. createtextfile (filepath & ". asp ")
Fout. writeline "<%" & vbnewline & STR & "%>"
Fout. Close
Msgbox "generated"
Else
Msgbox "Operation canceled"
End if