|
Launch a program on startup
Q: How do I add a program to the startup folder so it is run each time windows boots?
A: There are two common methods to make your program launch at system boot.
The first method is to add the following registry key: HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\{any name}. The key should contain the path to your program.
The second way is to add the program's shortcut to the Windows Startup menu. Just specify the following shortcut destination:
'${CommonStartupMenu}\MyProgram' or '${UserStartupMenu}\MyProgram'.
Selected installer language
Q: We need to find out what language the user has selected in the installer, and pass the information on to our application. However, we could not find a way to tell what language the user has selected. There does not seem to be an installer variable for it?
A: Actually, there are 3 installer variables for indicating the selected language:
${SelectedLangId} - contains the language ID (Windows LANGID) of the selected language. For example, "1031" for German.
${SelectedLangName} - contains the native (translated) name of the selected language. For example, "Deutch" for German.
${SelectedLangNameEn} - contains the English name of the selected language. For example, "German" for German.
For more information, refer to the installer variables reference.
Restart after install
Q: Is it possible to force a restart after the AWinstall installer completes?
A: Currently the simplest way to do this is to run a small script file.
VBScript Code:
Dim sysName = "winmgmts:{impersonationLevel=impersonate,(shutdown,remoteshutdown)}!//"
For Each os In GetObject(sysName).InstancesOf("Win32_OperatingSystem")
retCode = os.Win32Shutdown(4, 0)
Next
Save this code to a text file with .VBS extension. Add this file to the project, and add the "Run" command that will launch it after installation.
Open a "readme" file after installation
Q: Is this possible to open a text file after installation (as many installers do)?
A: Yes, the "Run" action allows you to do this. Just create a text file (for example, "readme.txt"). Add this file to the installation project, and then add the "Run" action that points to this file. Set the "Wait for finish" option to this Run command, and this file will be opened after successful installation.
This approach also works with another types of files: .HTM, .RTF and for any other extensions that are supported on the target system.
Extract an external program, execute and then delete it
Q: I'd like to run a third-party executable file "setup.exe" during the installation. Can I unpack this file to the temp folder, run it, and then delete?
A: Yes, AWinstall supports "auto-magical" cleaning of temporary files and folders. Just extract your third-party executable into the ${TempPath} folder, and then add the "Run" action with the "Wait for finish" option to the same task. After the task's completion all temporary files will be deleted.
Detect if the SQL Server 2005 Express is installed
Q: I need to detect whether the SQL Server 2005 Express is installed, and install it, if it isn't. How can I do this in my installation?
A: To detect the SQL Server 2005 Express installation, you just need to check this registry key:
HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\SQLEXPRESS\Setup\SQLPath
You can then launch the SQL Express installer (sqlexpr32.exe) in order to install this product. There is a sample VBScript snipped to illustrate this approach:
Name = "${REG:HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\SQLEXPRESS\Setup\SQLPath}"
Path = Installer.Variables(Name)
If Path = "" Then
MsgBox "Starting installation of MS SQL Server Express..."
Installer.RunProgram "${ProductPath}\sqlexpr32.exe", "", True
Else
MsgBox "SQL Server Express is already installed"
End If
|