Jump to content

Display Info/Image During RunOnceEx (w/ code)


Recommended Posts

Hiyas all,

I've taken a break from adding apps and hacks in order to do some polishing, which includes extending WPI a bit! After I intergrated the Oneless Installed/Not Font hack (and adding to it, more on this later) I turned to dynamically displaying the Info and Image already defined in config.js in the background during the RunOnceEx process. I'm happy to share what I have achieved so far (real working method/code) however please note: I don't know JavaScript, so I hacked in a call to a batchfile that creates a html file based on templates. (If you didn't understand that, you might not want to mess with this, as it requires editing WPI, HTML and Batch files to implement!)

While this works, it's probably NOT the best way to do this, implementing it all in JS inside WPI most likely is. (Hint Hint) Also this should NOT be used for production use, as I've still got things to add/fix, see "Bug List" below. If in doubt don't try it until some of the kinks are worked out.

First of all, we have to modify the WPIScripts\generate.js file in order to add our hook:

WshShell.regWrite(KeyBase + "\\"+e+"\\", programs[i].prog, "REG_SZ");
if (true) { // set to false, if you want just the display but no real installs
if ((programs[i].picf != null)&&(path(programs[i].picf) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\0",cddrv+"\\Tools\\Grafix.cmd "+programs[i].picf, "REG_SZ");
if ((programs[i].regb != null)&&(path(programs[i].regb) != '')) WshShell.regWrite(KeyBase + "\\"+e+"\\1","REGEDIT /S "+path(programs[i].regb), "REG_SZ");

I've added a line which runs before regb that calls Tools\Grafix.cmd on the CD, this may NOT work with HD only installs. It also passes the value of picf to the Batchfile, this can of course be used for any defined var with a bit of skillful chaining to the batch and additional template work. I'll be adding to this myself soon to create a more informative template.

Next we have Tools\Grafix.cmd the Batch itself:

@echo off

REM Example, how to look for CDROM-drive. Must have WPI.ico at the root of the CD.
for %%i in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%i:\wpi.ico set CDROM=%%i:
echo Found CD-Rom as drive %CDROM%

REM Determine the WPI startup path.
REM if wpi should run off the cd the replace %~dp0 with %cdrom%.
set wpipath=%cdrom%

REM Hide this command window.
%wpipath%\Tools\cmdow.exe @ /hid

REM Make WPI\Tools the current directory.
REM cd\ drive root fix for %wpipath%
cd\
for /f "delims=: tokens=1" %%i in ("%wpipath%") do %%i:
cd "%wpipath%\Tools"

type grafix01.html > %SystemRoot%\TEMP\grafix.html
echo %CDROM%\Graphics\%1 >> %SystemRoot%\TEMP\grafix.html
type grafix02.html >> %SystemRoot%\TEMP\grafix.html

cd "%wpipath%\Graphics"
cmd /c start %programfiles%\Intern~1\iexplore.exe -k file://%SystemRoot%\TEMP\grafix.html
ping 127.0.0.1>NUL

The main work here is done by making a new grafix.html file using the header grafix01.html, then echoing the 1st commandline variable to the file (in this case the name of the picf) and finally adding the footer grafix02.html to the file and displaying it with IE in Kiosk mode. Unfortunately at the RunOnceEx section of the install the value of %TEMP% has not been set (remember this one folks, if you try to use an undefined envvar bad things happen!) thus the use of %SystemRoot%\TEMP which IS set. In order to add additional WPI variables you need to pass more parameters from generate.js to grafix.cmd, and export them into customized templates.

Finally we have the two template files:

Tools\Grafix01.html

<html>
<head>
<title>WPI Grafix</title>
</head>
<body bgcolor="Black">
<br><br><br><br>
<div align=center><IMG SRC="file://

Be careful to NOT leave a blank line ^ after ^ this ^ line ^

Tools\Grafix02.html

NOTE the leading " which closes the filename section of the IMG tag!

" ALT="Installing Program" BORDER="0"></div><br>
<div align=center><font color="Red">Installing Program</font></div><br>
</body>
</html>

To Do/Bug List

IE Window Opens AFTER Install Window

- this hides the install window due to IE startup time. I added a ping of the localhost to try and force the IE window into the background, however I'll prob use something else as this doesn't work reliably.

IE opens a new window for each program installed

- Unfortunately I've been unable to get IE to reuse the same window for display thru reg hacks, so I'm working on several options to fix this. NOTE: this doesn't stop your installs from working, it just opens alot of IE windows then auto-closes them during reboot.

Template only shows a picture, where's the rest of the info?!?

- Still to be added, this is alpha quality, proof of concept, hacker stuff, so get hacking folks! :w00t:

I'll be posting more WPI hacks and suggestions soon, but for now enjoy this one!

DogMeat

Link to comment
Share on other sites


  • 2 weeks later...

I'll post some shots soon, I've been busy adding to the HTML template mostly, plus I've got the background windows closing like they should. Limited INet for me makes it tough to get on the forums :( Thanks for the interest, more to come.

Link to comment
Share on other sites

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...