Last active
October 4, 2019 18:37
-
-
Save polosaty/ed12a8900710aceebb1b4801bd06ec6a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="ISO-8859-1"?> | |
<job id="IncludeExample"> | |
<script language="VBScript"> | |
<![CDATA[ | |
Function WSHInputBox(Message, Title, Value) | |
' Provides an InputBox function for JScript | |
' Can be called from JScript as: | |
' var result = WSHInputBox("Enter a name", "Input", test); | |
WSHInputBox = InputBox(Message, Title, Value) | |
End Function | |
]]> | |
</script> | |
<script language="JScript"> | |
<![CDATA[ | |
var Shell = WScript.CreateObject("WScript.Shell"); | |
var fs = WScript.CreateObject("Scripting.FileSystemObject"); | |
/* | |
3 DEBUG | |
2 INFO | |
1 WARNING | |
0 ERROR | |
*/ | |
var loglevel = 3; | |
function log(line){ | |
WScript.Echo(line); | |
} | |
function err(line){ | |
log(line); | |
} | |
function warn(line){ | |
if (loglevel >= 1){ | |
log(line); | |
} | |
} | |
function info(line){ | |
if (loglevel >= 2){ | |
log(line); | |
} | |
} | |
function debug(line){ | |
if (loglevel >= 3){ | |
log(line); | |
} | |
} | |
function ShowLink(link_path){ | |
var Shell = WScript.WScript.CreateObject("WScript.Shell"); | |
var link = Shell.CreateShortcut(link_path); | |
log("Arguments : [" + link.Arguments + "]"); | |
log("Description : [" + link.Description + "]"); | |
log("HotKey : [" + link.HotKey + "]"); | |
log("IconLocation : [" + link.IconLocation + "]"); | |
log("TargetPath : [" + link.TargetPath + "]"); | |
log("WindowStyle : [" + link.WindowStyle + "]"); | |
log("WorkingDirectory : [" + link.WorkingDirectory + "]"); | |
} | |
function makeShortcut(params){ | |
var link = Shell.CreateShortcut(params.path || "link.lnk"); | |
delete params.path; | |
for(var key in params){ | |
link[key] = params[key]; | |
} | |
link.save(); | |
} | |
function writeScript(path, name, dir){ | |
// filename, overwrite, Unicode | |
var file = fs.CreateTextFile(path, true, false); | |
file.WriteLine("copy " + name + "_AsteriosGame.ini AsteriosGame.ini"); | |
file.WriteLine("start " + dir + "\\AsteriosGame.exe"); | |
file.Close(); | |
} | |
function main(){ | |
if (WScript.FullName.toLowerCase().indexOf("cscript.exe") == -1){ | |
loglevel = 0; | |
} | |
// ShowLink(WScript.Arguments(0)); | |
debug(WScript.FullName); | |
debug("WScript.FullName".toLowerCase()); | |
debug(WScript.ScriptFullName); | |
debug(fs.GetParentFolderName(WScript.ScriptFullName)); | |
var current_dir = fs.GetParentFolderName(WScript.ScriptFullName); | |
debug("Current dir: " + current_dir); | |
if (!fs.FileExists(current_dir + "\\AsteriosGame.exe")){ | |
return err("AsteriosGame.exe not found"); | |
} | |
var account; | |
try{ | |
account = WScript.Arguments(0); | |
}catch(e){} | |
if (!account){ | |
account = WSHInputBox("Enter name of account:", "Createing fast link", ""); | |
}else{ | |
} | |
if (!account){ | |
return err("account name required"); | |
} | |
fs.CopyFile("AsteriosGame.ini", account + "_AsteriosGame.ini"); | |
writeScript(account + ".bat", account, current_dir); | |
var desctop_path = Shell.SpecialFolders("Desktop"); | |
try { | |
fs.CreateFolder(desctop_path + "\\l2"); | |
}catch(e){} | |
makeShortcut({ | |
path: Shell.SpecialFolders("Desktop") + "\\l2\\" + account + ".lnk", | |
IconLocation : fs.GetParentFolderName(current_dir) + "\\Asterios.exe,0", | |
TargetPath : current_dir + "\\" + account + ".bat", | |
WindowStyle : 1, | |
WorkingDirectory : current_dir | |
}); | |
} | |
main(); | |
]]> | |
</script> | |
</job> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment