Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - DOS batch file -based installer going VS scripting - need moredirection

Reply
 
Old 03-09-2009   #1 (permalink)
DL


 
 

DOS batch file -based installer going VS scripting - need moredirection

My current installer essentially uses 10 plus DOS batch files, the
Main one controls the
installation process flow, however, the DOS screen is discouraging to
many users, hence,
I'd like to make it GUI ish, like using Windows for user interface.

It was recommended to me that VB scripting could be a viable option.
Please take a few minutes to review the following code and advise if
I'm going in the right direction, too bad, I'm not a VB scripting
developer but am comfortable with scripting...
thanks in advance.

rem Code starts

rem Section 1 -- define the installer to use VBscript
@echo off
wscript.exe c:\interface.vbs
rem interface.vbs being my VB script for the installer interface
rem (put your batch file commands here)
rem my current Main controller batch file


' so, the interface.vbs should look like the following two sections,
yes?
'
' Section 2 -- initialization
iDelay = 60 'seconds
Set oWshShell = CreateObject("WScript.Shell")
iTime = Timer
Do
oWshShell.Popup "Please wait while the PC settles down!", _
iDelay, "Message from your PC", 0
if Timer - iTime >= iDelay then Exit Do
Loop
MsgBox "OK, you can use the PC now, Mum", 6, "Message from your PC"
' what would determine the initiazation time?

' Section 3 -- run the main code block
DQ = """"
sBatch = "c:\MyProgram\Batch File.bat"
' just for clarity, the above batch file should be my MAIN batch file
Set oWshShell = CreateObject("WScript.Shell")
oWshShell.run "cmd.exe /c " & DQ & sBatch & DQ
' the author later advised to consider change the above line to the
following
oWshShell.exec "cmd.exe /c " & DQ & sBatch & DQ

' Q1
' how to bring up a Window that reads multiple license text files,
then with a label like "You Agree to this Agreement [x] and "You Do
not Agree to this Agreement" [x] , [Next] button at bottom
' not MsgBox command

'Q2
' does the last line of code in the above Section 3 imply that the
Main batch controller can still very much function the same such as
calling another batch file and pasing its execution result back to the
caller etc.?

'Q3
' currently the program supports both XP and Vista and since each's
internal/Windows Installer differs a bit, I simply created two
separate installers of XP_installer.bat and Vista_installer.bat while
each calls
all the same sub-routines (com1.bat, com2.bat etc.). But I'd like to
just use one Installer.bat and let VB script to detect current OS and
decide which Windows Installer to use, how?

oWshShell.exec "cmd.exe /c " & DQ & sBatch & DQ

My System SpecsSystem Spec
Old 03-10-2009   #2 (permalink)
Pegasus


 
 

Re: DOS batch file -based installer going VS scripting - need more direction


"DL" <tatata9999@xxxxxx> wrote in message
news:2047804d-6467-401c-ad7b-8a8db087e5a0@xxxxxx
Quote:

> My current installer essentially uses 10 plus DOS batch files, the
> Main one controls the
> installation process flow, however, the DOS screen is discouraging to
> many users, hence,
> I'd like to make it GUI ish, like using Windows for user interface.
<snip>

Instead of trying to bend code fragments from an unrelated thread to suit
your own requirements, you should build things up from the ground, learning
while you go how to write simple VB Script code. If I understand your
lengthy post correctly then these are your major tasks:

1. Pop up a "Wait" dialog box. (Why?)
2. Read a number of text files.
3. Ask the user to agree to each licensing text.
4. If the use disagrees with any one of the agreements, terminate the
program.
5. If full agreement is reached, pass control back to the calling batch
file.

For starters I recommend you write a little VB Script program for Steps 2
and 3. Use the File System Object to read a text file, then use the msgbox
function to obtain the user's agreement. By the way - VB Script does not
have elements such as tick boxes. "Msgbox", "inputbox" and the "popup"
method is all you get.

Here is a very simple code fragment to get you started when reading a text
file:

sFileName = "d:\temp\test.txt"
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFile = oFSO.OpenTextFile(sFileName, 1)
Do While Not oFile.AtEndOfStream
sLine = oFile.ReadLine
WScript.Echo sLine
Loop
oFile.Close

On a different subject: At some stage you need to decide whether you wish to
develop a VB Script solution or if you prefer a solution based on various
console commands, if only to avoid the duplication of effort that comes with
maintaining independent threads in different newsgroups.


My System SpecsSystem Spec
Old 03-10-2009   #3 (permalink)
DL


 
 

Re: DOS batch file -based installer going VS scripting - need moredirection

On Mar 10, 3:49*am, "Pegasus" <n...@xxxxxx> wrote:
Quote:

> "DL" <tatata9...@xxxxxx> wrote in message
>
> news:2047804d-6467-401c-ad7b-8a8db087e5a0@xxxxxx>My current installer essentially uses 10 plus DOS batch files, the
Quote:

> > Main one controls the
> > installation process flow, however, the DOS screen is discouraging to
> > many users, hence,
> > I'd like to make it GUI ish, like using Windows for user interface.
>
> <snip>
>
> Instead of trying to bend code fragments from an unrelated thread to suit
> your own requirements, you should build things up from the ground, learning
> while you go how to write simple VB Script code. If I understand your
> lengthy post correctly then these are your major tasks:
>
> 1. Pop up a "Wait" dialog box. (Why?)
> 2. Read a number of text files.
> 3. Ask the user to agree to each licensing text.
> 4. If the use disagrees with any one of the agreements, terminate the
> program.
> 5. If full agreement is reached, pass control back to the calling batch
> file.
>
> For starters I recommend you write a little VB Script program for Steps 2
> and 3. Use the File System Object to read a text file, then use the msgbox
> function to obtain the user's agreement. By the way - VB Script does not
> have elements such as tick boxes. "Msgbox", "inputbox" and the "popup"
> method is all you get.
>
> Here is a very simple code fragment to get you started when reading a text
> file:
>
> sFileName = "d:\temp\test.txt"
> Set oFSO = CreateObject("Scripting.FileSystemObject")
> Set oFile = oFSO.OpenTextFile(sFileName, 1)
> Do While Not oFile.AtEndOfStream
> *sLine = oFile.ReadLine
> *WScript.Echo sLine
> Loop
> oFile.Close
>
> On a different subject: At some stage you need to decide whether you wishto
> develop a VB Script solution or if you prefer a solution based on various
> console commands, if only to avoid the duplication of effort that comes with
> maintaining independent threads in different newsgroups.
Well, thanks the ideas and sample VBS code, I've decided to drop VB
script solution, and opted to a third party tool
that can essentially do the same and leaving my current batch files
intact except the Main controller and with a small footer print, too
bad this particular tool, called Wizard Apprentice, still keeps a
normal DOS screen while its GUI window shows up, I would wish the DOS
screen is minimized/folded, or if the current Window can be loaded
right on top of the DOS screen then user won't see the DOS one.
Someone suggested to use another third party just to minimize the DOS,
but that's too convoluted ...



My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Scripting file types VB Script
Re: batch scripting VB Script
Need help converting DOS batch-driven installer intoVBScripting-driven one VB Script
batch file calling exe file problem Vista security
Need help with batch file Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46