4cade/bin/converthelp.js

64 lines
1.2 KiB
JavaScript
Raw Normal View History

a = new ActiveXObject("scripting.filesystemobject")
if (!a.fileexists(WScript.Arguments(1)) || a.getfile(WScript.Arguments(1)).datelastmodified < a.getFile(WScript.Arguments(0)).datelastmodified)
{
2021-10-18 02:53:08 +00:00
z = a.opentextfile(WScript.Arguments(0))
d = a.createtextfile(WScript.Arguments(1))
String.prototype.replaceWith = function(q)
{
return this.substr(0, c) + String.fromCharCode(q) + this.substr(c + 1)
}
2021-10-18 02:53:08 +00:00
while (!z.atendofstream)
{
2021-10-18 02:53:08 +00:00
b = z.readline()
c = b.search(/\[eof\]/)
if (c > -1)
{
2021-10-18 02:53:08 +00:00
break
}
2021-10-18 02:53:08 +00:00
c = b.search(/\r\n/)
if (c > -1)
{
2021-10-18 02:53:08 +00:00
b = b.substr(0, c)
}
2021-10-18 02:53:08 +00:00
for (c = 0; c < b.length; c++)
{
2021-10-18 02:53:08 +00:00
if (b.charAt(c) == '*')
{
b = b.replaceWith(16)
}
else if (b.charAt(c) == '~')
{
b = b.replaceWith(17)
}
else if (b.charAt(c) == '<')
{
b = b.replaceWith(8)
}
else if (b.charAt(c) == '>')
{
b = b.replaceWith(21)
}
else if (b.charAt(c) == '$')
{
b = b.replaceWith(14)
}
else if (b.charAt(c) == '%')
{
b = b.replaceWith(15)
}
}
2021-10-18 02:53:08 +00:00
d.write(String.fromCharCode(b.length) + b)
}
2021-10-18 02:53:08 +00:00
d.write(String.fromCharCode(255))
}