MSFN Forum: Does WPI support parameters to the .hta file? - MSFN Forum

Jump to content



  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Does WPI support parameters to the .hta file? Rate Topic: -----

#1 User is offline   myemail7 

  • Group: Members
  • Posts: 3
  • Joined: 27-April 04

Posted 30 November 2005 - 03:58 PM

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!


#2 User is offline   Kelsenellenelvian 

  • WPI Guru
  • Group: Developers
  • Posts: 7,652
  • Joined: 18-September 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 30 November 2005 - 04:09 PM

No it doesn't support switches and as for me I can't get that figured out.

#3 User is offline   myemail7 

  • Group: Members
  • Posts: 3
  • Joined: 27-April 04

  Posted 01 December 2005 - 09:23 AM

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>

#4 User is offline   oneless 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 374
  • Joined: 07-January 05

Posted 03 December 2005 - 04:16 AM

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 ?

#5 User is offline   myemail7 

  • Group: Members
  • Posts: 3
  • Joined: 27-April 04

Posted 07 December 2005 - 11:32 AM

I am creating a multi-boot DVD with multiple WINNT.SIF files. Each one will have a different [GuiRunOnce] section that will be loading different applications.

#6 User is offline   cribban 

  • Group: Members
  • Posts: 8
  • Joined: 14-December 05

Posted 20 December 2005 - 07:27 AM

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>

This post has been edited by cribban: 20 December 2005 - 09:37 AM


#7 User is offline   Kelsenellenelvian 

  • WPI Guru
  • Group: Developers
  • Posts: 7,652
  • Joined: 18-September 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 21 December 2005 - 12:29 AM

How much have you tested this?

I want to include commandlines in the next release.

Also where in WPI.hta did you add that section.

#8 User is offline   cribban 

  • Group: Members
  • Posts: 8
  • Joined: 14-December 05

Posted 21 December 2005 - 04:06 AM

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

#9 User is offline   Kelsenellenelvian 

  • WPI Guru
  • Group: Developers
  • Posts: 7,652
  • Joined: 18-September 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 21 December 2005 - 04:12 AM

So you are calling it like so:

start /wait %windir%\system32\mshta.exe "%CD%\wpi.hta school"

#10 User is offline   cribban 

  • Group: Members
  • Posts: 8
  • Joined: 14-December 05

Posted 21 December 2005 - 04:33 AM

yes, correct

#11 User is offline   Kelsenellenelvian 

  • WPI Guru
  • Group: Developers
  • Posts: 7,652
  • Joined: 18-September 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 21 December 2005 - 04:37 AM

With your modifications the timer is set yet nothing is checked for me.

#12 User is offline   cribban 

  • Group: Members
  • Posts: 8
  • Joined: 14-December 05

Posted 21 December 2005 - 05:00 AM

Keep in mind, it is case-sensitive, it has to be typed in exactly as it is written in the configuration files. Maybe it can be done so it is not case-sensitive

#13 User is offline   Kelsenellenelvian 

  • WPI Guru
  • Group: Developers
  • Posts: 7,652
  • Joined: 18-September 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 21 December 2005 - 05:08 AM

PERFECT!!! Thanks m8 works beautifully and can even select the All option.

#14 User is offline   Kelsenellenelvian 

  • WPI Guru
  • Group: Developers
  • Posts: 7,652
  • Joined: 18-September 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 21 December 2005 - 05:21 AM

@ cribbon could you modify it so the timer can be set in the commandline please?

#15 User is offline   cribban 

  • Group: Members
  • Posts: 8
  • Joined: 14-December 05

Posted 21 December 2005 - 08:09 AM

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>

#16 User is offline   Kelsenellenelvian 

  • WPI Guru
  • Group: Developers
  • Posts: 7,652
  • Joined: 18-September 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 21 December 2005 - 09:48 AM

Thank you very much Look for a new release in the next couple of days.

#17 User is offline   Kelsenellenelvian 

  • WPI Guru
  • Group: Developers
  • Posts: 7,652
  • Joined: 18-September 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 21 December 2005 - 10:36 AM

OK found a bug in you last set of code. When wpi is run normally Without switches the display on the clock is messed up do you think you can fix it?

#18 User is offline   cribban 

  • Group: Members
  • Posts: 8
  • Joined: 14-December 05

Posted 21 December 2005 - 01:34 PM

Ok, i'll admit i'm not very good with javascript stuff, but here's another go at it. The secs parameter is now limited to 3 digits (however, when triggering "wpi.hta School 120" the timer does not list 2:00 instead it says 0:120 do not know why, maybe should limit it to 2 digits you decide). Anyway, the code:

<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!='' && wpitimeparam.length < 4))
{
load_checks = params[params.length - 2];
timer = 'on';
secs = timeparams[params.length - 1];
}
</script>

#19 User is offline   Kelsenellenelvian 

  • WPI Guru
  • Group: Developers
  • Posts: 7,652
  • Joined: 18-September 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 21 December 2005 - 04:35 PM

Thanks all seems to be good here now.

#20 User is offline   cribban 

  • Group: Members
  • Posts: 8
  • Joined: 14-December 05

Posted 22 December 2005 - 02:14 AM

I checked out the new manual, and noticed you say it is supported to write "wpi.hta School" and also "wpi.hta School 20" for the timer, that is not true. However, i revised the code a third time and now that all seems to work (could you please verify that for me):

<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 (wpitimeparam!='')
{
load_checks = params[params.length -1];
}
if (wpiparam!='' && (wpitimeparam!='' && wpitimeparam.length < 4))
{
load_checks = params[params.length - 2];
timer = 'on';
secs = timeparams[params.length - 1];
}
</script>

Share this topic:


  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy