Jump to content

lawrenca

Member
  • Posts

    129
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    United States

Posts posted by lawrenca

  1. Best place to start is right here in the MSFN. There is a very nice tutorial in the unattended section that should be the starting point for all administrators (stuff they don't teach in Microsoft Certification Courses). Link below.

    MSFN Unattended

    As for the programming, any of the "Teach Yourself" series is good for an overview but nothing takes the place of diving in on a project and making mods yourself, leaning on friends in the forums for expert advice, and lets not leave out or forget to search for the answers first before taking up the moderators time to answer...nothing more frustrating than answering the same questions over and over when the info is in help files or forum topics.

    Good luck!

  2. @Nobby Barnes,

    I have a lot of luck checking the HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall Key for Add/Remove Programs. Below is a sample of my condition and gcondition that I use for checking whether an app is installed AND available for install on my disk or network store.

    prog[pn]=['Notepad++ v4.0.2'];
    ordr[pn]=[170];
    uid[pn]=['NOTEPAD402'];
    dflt[pn]=['no'];
    cat[pn]=['Commercial Applications'];
    forc[pn]=['no'];
    cond[pn]=['FileExists("%root%\\Applications\\Commercial\\Notepad++ v4.0.2\\npp.4.0.2.Installer.exe")'];
    gcond[pn]=['RegKeyExists("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Notepad++\\DisplayName")'];
    cmd1[pn]=['"%root%\\Applications\\Commercial\\Notepad++ v4.0.2\\npp.4.0.2.Installer.exe" /S'];
    pn++;

    Hope this helps.

    -Tony

  3. @deadbug,

    There are two quick ways you can call another function from within WPI (without a lot of recoding effort).

    1. You can take advantage of a function inside of core.js called "function ReplacePath(v)" that starts around line 323 (which is what I think you want). This will require you to define a new variable and replace text within the command with the data contained inside the variable. There are several examples contained within this function, an easy one to look at is the way Kel handles %wpipath% and replaces that token with the variable wpipath. wpipath actually gets resolved in this same file around line 15 under "function defaultWPI()".

    2. Or you can make a call from an outside executable, script, or dll through a function inside of installer.js called "function handleCommand(cmd)" that starts around line 337. This is where you could substitute a command you've included in the cmd lines (I currently invoke an AutoIT Script from this function that contains many of my functions inside that I just pass commandlines like ProcessWaitClose, ProcessCloseAll, ProcessClose, ProcessWait, WinClose, WinKill...I've also added all the Delete, Copy, and Sleep functions as I don't like the CMD Window in my face during install - just a quirk on my part.

    Probably the harder part is figuring out if you want to thump those commands everytime in the config page or remember to include them everytime there is a new release. You could also mod configwizardtemplate_config.htm to add those new commands in the dropdowns of each of the commands.

    I'd also be interested in seeing your LimitedWaitForFile function if you're willing to post it.

    Note: If the function line numbers don't match up properly, just do a search on those functions...I'm working on wpi6.2 but also make a few mods here and there so they may not exactly match up.

  4. Kel,

    I'm hoping you are looking for something like this in java script:

    function Deleterunentry()
    {
    position="api.js";
    whatfunc="Deleterunentry()";

    var wsh = new ActiveXObject("WScript.Shell");

    try
    {
    wsh.RegDelete("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\WPI");
    }
    catch (ex)
    {; }
    }

    Oops, Sorry about that Yzöwl, didn't look through the dropdown .js section of your code well enough...that was where I was going. Kel, did Yzöwl's code not help?

  5. @rline,

    FILECOPY "%wpipath%\Install\app\app.exe" %systemroot%\Program files\app /y

    Does the folder "app" already exist on the destination - %systemroot%\Program files\app?

    If not, you will have to create the directory first,

    MAKEDIR "%systemroot%\Program files\app"

    then copy the file...you will also need quotes if there are spaces in your path. See this post for more info.

    FILECOPY "%wpipath%\Install\app\app.exe" "%systemroot%\Program files\app" /y

    You could also just do a DIRCOPY...See this post for more info.

  6. This was on my wishlist from a while back. I know there are probably more elegent solutions, I was having trouble maintaining the highlight while tabbing around on the page without creating the highlightlink funtion. All changes I made are in the configwizard.js. The colors and fonts could certainly be moved to the css file for consistency. Below is my implementation:

    Changes in function CreateNavigation(). I have accesskey to directly access the links in the list but they conflict with current implementation of hotkeys...I still use the Ctrl+? for my hotkeys. I also use the UID so you will highlight entries that are not unique:

    From this:

    txt += '<td valign="top"><a class="opTxt" onClick="JumpToEntry(' + i + ')">' + configList[i].prog + '</a></td>';

    To this:

    txt += '<td valign="top"><a class="opTxt" href="java script:JumpToEntry(' + i + ')" id="'+ configList[i].uid + '" accesskey="'+ configList[i].prog.substring(0,1) + '";>' + configList[i].prog + '</a></td>';

    Add as the last line of function FillInConfig(CreateNav,pos) to call the new highlightlink function:

    highlightlink(pos);

    Finally, add the new function. Not called in the link itself as it lost focus as I tabbed around the config page to change values for this item:

    function highlightlink(pos)	//Tony add...Highlight link persistently even when link doesn't have focus
    {
    position="configwizard.js";
    whatfunc="highlightlink()";

    var regularColor='black';
    var hoverColor='purple';
    var selectedColor='yellow';
    var anchors = document.getElementsByTagName('a');

    for (var i=0; i < document.anchors.length; i++)
    {
    if (document.anchors[i].id==document.getElementById("uid").value)
    {
    document.anchors[i].focus();
    document.anchors[i].style.color = regularColor;
    document.anchors[i].style.backgroundColor = selectedColor;
    }
    else
    {
    document.anchors[i].style.backgroundColor = "";
    document.anchors[i].style.color = regularColor;
    document.anchors[i].onmouseover = new Function("this.style.color = \"" + hoverColor + "\";");
    document.anchors[i].onmouseout = new Function("this.style.color = \"" + regularColor + "\";");
    }
    }
    }

    configwizard.js

  7. You will have to manipulate these for the logic you wish to implement.

    This example compares strings, notice I'm pulling from the DisplayVersion now:

    prog[pn]=['Adobe Reader 7.0.8'];
    ordr[pn]=[100];
    desc[pn]=['Adobe® Reader® — free software for viewing and printing Adobe Portable Document Format (PDF) files.'];
    uid[pn]=['ADOBE708'];
    dflt[pn]=['yes'];
    cat[pn]=['Commercial Applications'];
    forc[pn]=['no'];
    configs[pn]=['default'];
    cond[pn]=['FileExists("%root%\\Applications\\Commercial\\Adobe Reader 7.0.8\\reader708.exe")'];
    gcond[pn]=['RegKeyValue("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{AC76BA86-7AD7-1033-7B44-A70800000002}\\DisplayVersion")=="7.0.8"'];
    cmd1[pn]=['"%root%\\Applications\\Commercial\\Adobe Reader 7.0.8\\reader708.exe"'];
    pn++;

    This example will parse the strings to numbers, then you can use <,>,= or any combination to compare the numbers to determine if the installed version is greater than the version you wish to install...you may want to move this logic to the condition statement since you may not want the user to even see an older version available.

    prog[pn]=['Adobe Reader 7.0.8'];
    ordr[pn]=[101];
    desc[pn]=['Adobe® Reader® — free software for viewing and printing Adobe Portable Document Format (PDF) files.'];
    uid[pn]=['ADOBE708'];
    dflt[pn]=['yes'];
    cat[pn]=['Commercial Applications'];
    forc[pn]=['no'];
    configs[pn]=['default'];
    cond[pn]=['FileExists("%root%\\Applications\\Commercial\\Adobe Reader 7.0.8\\reader708.exe")'];
    gcond[pn]=['parseFloat(RegKeyValue("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{AC76BA86-7AD7-1033-7B44-A70800000002}\\DisplayVersion")) >= parseFloat("7.0.8")'];
    cmd1[pn]=['"%root%\\Applications\\Commercial\\Adobe Reader 7.0.8\\reader708.exe"'];
    pn++;

  8. XCougar,

    I think the manual is worded correctly.

    Use the cond (Condition) statement to show/hide entire checkbox and entry based on a certain condition, like if the application is available on the disk (wouldn't want to try to install it if it wasn't there), or if it required a certain OS or Hardware to be installed.

    Kel is referring to Grayed Condition in his response.

    like so in grayed condition section = FileExists('%programfiles%\VMware\VMware Workstation\vmware.exe')

    Use gcond (Grayed Condition) to gray out checkbox entry if that condition is true, like if something is already installed whether it be a file or registry setting. I prefer to key on registry keys as they provide path independence for the application if they are standard installations, this is where all the Add/Remove Programs get tracked.

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

    Example for checking for 7-Zip, This line just checking for RegKey is not version specific:

    gcond[pn]=['RegKeyExists("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\7-Zip\\DisplayName")'];

    You could easily break it down to the exact registry value, this will key to a specific version:

    gcond[pn]=['RegKeyValue("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\7-Zip\\DisplayName")=="7-Zip 4.45 beta"'];

  9. This is a good link to take a look at, as a matter of fact, the whole site is worth a read...

    WPI Help

    Look for a solution about half way down the page with the header:

    Here is a quick start package that will set your windows disk up to use WPI with runonceex after Windows installation.

    To make use of this archive all you need to do is unRAR it and place the %oem% folder beside the I386 and WPI folders.

  10. The Script works fine if I execute it manually but if WPI excutes it, it blocks a command prompt that opens as part of the programs installation and the who thing frags up.

    Are you sure that it just doesn't need the working directory set within WPI? I'm not familiar with Aspect WinSet but have never had this kind of trouble ever installing anything, and I've installed my share with AutoIT and WPI. Maybe if you could provide more details to include the config.js and also the autoit script you are launching.

  11. For now, WPI needs to be mounted as a network drive to resolve paths across a network or those network paths (if different than the WPI directory structure) will also have to be resolved. Check this post out, it works great:

    Tip for running WPI from a network share

    I personally use a vb6 application that mounts a network drive finding the first available drive from Z:\ to A:\ and I believe there are also some AutoIT scripts that do the same thing. Launching programs from different network shares outside of the WPI structure may be more difficult unless you provide the user some method to mount the drive or browse to them and then resolving them within that code.

  12. Best bet would be to limit access via NTFS permissions. Applying permissions on the front-end (WPI) doesn't necessarily keep the user from "exploring" and running the application from your CD/DVD/Network Share. You could also create a self-extracting .exe out of the application and password protect it which would take care of launching from file instead of WPI. But if you are sure this is what you would like to pursue, I would highly recommend formally adding it to the wishlist...

    For WPI 6.2, in \WPIScripts folder, open check.js and browse to: function setChecked(i) down to line 115 and write an intercept for checking the checkboxes.

    Change:

    chkbox.checked=true;

    to:

    chkbox.checked = checkPassword(i);

    This will require us to create a new function checkPassword. I'd place it at the top of the file for convenience.

    var pword="";  //move inside of checkPassword(i) if you want don't want the password stored globally (i.e. The user has to input the same password for every application they select even if it's the same password).
    function checkPassword(i)
    {
    position="check.js";
    whatfunc="checkPassword()";

    try
    {
    if (gcond[i].toString().match("password") == null || gcond[i].toString() == "") //gcond does not contain a password
    return true;

    var mySplitResult = gcond[i].toString().split("password");
    var pass = mySplitResult[1].split('"'); //this parses out the password
    var pass1;

    pass1 = pass[1];

    if (pass1 != pword)
    pword=prompt('Please enter your password to install this App!',' ');

    if (pword==pass1)
    {
    return true; //password meets the password criteria
    }
    else
    {
    alert('Password is incorrect! You do not have permissions to install this application.');
    return false; //password is incorrect, uncheck the application
    }
    }
    catch (ex)
    {
    return true;
    }


    }

    Now for the useage, I've taken advantage of gcond for proof of concept, at least until WPI has a variable that reflects the password (I'm thinking maybe a textbox with a minimum of a password, possibly a username). Add this (or your own password) to your gcond statement of each application you would like to password protect:

    (password="tony")

    The function above will parse out "tony" (no quotes) for the password.

    Another example that shows combined gcond statements:

    FileExists("c:\test.txt") && (password="ross")

    I've attached the files from above for testing and observation. There are some serious limitations to the above code as the password would be stored in plain text within the config.js file. We could easily provide encryption for the passwords, but even the encryption algorithms would be in plain text and available for advanced users to decipher but wouldn't be bad for a first start. The code will need some cleaning up with some error checking before implementation...just a concept.

    config.js

    check.js

  13. sp00f,

    How is that variable being exposed to WPI...I don't think it can the way you are implementing it. You'll have to read it into WPI even if you make it an environment variable (look in core.js:function=ReplacePath for samples of creating your own variables and globals.js for reading in environment variables).

  14. @vampus8,

    Migrating the config.js file is as easy as copying or pointing to it with the newest release of WPI.

    As for your Options, you could try to migrate them (be sure to make a backup of all your work before you do this) but I don't think any options have changed since 5.3, please check the changelog...with that said, it should be just as easy to go into the options page and reset it the way you like it.

  15. sp00f,

    Any chance of showing us how you were defining %AppsRoot% previously and what your folder structure is? May help in trying to figure out why it's not working for you.

    BTW: Thanks Kel for adding the code to WPI v6.1! Once again, another great release of WPI!

×
×
  • Create New...