home *** CD-ROM | disk | FTP | other *** search
Wrap
' ^^^^^^^^^^ ' This program is configured in table part: Choose radio button Table ' ' StepOne Installation ' *************************************************************************************************** ' Version 3.0 ' Copyright K&R Software - Markus Kreisel & Renate Reinartz GbR, Cologne ' *************************************************************************************************** ' Hint: ' You're allowed to use this script or parts of changed or unchanged in your StepOne ' installation. ' This script features professional installations for Windows and is full of hints and ' examples for your work with StepOne. ' If you change the table part (view: Table) of the script to your needs, ' you have a very good installation. ' One of the highlights of StepOne is the possibility to improve this installation script with ' the powerful script language, so you have full control of the whole installation process. ' ' If you start this script within StepIt, the StepOne FastCodeBuilder, you have to set the path ' of the to be copied files with menue FASTCODE - SETTINGS - COMMANDLINE, i.e. 'a:'. ' If the path is followed with a space and -1, you're abled to get the information that ' StepOne was started within StepIt. ' *************************************************************************************************** ' *************************************************************************************************** ' The command line (View: FastCode - Settings - Commandline)which StepIt.exe or Install.exe (FirstStep) ' passes through is saved in a variable. len "ln", "{_command}" If "{ln}" = "0" Label "NoSourcePath" pathbox "command", "Please choose the path of the to be installed files.", "Choose source path", "{_bootdrv}\", "", "", "0", "&OK" Else Let "command", "{_command}" EndIf DirExist "res", "{command}" If "{res}" = "0" goto "NoSourcePath" endif split "sourcepath", "{command}","32","1" split "StepIt", "{command}","32","2" ' *************************************************************************************************** Let "prgname", "{prginfos[1;1]}" Let "mainprg", "{prginfos[2;1]}" ' Look if program runs gosub "CheckPrg","{mainprg}" ' Welcome the user and give hints of using the installation gosub "Welcome" ' Checking VBX files if they are loaded or installed in the Windows directory gosub "CheckLibraries" label "CopyLoop" ' The user can choose the installation path gosub "GetTargetPath", "{prginfos[3;1]}" ' Create the choosen path gosub "CreatePath" if "{path}" = "0" ' If create operation fails or user choosed anything other goto "CopyLoop" endif ' Install files gosub "Copying" if "{space}" = "-1" ' Copying failed because of unsufficient disk space. ' User has to choose another drive. goto "CopyLoop" endif ' Add icon(s) in Program Manager group gosub "ProgMan" ' Add Extension(s)in Registration Database gosub "RegBase" ' Edit program INI file(s) gosub "PrgINIs" ' Inform user about end of installation. ' Name of program is passed through ' to give user the possibility to start ' program immediately. gosub "PrgEnd","{TargetPath}\{MainPrg}" ' End of installation end ' *************************************************************************************************** sub "Welcome" IniRead "OldWallpaper", "", "Desktop", "Wallpaper" IniRead "OldWallpaperPos", "", "Desktop", "TileWallPaper" SetWallPaper "{SourcePath}\install2.bmp", "-1" ' Temporary change. If user aborts installation the old one reappears after next ' start of Windows. After correct end of installation the old wallpaper is set. IniWrite "", "Desktop", "Wallpaper","{OldWallpaper}" IniWrite "", "Desktop", "TileWallpaper","{OldWallpaperPos}" ' Show main window window "-1", "{prgname} Installation", "Welcome", "Welcome to {prgname} installation. Installation leads you through all needed parts.{_nl}{_nl}Choose Continue to start installation.{_nl}{_nl}Choose Ctrl and C together to abort installation.", "{SourcePath}\install1.bmp", "43;23;960;888", "3" ' Plays the MIDI file, which is delivered with Windows. ' canyon.mid has to be installed and a sound card has to be installed correctly. mcisend "", "Open {_windowsdir}\canyon.mid type sequencer alias midisong" if "{_err}" = "0" mcisend "", "play midisong" let "midiplaying", "-1" endif getuserinput "&Continue" endsub ' *************************************************************************************************** sub "GetTargetPath" parameter TargetPath window "-1", "", "Choose target path", "Please choose the path, where {prgname} should be installed to." FileSearch "d", "{MainPrg}" if "{d}" = "" Let "Default", "{_windowsdir}\.." Let "Default2", "{GetTargetPath:TargetPath}" else Splitpathname "d", "{d}", "1" Splitpathname "Default", "{d}", "1" Splitpathname "Default2", "{d}", "2" endif label "GetTargetPath1" pathbox "TargetPath", "Please choose the path for {prgname}.", "", "{Default}\", "{Default2}", "", "0", "&OK;&Cancel" if "{TargetPath}" = "" askend goto "GetTargetPath1" endif endsub ' *************************************************************************************************** ' New VBX and DLL files can be installed if they aren't loaded. sub "CheckLibraries" ' If installation program is started within StepIt, check for libraries ' isn't neccessary. StepIt uses ' cscombo.vbx, csdialog.vbx, csform.vbx, ss3d.vbx, ss3d2.vbx, qpro200.dll ' Some installation programs would fail at this point. ' If you don't use the libraries you should set the if selection as remark. if "{StepIt}" <> "-1" ' Gets number of elements gettableelementcount "number_vbx", "vbxtable" for "i", "1", "{number_vbx}" fileexist "wfound", "{_windowsdir}\{vbxtable[1;i]}" if "{wfound}" = "-1" gosub "CorrectVBX", "{i}" endif next endif endsub ' ********************************************************************************************* sub "CorrectVBX" Parameter "iVbx" Label "Active" 'Copies a common used file from windows to system directory to force version control 'It isn't checked if any of the common used files are installed anywhere on the users 'system. So, nevertheless version conflicts may occure. But this procedure 'fixed the common mistake to install vbx and dll in the windows directory. istaskactive "res", "{vbxtable[1;i]}" if "{res}" = "-1" msgbox "res", "'{vbxtable[1;i]}' is in use. Please exit the application which uses the file and try it again.{_NL}If you aren't sure which application uses the library please exit all applications except of the Program Manager and this program.", "", "&Retry;&Program End" if "{res}" = "2" gosub CloseAll end else goto "Active" endif else msgbox "correct", "'{vbxtable[1;i]}' was found in your Windows directory. {_nl}Libraries like '{vbxtable[1;i]}' should be installed in System directory.{_nl}Should installation program '{vbxtable[1;i]}' correct the problem? To be sure that '{prgname}' runs correctly you should choose 'Correct'!", "", "&Correct;&Ignore" if "{correct}" = "1" copy "{_windowsdir}\{vbxtable[1;i]}", "{_systemdir}\{vbxtable[1;i]}", "2" if "{_err}" = "0" del "{_windowsdir}\{vbxtable[1;i]}" else outbox "'{vbxtable[1;i]}' couldn't be moved to System directory. If '{prgname}' doesn't run you should repeat the installation." endif endif endif endsub ' *************************************************************************************************** sub "CheckPrg" parameter "p" label "CheckPrg2" istaskactive "res","{CheckPrg:p}" if "{res}" = "-1" msgbox "ret", "{CheckPrg:p} is running. To install a newer version of it you have to close it first. Should installation program close {CheckPrg:p} for you?", "", "&Task close;&Retry;&Program End" if "{ret}" = "1" taskstop "{CheckPrg:p}" endif if "{ret}" = "3" gosub CloseAll End endif goto "CheckPrg2" else goto "CheckPrg1" endif label "CheckPrg1" endsub ' *************************************************************************************************** sub "CreatePath" direxist "res", "{TargetPath}" if "{res}" = "0" msgbox "res", "'{TargetPath}' doesn't exist.{_nl}Do you want to create path?", "", "&Create;Choose &another;&Program End" if "{res}" = "3" gosub CloseAll end endif if "{res}" = "2" let "path", "0" goto "CreatePath1" endif mkdir "{TargetPath}" if "{_err}" = "-1" outbox "During creation of path '{TargetPath}' appears an error. Please choose another path." let "path", "0" else gosub "SubDirectories" endif else gosub "SubDirectories" endif label "CreatePath1" endsub ' *************************************************************************************************** sub "SubDirectories" mkdir "{TargetPath}\samples" if "{_err}" = "-1" outbox "During creation of path '{TargetPath}\samples' occures an error. Please choose another path." let "Path", "0" else mkdir "{TargetPath}\redist" if "{_err}" = "-1" outbox "During creation of path '{TargetPath}\redist' occures an error. Please choose another path." let "Path", "0" else let "Path", "-1" endif endif endsub ' *************************************************************************************************** sub "Copying" if "{_windowsversion}" < "310" 'let "systab" , "systemtable30" OutBox "The version of StepOne Pro we uploaded in CompuServe doesn't include the files for MS Windows 3.0. Please contact us for further information at 100116,2133." else let "systab" , "systemtable" endif let "systab" , "systemtable" splitpathname "todrv", "{TargetPath}", "5" if "{midiplaying}" = "-1" mcisend "", "pause midisong" endif getdiskfree "tempfree", "{_tempdir}" if "{tempfree}" < "1000000" msgbox "ret", "Installation needs about one megabyte temporary disk space in path '{_tempdir}'. Your system hasn't this space free. Free enough disk space and restart installation. Choose 'Ignore' to continue installation.", "", "&OK;&Ignore" if "{ret}" = "1" gosub CloseAll end endif endif ' StepOne calcs the total of all file lengths and substracts the sum of ' the file lengths which will be overwritten. The minimum isn't 0 ' indeed it is the length of the longest file, which should be installed ' if the installation is on the same drive as temp drive. calcfiletable "targetbytes", "targettable", "{sourcepath}", "{targetpath}", "3" msgbox "samplesflag", "Do you want to install the samples?", "", "&Install;&Skip" if "{samplesflag}" ="1" ' While the samples are packed into 3 packed files and every file needs ' at least 2K in the target we assume aprox. 1MB. compute "targetbytes", "{targetbytes}" + "1000000" endif calcfiletable "systembytes", "{systab}", "{sourcepath}", "{_systemdir}", "3" ' Checks if two given paths have the same drive name if "{_systemdir}" := "{targetpath}" compute "tofreebytes","{tofreebytes}" + "{targetbytes}" else getdiskfree "systemfreebytes", "{_systemdir}" if "{systembytes}" > "{systemfreebytes}" outbox "Drive{_nl}'{todrv}'{_nl}hasn't enough disk space free. {systembytes} Bytes free disk space required.{_nl}Please free enough disk space and retry installation." gosub CloseAll end endif endif getdiskfree "tofreebytes", "{targetpath}" if "{targetbytes}" > "{tofreebytes}" outbox "Drive{_nl}'{todrv}'{_nl}hasn't enough disk space free. Please choose another drive." let "space", "-1" goto "copy_end" else window "-1", "", "Copying program...", "Copying has up to three parts. Please be patient..." copyfiletable "targettable", "{sourcepath}", "{targetpath}", "1", "0" if "{_err}" = "-1" msgbox "res", "During copying an error occures. Do you want to continue with installation?", "", "&OK;&Program end" if "{res}" = "2" gosub CloseAll end endif endif if "{StepIt}" <> "-1" if "{samplesflag}" = "1" window "-1", "", "Copying samples..." copyfiletable "sampletable", "{sourcepath}\samples", "{targetpath}\samples", "3", "0" if "{_err}" = "-1" msgbox "res", "During copying an error occures. Do you want to continue with installation?", "", "&OK;&Program end" if "{res}" = "2" gosub CloseAll end endif endif endif window "-1", "", "Copying system files..." copyfiletable "{systab}", "{sourcepath}", "{_systemdir}", "1", "0" 'Make sure, dialog will be closed copyfiletable if "{_err}" = "-1" msgbox "res", "During copying an error occures. Do you want to continue with installation?", "", "&OK;&Program end" if "{res}" = "2" gosub CloseAll end endif endif endif let "space", "0" endif if "{midiplaying}" = "-1" mcisend "", "play midisong" endif if "{samplesflag}" = "1" window "-1", "", "Building examples", "StepOne is building the examples.{_NL}{_NL}Part one of three.{_NL}{_NL}Please be patient." gosub "SplitFile", "{targetpath}\samples\example1.txt", "{targetpath}\samples" del "{targetpath}\samples\example1.txt" window "-1", "", "", "StepOne is building the examples.{_NL}{_NL}Part two of three.{_NL}{_NL}Please be patient." gosub "SplitFile", "{targetpath}\samples\example2.txt", "{targetpath}\samples" del "{targetpath}\samples\example2.txt" window "-1", "", "", "StepOne is building the examples.{_NL}{_NL}Last part.{_NL}{_NL}Please be patient." gosub "SplitFile", "{targetpath}\samples\example3.txt", "{targetpath}\samples" del "{targetpath}\samples\example3.txt" endif label "copy_end" endsub sub "SplitFile" Parameter "fname", "targetpath" textread "s", "{SplitFile:fname}", "0" for "i", "1", "1024" compute "j","{i}" * "2" split "p", "{s}", "º", "{j}" if "{p}" = "" exitfor endif compute "j","{j}" + "1" split "p1", "{s}", "º", "{j}" Textwrite "{SplitFile:targetpath}\{p}", "{p1}", "0", "-1" next endsub ' *************************************************************************************************** sub "ProgMan" ' Get number of elements gettablelinecount "number_prg", "prgmantable" if "{number_prg}" > "0" window "-1", "", "Install icons...", "Please be patient..." let "i", "1" let "mark","" label "ProgMan1" if "{mark}" <> "{prgmantable[i;1]}" let "mark", "{prgmantable[i;1]}" ddeexecute "ProgMan", "ProgMan", "", "[creategroup({prgmantable[i;1]})]" if "{_err}" = "-1" outbox "Group '{prgmantable[i;1]}' couldn't be created in Program Manager." endif endif gosub "icon","{prgmantable[i;1]}","{targetpath}\{prgmantable[i;2]}","{prgmantable[i;3]}" compute "i", "{i}" + "1" if "{i}" <= "{number_prg}" goto "ProgMan1" endif endif endsub ' *************************************************************************************************** sub "Icon" parameter "group","name","text" ' Sets the group window so that 'replaceitem' can find the group window ddeexecute "ProgMan", "ProgMan", "", "[showgroup({icon:group},1)]" ddeexecute "ProgMan", "ProgMan", "", "[showgroup({icon:group},2)]" ' Deletes icon and saves position... ddeexecute "ProgMan", "ProgMan", "", "[replaceitem({icon:text})]" ' ... Additem can use it ddeexecute "ProgMan", "ProgMan", "", "[additem({icon:name},{icon:text},,)]" if "{_err}" = "-1" outbox "Icon of '{prgname}' couldn't be created in Program Manager." endif ' Brings group window on top, so user can find it immediately. ddeexecute "ProgMan", "ProgMan", "", "[showgroup({icon:group},1)]" endsub ' *************************************************************************************************** sub "RegBase" ' Gets number of elements gettablelinecount "number_reg", "regbasetable" if "{number_reg}" > "0" let "i", "1" label "RegBase1" RegBaseWrite "{regbasetable[i;2]}", "{regbasetable[i;3]}" RegBaseWrite "{regbasetable[i;3]}", "{regbasetable[i;4]}" RegBaseWrite "{regbasetable[i;3]}\shell\open\command", "{targetpath}\{regbasetable[i;5]}" if "{regbasetable[i;1]}" <> "CMD" RegBaseWrite "{regbasetable[i;3]}\shell\open\ddeexec", "{regbasetable[i;6]}" RegBaseWrite "{regbasetable[i;3]}\shell\open\ddeexec\application", "{regbasetable[i;7]}" RegBaseWrite "{regbasetable[i;3]}\shell\open\ddeexec\topic", "{regbasetable[i;8]}" endif compute "i", "{i}" + "1" if "{i}" <= "{number_reg}" goto "RegBase1" endif endif endsub ' *************************************************************************************************** sub "PrgINIs" gettablelinecount "number_ini", "initable" if "{anzahl_ini}" > "0" let "i","1" label "PrgINIs1" INIWrite "{initable[i;1]}","{initable[i;2]}","{initable[i;3]}","{initable[i;4]}" compute "i", "{i}" + "1" if "{i}" <= "{number_ini}" goto "PrgINIs1" endif endif endsub ' *************************************************************************************************** sub "PrgEnd" parameter "Name" textread "txt","{targetpath}\readme.txt" window "-1", "", "Ready!", "We got it. Installation of '{prgname}' is ready. You can start '{prgname}' from Program Manager.{_nl}{_nl}{txt}" getuserinput "&OK" msgbox "res", "Do you want to start '{prgname}' now?", "", "&Start;&Program end" if "{res}" = "1" taskstart "{PrgEnd:name}" endif ' What someone opens, someone has to close. gosub CloseAll endsub ' *************************************************************************************************** sub "_ctrlc" resstringread "title","","26" resstringread "buttons","","1" msgbox "end", "{title}", "", "{buttons}" if "{end}" = "1" ' What someone opens, someone has to close. gosub CloseAll end endif endsub ' *************************************************************************************************** sub "CloseAll" if "{midiplaying}" = "-1" mcisend "", "close midisong" endif SetWallPaper "{OldWallPaper}","{OldWallpaperPos}" endsub