
// SAMPLE3.INF

// Setup Builder sample support file

// Copyright 1993 - 1996 Graham Plowman


// This sample demonstrates how the INST16.EXE module
// supplied with Setup Builder can be used as a
// generic script interpreter for adding little
// 'programs' on to Windows.

// This demonstration causes a dialog to appear
// from which you can select some programs to run.
// You need to place SAMPLE3.INI in your WINDOWS
// directory.
// You can attach this script file to a Program
// Manager icon in your StartUp group. In that way,
// when you start Windows, you can optionally select
// which programs you want to run.
// By default, the .INI file has been set up to run
// notepad, cardfile, clock and the calculator, but
// you can change this to any program you like.

// This small utility is useful if you want to
// 'quickly' start up Windows on your machine and not
// run all the items in your startup group: you simply
// code them into SAMPLE3.INI instead of the StartUp
// group and select the ones you want to run.


Set %Caption% = "Auto Program Run"
Set %IniFile% = "SAMPLE3.INI"

GetProfileString("Values", "Sel1", "0", %IniFile%, %BUTTON1%)
GetProfileString("Values", "Msg1", "", %IniFile%, %MESSAGE1%)

GetProfileString("Values", "Sel2", "0", %IniFile%, %BUTTON2%)
GetProfileString("Values", "Msg2", "", %IniFile%, %MESSAGE2%)

GetProfileString("Values", "Sel3", "0", %IniFile%, %BUTTON3%)
GetProfileString("Values", "Msg3", "", %IniFile%, %MESSAGE3%)

GetProfileString("Values", "Sel4", "0", %IniFile%, %BUTTON4%)
GetProfileString("Values", "Msg4", "", %IniFile%, %MESSAGE4%)

GetProfileString("Values", "Sel5", "0", %IniFile%, %BUTTON5%)
GetProfileString("Values", "Msg5", "", %IniFile%, %MESSAGE5%)

GetProfileString("Values", "Sel6", "0", %IniFile%, %BUTTON6%)
GetProfileString("Values", "Msg6", "", %IniFile%, %MESSAGE6%)

DialogBox("CHECKBOX6")
IF %ERROR% == IDCANCEL GOTO :END


// Save all the selections for next time

WriteProfileString("Values", "Sel1", %BUTTON1%, %IniFile%)
WriteProfileString("Values", "Sel2", %BUTTON2%, %IniFile%)
WriteProfileString("Values", "Sel3", %BUTTON3%, %IniFile%)
WriteProfileString("Values", "Sel4", %BUTTON4%, %IniFile%)
WriteProfileString("Values", "Sel5", %BUTTON5%, %IniFile%)
WriteProfileString("Values", "Sel6", %BUTTON6%, %IniFile%)


// Run the selected programs

IF %BUTTON1% == 0 GOTO :NOPROG1
GetProfileString("Values", "Prog1", "", %IniFile%, %Prog%)
WinExec(%Prog%)
:NOPROG1

IF %BUTTON2% == 0 GOTO :NOPROG2
GetProfileString("Values", "Prog2", "", %IniFile%, %Prog%)
WinExec(%Prog%)
:NOPROG2

IF %BUTTON3% == 0 GOTO :NOPROG3
GetProfileString("Values", "Prog3", "", %IniFile%, %Prog%)
WinExec(%Prog%)
:NOPROG3

IF %BUTTON4% == 0 GOTO :NOPROG4
GetProfileString("Values", "Prog4", "", %IniFile%, %Prog%)
WinExec(%Prog%)
:NOPROG4

IF %BUTTON5% == 0 GOTO :NOPROG5
GetProfileString("Values", "Prog5", "", %IniFile%, %Prog%)
WinExec(%Prog%)
:NOPROG5

IF %BUTTON6% == 0 GOTO :NOPROG6
GetProfileString("Values", "Prog6", "", %IniFile%, %Prog%)
WinExec(%Prog%)
:NOPROG6

:END
