It seems that you're using an outdated browser. Some things may not work as they should (or don't work at all).
We suggest you upgrade newer and better browser like: Chrome, Firefox, Internet Explorer or Opera

×
So has anyone here ever used inno setup? If so could you try and help me out with a problem I'm having? :)

Thanks in advance! :)
No posts in this topic were marked as the solution yet. If you can help, add your reply
avatar
A_Future_Pilot: So has anyone here ever used inno setup? If so could you try and help me out with a problem I'm having? :)

Thanks in advance! :)
I use it from time to time; what problem are you having?
Thank you!!

The installer is for a source port, that requires the original game files. I'd like to have the user browse for two different folders on their system, and then have INNO save the result as a constant.

Then I can just have:

Source: {theconstant1}\*.*; Flags: External
Source: {theconstant2}\BOB\*.*; Flags External

So that I can copy the original game files off the users computer during the installation...how can I do this?


I have this in my [code] section:

var
Page: TInputDirWizardPage;
DataDir: String;
DataDire: String;

procedure InitializeWizard;
begin
Page := CreateInputDirPage(wpWelcome,
'Descent Installation Location', '',
'Please locate where Descent and Descent 2 are installed.'#13#10#13#10 +
'',
False, '');

// Add item (with an empty caption)
Page.Add('Descent location');
Page.add('Descent 2 location');


// Read value into variable
DataDir := Page.Values[0];
DataDire := Page.Values[1];

end;

function NextButtonClick(CurPageID: Integer): Boolean;
begin
if CurPageID = Page.ID then begin
if (Page.Values[0] = '') or (Page.Values[1] = '') then begin
if Page.Values[0] = '' then begin
MsgBox('You did not enter a path for your Descent installation. The Descent game content files will not be copied.', mbInformation, MB_OKCANCEL)
end else
if Page.Values[1] = '' then begin
MsgBox('You did not enter a path for your Descent 2 installation. The Descent 2 game content files will not be copied.', mbInformation, MB_OKCANCEL)
end;
Result := True;
end;
end else
Result := True;
end;

Now the problem is, if either of the boxes are blank, it pops up with a default error message saying that "You must select a path etc. etc." instead of my custom message.

Do you know what's going on? :)

Thank you so much!
avatar
A_Future_Pilot: the problem is, if either of the boxes are blank, it pops up with a default error message saying that "You must select a path etc. etc." instead of my custom message.

Do you know what's going on? :)

Thank you so much!
Sorry I missed your reply. I haven't really done scripting this advanced by myself as such. When I want something like this I look at an existing installer that does what I'm wanting to do to see what I'm doing wrong.

You can extract Inno Setup installers with innounp. Unlike 7-Zip or the like this will also extract the original install script used to compile the installer.

Sorry for the late reply and that I can't be of much more help than that. :(
Oh well thanks anyway! I'll look around to see if I can find an installer that does what I want and use that program...thanks! :)
Check out Advanced Installer... Dunno if the free version will meet your needs though.
I don't have much experience with InnoSetup/Pascal scripting, but when you click next and the default message appears, are you prevented from continuing? It could be because there's some form of default validation happening on the 2 input fields before the NextButtonClick event is being fired.

Also, not directly related to your issue but you're offering 2 choices in your message box (Ok and cancel) but you never check what the user selects and just go on anyway. I guess you just wanted to test it first and complete it later, but I thought I'd point that out just in case.
Post edited July 03, 2011 by KingOfDust
Yeah the Advanced Installer can't do what I want...

And yeah, I'm actually planning on doing it slightly differently now from what was in my original...here's what I want it to do (in a perfect world):


1. A page asking whether to install the source port for just Descent 1, just Descent 2, or both (I have this using the [components] section.)

2. A page asking where to install them to (already have this...default behavior.)

3. A Page having three checkbox options:
A. Copy game files, missions, and players.
B. Copy game files only
C. Don't copy any of them.

4. If they check A or B a page that has either one (If they only selected one of the components) or two (if they selected both) browse for folder dialogs, where they locate the original game installation folders.

5. If they selected C or after page 4, the regular install page (default behavior.)


Then I'd have in the Source: sections the constants created from step 4, to copy the files from their hard drive.


So that's what I'm thinking now...and that way the default behavior of the pop-up saying that you have to input a directory wouldn't be a problem, since they've already specified whether or not they actually have a directory to find. :)

So any suggestions on how I'd do that? I think I can figure out the constants (maybe), but I really have no idea about only showing the browse button for the components selected.

Thank you all for your help!!
Post edited July 03, 2011 by A_Future_Pilot
OK, so I've worked on it some and here's what I've got:


[Code]
// global vars
var
DataDirPage: TInputDirWizardPage;
SampleDataPage: TInputOptionWizardPage;

// custom wizard page setup, for data dir.
procedure InitializeWizard;
begin
{ Taken from CodeDlg.iss example script }
{ Create custom pages to show during install }

DataDirPage := CreateInputDirPage(SampleDataPage.ID,
'Descent Data Directory', '',
'Please select the location where the original Descent files are installed.',
False, '');
DataDirPage.Add('Descent location.');
DataDirPage.Add('Decent 2 location.');

DataDirPage.Values[0] := 'C:\Program Files\GOG.com\Descent and Descent 2\Decent';
DataDirPage.Values[1] := 'C:\Program Files\GOG.com\Descent and Descent 2\Decent 2';

SampleDataPage := CreateInputOptionPage(wpSelectDir,
'Install Descent Data', '',
'Would you like to copy the Descent game files to your DXX-Rebirth installation?',
True, False);
SampleDataPage.Add('Yes copy the game files, missions, players, and savegames.');
SampleDataPage.Add('Yes, but just copy the game files.');
SampleDataPage.Add('No, I'+chr(39)+'ll copy the game files myself later.');

SampleDataPage.Values[0] := True;
end;

function Descent(Param: String): String;
begin
Result := DataDirPage.Values[0];
end;

function DescentTwo(Param: String): String;
begin
{ Return the selected DataDir }
//MsgBox('GetDataDir.', mbError, MB_OK);
Result := DataDirPage.Values[1];
end;

function InstallAll(): Boolean;
begin
{ Return the value of the 'install' radiobutton }
//MsgBox('InstallSampleData.', mbError, MB_OK);
Result := SampleDataPage.Values[0];
end;

function Install(): Boolean;
begin
{ Return the value of the 'install' radiobutton }
//MsgBox('InstallSampleData.', mbError, MB_OK);
Result := SampleDataPage.Values[1];
end;

function DontInstall(): Boolean;
begin
if SampleDataPage.Values[2]=true then
begin
Result := False;
end
else
begin
Result := True;
end
end;


Now the problem is I get an error saying "Could not call proc" on the "Result := DataDirPage.Values[0]" line of the "Descent" function. Any idea why this is?