Jump to content

Two questions regarding XPlode commands...


Recommended Posts

Posted

1) Is there any way besides using a batch to change directories? The reason I ask is that my Jscripts don't seem to allow environment variables in the source paths for the installers that they open, and they're unable to find the installer if I just use the filename without a full path (even though they are in the same directory)... unless I use the CD command. Long and confusing sentence but hopefully it makes some sense.

2) Will this syntax work in 1.1.2?

<filecopy source='%SYSTEMDRIVE%\Install\Applications\Firefox\plugins\' target='%SYSTEMDRIVE%\Program Files\Mozilla Firefox\plugins\' mask='*.*' />

I'm trying it that way instead of doing a directory copy because I don't want to overwrite any files already in that directory.


Posted

I think he meant the "current directory".

Can't you give full paths? You can use environment variables inside JScript:

Shell = WScript.CreateObject("WScript.Shell");
Environnement_system = Shell.Environment("SYSTEM");
Environnement_process = Shell.Environment("PROCESS");
Network = WScript.CreateObject("WScript.Network");

windir = Environnement_process("SYSTEMROOT")
systemdrive = Environnement_process("SYSTEMDRIVE");
ProgramFiles = Shell.RegRead("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\ProgramFilesDir");
SourcePath = Shell.RegRead("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\SourcePath");

Nothing really complicated. I use this @ t-12 (cmdlines.txt) and they work fine

Posted

Yes, I meant change the current directory.

Here is what I did, based on your code:

function getWin(win, inc)
{
var cntr = 0;
while (!WshShell.AppActivate(win))
{
if (cntr==12) return true;
cntr++;
WScript.Sleep(inc);
}
return true;
}
var WshShell = new ActiveXObject("WScript.Shell");
process = WshShell.Environment("PROCESS");
systemdrive = process("SYSTEMDRIVE");
var oExec = WshShell.Exec("systemdrive\Install\Codecs\DivX\DivXPro502Bundle.exe");
while (oExec.Status == 0)
{

It's still claiming that the system cannot find the file specified even though it's there.

Posted

Now this is REALLY screwed... I change the path to the exactly currect full path and it still claims that it can't find it. I copy and paste said path into the explorer bar and it opens fine. I remove the full path and just keep the installer name and it runs fine (but only when testing it in my "\$OEM$\$1\Install\Codecs\DivX", not when I try it with unattended installation from the files copied to the systemdrive).

Posted

The line:

var oExec = WshShell.Exec("systemdrive\Install\Codecs\DivX\DivXPro502Bundle.exe");

should be more like

var oExec = WshShell.Exec(systemdrive + "\\Install\\Codecs\\DivX\\DivXPro502Bundle.exe");

Posted

Aha, I had also tried that method of splitting up the variable and the rest of the path like that but had neglected to think of double-backslashes. Thanks very much, it's working just fine now. :)

Posted

Why make it your selve so hard? dont use:

var oExec = WshShell.Exec("systemdrive\Install\Codecs\DivX\DivXPro502Bundle.exe");

but use

var oExec = WshShell.Exec("%systemroot%\\Install\\Codecs\\DivX\\DivXPro502Bundle.exe");

now you can delete the lines

process = WshShell.Environment("PROCESS");
systemdrive = process("SYSTEMDRIVE");

from your script. it's a hel simpler this way

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...