Jump to content

Does WPI support parameters to the .hta file?


Recommended Posts

What I would like to be able to do is pass in a parameter when I execute the .hta file.

wpi.hta school

would be equivalent to opening wpi.hta and selecting "school" from the Selections drop down.

All the items in the config file that have this would be checked:

configs[pn]=['school']

Does WPI support this right now or would it be easy enough to hack?

Thanks!

Link to comment
Share on other sites


I figured it out.

Add these lines to WPI.hta:

<script language="javascript">

var params = oApp.commandLine.split(" ");

var wpiparam=params[params.length - 1];

if( wpiparam!='' ) load_checks = params[params.length - 1];

</script>

Link to comment
Share on other sites

NICE !

but , if you write WPI to a CD media , what is the difference for you

between this and checking <school on load> in options .

permanently you will have <school> checked on load .

i think maybe i dont understand your point ?

Link to comment
Share on other sites

  • 2 weeks later...

Nicely done, i implemented the code to my WPI and works great. But what if i would like to trigger the installation automatically with parameter, can that be done?

i.e. i type in commandline "wpi.hta school install" and then wpi checks school and automagically triggers install action??

EDIT: Figured it out:

<script

language="javascript">

var params = oApp.commandLine.split(" ");

var wpiparam=params[params.length - 1];

if( wpiparam!='' ) {

load_checks = params[params.length - 1];

timer = 'on';

secs = '5';

}

</script>

Edited by cribban
Link to comment
Share on other sites

I have 9 different configurations, i've tested so far with 5 of them and it worked flawlessly. I do not see any problems with using parameter.

I added the parameter code, right after the timers.js and before the handleerrors script. When looking at wpi.hta (from version 4.3.5) i added the code at line 111

I'm using WPI for network install here at work and am very happy with it, thanks to your hard work kelsenellenelvian! :thumbup

Link to comment
Share on other sites

This should do the trick, with this code you can type in "wpi.hta School 20" and it will select School and set timer to 20 seconds:

<script

language="javascript">

var params = oApp.commandLine.split(" ");

var wpiparam=params[params.length - 2];

var timeparams = oApp.commandLine.split(" ");

var wpitimeparam=timeparams[timeparams.length - 1];

if( wpiparam!='',wpitimeparam!='' ) {

load_checks = params[params.length - 2];

timer = 'on';

secs = timeparams[params.length - 1];

}

</script>

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