1
votes

The Script

I have created this simple script:

[ISPP]
; SignTool parameters
#define SignedDesc "$qxxx$q"
#define SignedPfx "$qxxx$q"
#define SignedTimeStamp "$qhttp://timestamp.verisign.com/scripts/timestamp.dll$q"
#define SignedPw "$qxxx$q"

#define AppURL "http://www.publictalksoftware.co.uk"
#define AppPublisher "Andrew Truckle"

[Setup]
DisableReadyPage=True
DisableReadyMemo=True
DisableFinishedPage=True
UsePreviousSetupType=False
UsePreviousTasks=False
UsePreviousLanguage=False
FlatComponentsList=False
AlwaysShowComponentsList=False
ShowComponentSizes=False
AppName=Public Talks Help Documentation
AppVersion=19.0.0
CreateAppDir=False
Uninstallable=no
OutputBaseFilename=PublicTalksHelpDocumentationSetup
SourceDir=D:\My Programs\2019\CommunityTalks\HelpNDoc\CHM
SignTool=SignTool /d {#SignedDesc} /du $q{#AppURL}$q /f {#SignedPfx} /p {#SignedPw} /t {#SignedTimeStamp} /v $f
AppId={{xxx}

[Files]
Source: "CommunityTalks.chm"; DestDir: "{app}"; Flags: ignoreversion

As you can see, it is very simple. It is designed to be executed by my main application.


Testing

I decided to try and mimic what my application will be doing by testing with a batch file. Here is the batch file command:

PublicTalksHelpDocumentationSetup /SP- /VERYSILENT /DIR="C:\Program Files (x86)\Public Talks" /LOG=".\TestInstallLog.txt"

The Results

On the surface I thought it worked. I did not see anything on the screen except being asked permission for the application to run. But I could not find the file in the stated DIR folder.

So I had another look at the log:

2019-05-31 21:32:02.971   Log opened. (Time zone: UTC+01:00)
2019-05-31 21:32:02.971   Setup version: Inno Setup version 6.0.2 (u)
2019-05-31 21:32:02.971   Original Setup EXE: D:\My Programs\2019\CommunityTalks\HelpNDoc\CHM\Output\PublicTalksHelpDocumentationSetup.exe
2019-05-31 21:32:02.971   Setup command line: /SL5="$15002A,25665310,721408,D:\My Programs\2019\CommunityTalks\HelpNDoc\CHM\Output\PublicTalksHelpDocumentationSetup.exe" /SPAWNWND=$30900 /NOTIFYWND=$30914 /SP- /VERYSILENT /DIR="C:\Program Files (x86)\Public Talks" /LOG=".\TestInstallLog.txt"
2019-05-31 21:32:02.971   Windows version: 10.0.17763  (NT platform: Yes)
2019-05-31 21:32:02.972   64-bit Windows: Yes
2019-05-31 21:32:02.972   Processor architecture: x64
2019-05-31 21:32:02.972   User privileges: Administrative
2019-05-31 21:32:02.973   Administrative install mode: Yes
2019-05-31 21:32:02.973   Install mode root key: HKEY_LOCAL_MACHINE
2019-05-31 21:32:02.973   64-bit install mode: No
2019-05-31 21:32:02.979   Created temporary directory: C:\Users\ajtru\AppData\Local\Temp\is-1NT54.tmp
2019-05-31 21:32:03.227   Calling RestartManager's RmGetList.
2019-05-31 21:32:03.350   RmGetList finished successfully.
2019-05-31 21:32:03.350   RestartManager found no applications using one of our files.
2019-05-31 21:32:03.356   Starting the installation process.
2019-05-31 21:32:03.360   -- File entry --
2019-05-31 21:32:03.360   Dest filename: C:\WINDOWS\CommunityTalks.chm
2019-05-31 21:32:03.364   Time stamp of our file: 2019-05-30 18:35:24.000
2019-05-31 21:32:03.364   Installing the file.
2019-05-31 21:32:03.539   Successfully installed the file.
2019-05-31 21:32:03.539   Installation process succeeded.
2019-05-31 21:32:03.539   Need to restart Windows? No
2019-05-31 21:32:03.541   Deinitializing Setup.
2019-05-31 21:32:03.557   Log closed.

Notice? Why did it install it into the Windows folder?

2019-05-31 21:32:03.360 Dest filename: C:\WINDOWS\CommunityTalks.chm

How can I specify the folder I actually want the file installed into then?

Update

I found a similar question about using custom parameters. So I changed it to:

Source: "CommunityTalks.chm"; DestDir: "{param:InstallPath}"; Flags: ignoreversion

And I adjusted the command line from using DIR to InstallPath but IMHO DIR should have been sufficient.


Alternative

I assume I could use this Pascal script and maybe use that? Then then I don’t need to pass the folder:

// Returns the path where the program was last installed
function GetPathInstalled( AppID: String ): String;
var
    sPrevPath: String;
begin
    sPrevPath := '';
    if not RegQueryStringValue( HKLM,
        'Software\Microsoft\Windows\CurrentVersion\Uninstall\'+AppID+'_is1',
        'Inno Setup: App Path', sPrevpath) then
        RegQueryStringValue( HKCU, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\'+AppID+'_is1' ,
                            'Inno Setup: App Path', sPrevpath);

    Result := sPrevPath;
end;

Since I know the app id. The benefit of passing it in would cater for if they moved the program or something. But my question still stands about the failure of DIR.

1
Usually Windows will default to the Windows folder if it cannot find the folder your feed to it. Maybe try single quotes inside your double quotes, or try doubling your quotes up like ""C:\Program Files.....""? Else I'd do a cd to that directory so you don't have to specify it within your command there. - shadow2020
@shadoe2020 Thanks but that can’t be the issue. If I swap DIR for InstallPath, and then swap {app} for {param:InstallPath} it works. Think that because the wizard pages are not shown it never converts DIR to {app} because the docs indicate this switch is for setting the default value for the select destination wizard page. - Andrew Truckle

1 Answers

1
votes

Quoting CreateAppDir documentation:

If this is set to no, no directory for the application will be created, the Select Destination Location wizard page will not be displayed, and the {app} directory constant is equivalent to the {win} directory constant.