app-manager --update and --setup are documented to take URIs but they are not treated as such
1 var WshShell = WScript.CreateObject("WScript.Shell");
2 var ScriptPath = WScript.ScriptFullName.replace(/\\[^\\]*$/, "");
3 var FileSystemObject = new ActiveXObject("Scripting.FileSystemObject");
5 function RunSetup(args)
7 var OKButton = 0, ErrorIcon = 16, ForReading = 1;
8 var path, command, i, ExecObject, text;
9 path = FileSystemObject.BuildPath(ScriptPath, "setup.exe");
10 command = "\"" + path + "\"";
11 for(i = 0; i < args.Length; i++)
12 command += " \"" + args.Item(i) + "\"";
13 ExecObject = WshShell.Exec(command);
14 if (!ExecObject.StdErr.AtEndOfStream)
16 text = "Setup failed for an unexpected reason. Please report "
17 + "the following error to support@city-occupational.co.uk:\n\n"
18 + ExecObject.StdErr.ReadAll();
19 WshShell.Popup(text, 0, "Setup failed", OKButton + ErrorIcon);
22 else if (ExecObject.ExitCode)
24 text = "Setup failed without giving a reason. Please report "
25 + "this to support@city-occupational.co.uk";
26 WshShell.Popup(text, 0, "Setup failed", OKButton + ErrorIcon);
35 path = FileSystemObject.BuildPath(ScriptPath, "pre-inst.exe");
36 WshShell.Run("\"" + path + "\"" + " --post \"wscript.exe"
37 + " \\\"" + WScript.ScriptFullName + "\\\""
38 + " --post %INSTALL_PREFIX% %TEST_RESULT%\"",
45 path = FileSystemObject.BuildPath(ScriptPath, "pre-inst.exe");
46 WshShell.Run("\"" + path + "\"" + " -u --post \"wscript.exe"
47 + " \\\"" + WScript.ScriptFullName + "\\\"" + " --postun\"", 7, true);
50 function PostInstall()
52 var OKButton = 0, InfoIcon = 64, text;
53 var test_result, install_prefix, path, args;
54 install_prefix = WScript.Arguments.Item(1);
55 test_result = WScript.Arguments.Item(2);
56 if (test_result == "pass")
58 path = FileSystemObject.BuildPath(install_prefix,
59 "bin\\app-manager.exe");
60 WshShell.Run("\"" + path + "\" --setup \"" + ScriptPath + "\"");
64 args = { Length:0, Item:function(){return nil} };
67 text = "Software installation completed successfully.";
68 WshShell.Popup(text, 0, "Software Installation",
74 function PostUninstall()
76 var args = { Length:1, Item:function(){return "-u"} };
77 var OKButton = 0, InfoIcon = 64, text;
80 text = "Uninstall completed successfully.";
81 WshShell.Popup(text, 0, "Uninstall", OKButton + InfoIcon);
85 if (WScript.Arguments.Length < 1)
87 else if (WScript.Arguments.Item(0) == "-u")
89 else if (WScript.Arguments.Length >= 3 && WScript.Arguments.Item(0) == "--post")
91 else if (WScript.Arguments.Item(0) == "--postun")