![]() ?Run: Any executable to be executed after the installation is completed. ?Icons: The Application shortcuts: Start menu folders, etc. ?Files: Files to be copied to the User’s system. These scripts can be edited using any text editor, and they contain a set of directives that control the behavior of the installer. ?Tasks: Tasks to be performed by the setup during the installation. Inno Setup scripts are written in Pascal scripting language, which is a high-level programming language and can be used and learnt easily. ?Languages: List of languages supported. The PostCompile section is optional, and specifies any number of programs to execute after the Inno Setup compiler has successfully completed its compilation. ? Setup: This section consists of settings and application-related information like application name, publisher name, etc. ![]() Each section handles a specific function of the installation: In this script file, the contents are arranged in sections. InnoSetup script file is a simple text file with the extension “.iss”. The Inno Setup Example Scripts are located in a separate folder. It is a free tool that provides a rich feature set.Ĭreating the installer using Inno Setup involves the following two steps: If LoadScriptFromFile(FileName, CommandList) > 0 thenĪDOCommand.CommandText := CommandList ĪDOCommand.Inno Setup is an open-source compiler to create installers on windows. here is already established connection Procedure RunScript(const FileName: string) To add the script after the last GO - Govs More technically speaking, it is an additional layer between GUI (your. EDIT: If there is no GO syntax present int the file AND Using the Inno Setup IDE (from the online help) Inno Setup Scripts are arranged into sections. Inno Setup Preprocessor (ISPP) is an add-on for Jordan Russells Inno Setup compiler. SQLCommand := SQLCommand ScriptFile #13#10 If Pos('go', LowerCase(Trim(ScriptFile))) = 1 then Please note, that every SQL command is expected to be "terminated" by the GO command in the input file (that requires also your original code): function LoadScriptFromFile(const FileName: string out CommandList: TStrings): Integer The string concatenation with line breaks you have used should be fine for ADO connected to the SQL Server, I think.įor the sake of completness, here is what I'd write (untested!). I would remove it and write directly: for i := 0 to tString.Count - 1 doĮxcept the above (not so major) things I would say your code is fine. The len variable is used for only one purpose and its value is used only once, so it's actually useless there. In your code it applies to the tString object. You would first load the script from a file and then in the other part of the script iterate the parsed commands and execute each one.Īlways try to encose object finalization into a separate try.finally block. Having such function will isolate parsing and execution parts of the script. That function might have the following prototype: function LoadScriptFromFile(const FileName: string out CommandList: TStrings): Integer ![]() the generation of installations by allowing InnoSetup scripts to be created and. Standalone action like loading a script from file and splitting it into SQL commands by the GO command, I would move into a separate function. Free InnoIDE environment for Jordan Russels Inno Setup install system. MsgBox(GetExceptionMessage, mbError, MB_OK) Īny suggestion to update the code will be much appreciated. StrToQuery:='' //Clear the string to start adding till next GOĮnd else strToQuery:= strToQuery #13#10 str //Add the script to strToQuery If GO is found run the script added in to strToQuery since last GOĪDOCommand.Execute(NULL, NULL, adCmdText or adExecuteNoRecords) If I run manually, then installation works fine based on components checked. If POS('go', lowercase(str)) = 1 then begin I have a Inno setup script which has components and based on those components specific installation takes place. TString.LoadFromFile('C:\sqlscript.sql') 'Initial Catalog=databasename ' // default databaseĪDOCommand := CreateOleObject('ADODB.Command') ĪDOCommand.ActiveConnection := ADOConnection It is a great way to create Windows installers for your desktop apps so that you can easily deploy. 'Data Source=(local)\SQL2000 ' // server name Inno Setup is a free tool for creating Windows installers. ĪDOConnection := CreateOleObject('ADODB.Connection') I think this could be done in better ways. My code below splits the script at each GO statement and run each section separately. I added my own code to overcome this problem. However ADO gives an error if the script contains GO syntax within it. I am using this code to run my sql scripts in inno setup.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |