Jump to content

A Challenge... Script required....


Recommended Posts

Right, here goes.....

I'm relatively new to this, but progressing.... fine with unattended builds, but I lack enough script knowledge to get to my desired goal....

am fine with RunOnceEx.cmd and expanding to RunonceEx2.cmd etc.....

but now I need/want to be more adventurous in having RunOnceEx3.cmd that can have included software installed as an option.....

Now my logic for how this would be done is as follows....

RunonceEx >>triggers>> RunonceEx2 >>triggers>> [selection menu] >>edits then triggers>> RunonceEx3...

[selection menu] - This would need to be a gui with 'checkable' selections... Now this is where you're all gonna say I'm wrong, or there's a better way, .....But i would like the script to work by editing and deleting the 'unchecked' values from RunOnceEx3.cmd The reason for this being that it would make it highly editable for myself and those others that would like a more app-configurable build., ...yet lack the knowledge.

This is where I hope someone can see this as a challenge and build a 'script' for me and others to follow to acheive this. I learn pretty quick so could expand on/modify a script once I have the basic layout.

Or to make things purrfect, to have a .bat/.exe file that reads a particular RunOnceEx.cmd [preferably by dragging/dropping], and then writes the appropriate [selection menu] script, saving it to file. Hence automating the script creation.

So please could someone take this up as a challenge.......

I know this is possible/plausible, .......and would be an invaluable little asset to a lot of folks on the site.

If there is simpler ways of doing this I would be grateful for your input, ......preferably with script examples.

All your advice and insight is gratefully welcome...... as am now a buildaholic....

This is my first post, ........hope you don't mind the 'teaser' I've submitted.

GREAT site, am addicted! .....my girlfreind hates you all........ lol

Edited by ray1301
Link to comment
Share on other sites


Thankyou.... I do have WPI but have not used it yet, as have been manually creating my .cmd files for the experience.

....however I still think that a scripted executionable would be a simpler and more practicle way to go.

I will look at WPI... thankyou for your responses...

Link to comment
Share on other sites

Here is a HTA that uses VBS scripting. I have left comments in it, this should get you started.

Save As UserSelect.hta

 <TITLE> « User Select Install »</TITLE>
<HTA:APPLICATION ID="User Select"
SCROLLFLAT ="No" SingleInstance="Yes"
SysMenu="Yes" MaximizeButton="No"
MinimizeButton="Yes" Border="Thin"
BORDERSTYLE ="complex" INNERBORDER ="No"
Caption="Yes" WindowState="Normal"
APPLICATIONNAME="UserSelect"
Icon="%Windir%\explorer.exe">
<STYLE Type="text/css">
Body
{
Font-Size:10.05pt;
Font-Weight:Bold;
Font-Family:Arial,Tahoma,Comic Sans MS,Segoe Ui;
Color:#001254;
BackGround-Color:Transparent;
Filter:progid:DXImageTransform.Microsoft.Gradient
(StartColorStr='#fdf7f1',endColorStr='#d1cbc5');
Margin-Top:1;
Margin-Bottom:1;
Margin-Left:4;
Margin-Right:4;
Padding-Top:1;
Padding-Bottom:1;
Padding-Left:4;
Padding-Right:4;
Text-Align:Center;
Vertical-Align:Top;
Border-Top:2px Solid #a6a29e;
Border-Bottom:3px Solid #cbc7c3;
Border-Left:2px Solid #b2aeaa;
Border-Right:3px Solid #bcb8b4;
}
.Fnt1
{
Font-Size:8.05pt;
Font-Weight:Bold;
Font-Family:Arial,Tahoma,Comic Sans MS,Segoe Ui;
Color:#004500;
Margin-Top:1;
Margin-Bottom:1;
Margin-Left:3;
Margin-Right:3;
Padding-Top:0;
Padding-Bottom:0;
Padding-Left:5;
Padding-Right:5;
}
.Fnt2
{
Font-Size:8.05pt;
Font-Weight:Bold;
Font-Family:Arial,Tahoma,Comic Sans MS,Segoe Ui;
Color:#004545;
}
.Fnt3
{
Font-Size:8.05pt;
Font-Weight:Bold;
Font-Family:Arial,Tahoma,Comic Sans MS,Segoe Ui;
Color:#ad1111;
}
</STYLE>
<script Language="VBScript">
'-> This ' Before Any Code In VBS Is A Comment That Ment To Be Read By The
'-> Person Reading The Code And Not Used At Runtime.
'-> Objects To Work With
Dim Act :Set Act = CreateObject("Wscript.Shell")
Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
'-> Get The Current Directory You Are Working In
Dim Loc
Loc = Act.CurrentDirectory
'-> Applicatio Paths
Dim App_01
App_01 = Loc & "\spybotsd152.exe"
Dim App_02
App_02 = Loc & "\ZZ_Desktop\iTunesSetup.exe"
Dim App_03
App_03 = Loc & "\ZZ_Desktop\LS_Update_1.12.37.1_.exe"
Dim App_04
App_04 = Loc & "\ZZ_Desktop\Install_Messenger.exe"
'-> Resize And Move Window
Dim Wth :Wth = int(625)
Dim Hht :Hht = int(375)
window.ResizeTo Wth, Hht
MoveTo ((Screen.Width / 2) - (Wth / 2)),((Screen.Height / 2) - (Hht / 2))
'-> When The Hta Opens This Is The First Function
Function Window_Onload()
Txt1.innerHTML = "<FONT CLASS='Fnt2'>Working Directory " & Loc & "</FONT>"
End Function
'-> Function For All The CheckBoxes OnClick
Function CheckForApp()
'-> Check To See If Box Is Checked
'-> Application 01
If App01.disabled = False Then '-> Checks To See If It Been Ran Before
If App01.Checked Then
'-> Check To See If File Exists
If Fso.FileExists(App_01) Then
Tx_App01.innerHTML = "Installing Spy Bot"
'-> Chr(34) = "
'-> This Is Used If There Is An Space In The Path EG: C:\Some Folder\My App.exe
'-> This Encloses The Path In Quotes EG: "C:\Some Folder\My App.exe"
'-> Uncomment To Make Active
'Act.Run(Chr(34) & App_01 & Chr(34) & " /q"),1,True
'-> Comment Or Remove This is Only To Show The Path And Install Switches
msgbox Chr(34) & App_01 & Chr(34) & " /q"
Tx_App01.innerHTML = "Spy Bot Install Completed"
App01.disabled=true
Else
Tx_App01.innerHTML = "<FONT CLASS='Fnt3'>Missing Spy Bot</FONT>"
End If
End If
End If
'-> Application 02
'-> Just Copy And Paste This Section And Change The Numbers Only
'-> App_02 Becomes App_03, Tx_App02 Becomes Tx_App03, App02 Becomes App03
'-> Start Copy
If App02.disabled = False Then
If App02.Checked Then
If Fso.FileExists(App_02) Then
Tx_App02.innerHTML = "Installing iTunes"
msgbox Chr(34) & App_02 & Chr(34) & " /s"
Tx_App02.innerHTML = "iTunes Install Completed"
App02.disabled=true
Else
Tx_App02.innerHTML = "<FONT CLASS='Fnt3'>Missing iTunes</FONT>"
End If
End If
End If
'-> End Copy
'-> Start Copy
If App03.disabled = False Then
If App03.Checked Then
If Fso.FileExists(App_03) Then
Tx_App03.innerHTML = "Installing Light Scribe"
msgbox Chr(34) & App_03 & Chr(34) & " /q"
Tx_App03.innerHTML = "Light Scribe Install Completed"
App03.disabled=true
Else
Tx_App03.innerHTML = "<FONT CLASS='Fnt3'>Missing Light Scribe</FONT>"
End If
End If
End If
'-> End Copy
'-> Start Copy
If App04.disabled = False Then
If App04.Checked Then
If Fso.FileExists(App_04) Then
Tx_App04.innerHTML = "Installing Msn Messenger"
msgbox Chr(34) & App_04 & Chr(34) & " /q"
Tx_App04.innerHTML = "Msn Messenger Install Completed"
App04.disabled=true
Else
Tx_App04.innerHTML = "<FONT CLASS='Fnt3'>Missing Msn Messenger</FONT>"
End If
End If
End If
'-> End Copy
Exit Function
End Function
</SCRIPT>
<BODY Scroll='No'>
<!-- Title -->
<DIV>Install Applications</DIV>
<!-- Text Display OnLoad -->
<DIV ID='Txt1'> </DIV>

<!-- Start App01, App02 -->
<TABLE ID='T_App01' Border='1'>
<!-- APPLICATION 01 -->
<TD ID='Tx_App01' Style='Width:175pt;Margin-Left;5pt;' Class='Fnt1'>Install Spy Bot</TD>
<TD Style='Width:;'>
<Input Type='CheckBox' ID='App01' OnClick='CheckForApp()'>
</TD>
<!-- APPLICATION 02 -->
<TD ID='Tx_App02' Style='Width:175pt;Margin-Left;5pt;' Class='Fnt1'>Install iTunes</TD>
<TD Style='Width:;'>
<Input Type='CheckBox' ID='App02' OnClick='CheckForApp()'>
</TD>
</TABLE>
<!--- End App01, App02 --->
<!--
Increase These Numbers As You Add More Apps
Tx_App03 Bexomes Tx_App05
App03 Becomes App05
Tx_App04 Bexomes Tx_App06
App04 Becomes App06
-->
<!--
Start Copy
-->
<!-- Start App03, App04 -->
<TABLE ID='T_App01' Border='1'>
<!-- APPLICATION 03 -->
<TD ID='Tx_App03' Style='Width:175pt;Margin-Left;5pt;' Class='Fnt1'>Install Light Scribe</TD>
<TD Style='Width:;'>
<Input Type='CheckBox' ID='App03' OnClick='CheckForApp()'>
</TD>
<!-- APPLICATION 04 -->
<TD ID='Tx_App04' Style='Width:175pt;Margin-Left;5pt;' Class='Fnt1'>Install Msn Messenger</TD>
<TD Style='Width:;'>
<Input Type='CheckBox' ID='App04' OnClick='CheckForApp()'>
</TD>
</TABLE>
<!--- End App03, App04 --->
<!--
End Copy
-->
</BODY>

Link to comment
Share on other sites

Hmmmmn....... Thanks for the script....

......even though I now feel like a goldfish dropped in the Atlantic. ???!!??? lol.

I think I can get my head around the script to modify, ......albeit that I have no experience regarding .hta files and how to run them.

Looks like I'm in for a lot of reading....

Cheers, .....will post how I get on.

Link to comment
Share on other sites

Hmmmmn....... Thanks for the script....

......even though I now feel like a goldfish dropped in the Atlantic. ???!!??? lol.

I think I can get my head around the script to modify, ......albeit that I have no experience regarding .hta files and how to run them.

Looks like I'm in for a lot of reading....

Cheers, .....will post how I get on.

AAAAAAH?? Got it I think. Thanks again.

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