Welcome Guest.   Make a donation to an author on the site July 28, 2014, 03:20:29 AM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
View the new Member Awards and Badges page.
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: Need help from Inno Setup gurus  (Read 5328 times)
kyrathaba
N.A.N.Y. Organizer
Honorary Member
**
Posts: 3,010



while(! dead_horse){beat}

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« on: December 19, 2010, 08:27:11 PM »

I know it doesn't make sense, but although I have the patience and drive to write computer applications, I don't seem to have the patience to figure out InnoSetup.  I have managed to figure out a script for a basic install, and the script checks for the installation of the .NET Framework 4.0 and, if it isn't found, prompts for its download.  

I'm showing my existing .iss script.  I'm wondering if anyone can show me exactly how to modify it,  such that it will additionally prompt for a desktop shortcut to be created during setup.

The script shown below compiles successfully, and I've tested the setup it creates, and it works as desired, except I want to modify it to give the user the option to create a desktop icon during the setup process.

I know it isn't kosher, and I normally would not use this feature, but I'd also like to know how to install the desktop shortcut without prompting the user.  The reason is, sometimes I write short little helper programs for my elderly father, who is so computer challenged, he can't find the program in the program menu.  He really needs (and wants) a desktop shortcut when he installs one of my apps.

[copy or print]
[_ISTool]
EnableISX=true

[Setup]
AppName=TestProgram
AppVerName=TestProgram1.0
MinVersion=4.1,4.0
DefaultDirName={pf}\Kyrathasoft
DefaultGroupName=TestProgram
UninstallDisplayIcon={app}\UninstallCharCreator.exe
Compression=lzma
SolidCompression=true
OutputBaseFilename=TestProgramSetup

[Files]
Source: scripts\isxdl\isxdl.dll; Flags: dontcopy
Source: src\TestProgForInnoSetup.exe; DestDir: {app}

[Messages]
WinVersionTooLowError=This application requires Windows NT4, Windows 98 or later.

[Icons]
Name: {group}\Kyrathasoft\TestProgram; Filename: {app}\TestProgForInnoSetup.exe
Name: {group}\Uninstall TestProgram; Filename: {uninstallexe}

[code]
var
  dotnetRedistPath: string;
  downloadNeeded: boolean;
  dotNetNeeded: boolean;
  memoDependenciesNeeded: string;

procedure isxdl_AddFile(URL, Filename: PChar);
external 'isxdl_AddFile@files:isxdl.dll stdcall';
function isxdl_DownloadFiles(hWnd: Integer): Integer;
external 'isxdl_DownloadFiles@files:isxdl.dll stdcall';
function isxdl_SetOption(Option, Value: PChar): Integer;
external 'isxdl_SetOption@files:isxdl.dll stdcall';


const
  dotnetRedistURL = 'http://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe';
  //dotnetRedistURL = 'http://download.microsoft.com/download/a/a/c/aac39226-8825-44ce-90e3-bf8203e74006/dotnetfx.exe'; //for v1 of framework
  // local system for testing...
  // dotnetRedistURL = 'http://192.168.1.1/dotnetfx.exe';

function InitializeSetup(): Boolean;

begin
  Result := true;
  dotNetNeeded := false;

  // Check for required netfx installation
  if (not RegKeyExists(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v4\Client')) then begin
    dotNetNeeded := true;
    if (not IsAdminLoggedOn()) then begin
      MsgBox('This application needs the Microsoft .NET Framework to be installed by an Administrator', mbInformation, MB_OK);
      Result := false;
    end else begin
      memoDependenciesNeeded := memoDependenciesNeeded + '      .NET Framework' #13;
      dotnetRedistPath := ExpandConstant('{src}\dotnetfx.exe');
      if not FileExists(dotnetRedistPath) then begin
        dotnetRedistPath := ExpandConstant('{tmp}\dotnetfx.exe');
        if not FileExists(dotnetRedistPath) then begin
          isxdl_AddFile(dotnetRedistURL, dotnetRedistPath);
          downloadNeeded := true;
        end;
      end;
      SetIniString('install', 'dotnetRedist', dotnetRedistPath, ExpandConstant('{tmp}\dep.ini'));
    end;
  end;

end;

function NextButtonClick(CurPage: Integer): Boolean;
var
  hWnd: Integer;
  ResultCode: Integer;

begin
  Result := true;

  if CurPage = wpReady then begin

    hWnd := StrToInt(ExpandConstant('{wizardhwnd}'));

    // don't try to init isxdl if it's not needed because it will error on < ie 3
    if downloadNeeded then begin

      isxdl_SetOption('label', 'Downloading Microsoft .NET Framework');
      isxdl_SetOption('description', 'MyApp needs to install the Microsoft .NET Framework. Please wait while Setup is downloading extra files to your computer.');
      if isxdl_DownloadFiles(hWnd) = 0 then Result := false;
    end;
    if (Result = true) and (dotNetNeeded = true) then begin
      if Exec(ExpandConstant(dotnetRedistPath), '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then begin
         // handle success if necessary; ResultCode contains the exit code
         if not (ResultCode = 0) then begin
           Result := false;
         end;
      end else begin
         // handle failure if necessary; ResultCode contains the error code
         Result := false;
      end;
    end;
  end;
end;

function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
var
  s: string;

begin
  if memoDependenciesNeeded <> '' then s := s + 'Dependencies to install:' + NewLine + memoDependenciesNeeded + NewLine;
  s := s + MemoDirInfo + NewLine + NewLine;

  Result := s
end;
[/code]

BTW, I have double- and triple-checked that I have only the opening and closing code tags, but everytime I "Save" this post, an extra closing tag gets inserted...
« Last Edit: December 19, 2010, 08:37:36 PM by kyrathaba » Logged

Win 7 Home Premium 64bit-SP1 AMD Athlon II X2 220 Socket AM3 (938) @ 2.1GHz 6GB RAM Firefox 26.0
_________________________________________________________________________________________

I'm fighting against patent trolls. Join me and tell your representative to support the #SHIELDAct: https://eff.org/r.b6JJ /via @EFF

My DC page: http://kyrathaba.dcmembers.com | My blog: http://williambryanmiller.com/ | Proofreading Service: http://bit.ly/1fQSqQP

Renegade
Charter Member
***
Posts: 10,884



Tell me something you don't know...

see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #1 on: December 19, 2010, 08:32:20 PM »

You might want to try one of the InnoSetup GUIs here: http://www.jrsoftware.org/is3rdparty.php

It should help out there.

I haven't used it in a long time and don't remember much of anything about it.
Logged

Slow Down Music - Where I commit thought crimes...

Freedom is the right to be wrong, not the right to do wrong. - John Diefenbaker
skwire
Charter Member
***
Posts: 4,017



Another Coding Snack request? Om nom nom...

see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #2 on: December 19, 2010, 08:33:57 PM »

Create a [Tasks] section like this:

[copy or print]
[Tasks]
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
Logged

mouser
First Author
Administrator
*****
Posts: 33,183



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #3 on: December 19, 2010, 08:40:20 PM »

my inno setup looks similar to Skwire's and i think it does the same thing, but it's split into two sections:

[copy or print]
[Icons]
Name: {userdesktop}\Screenshot Captor; Filename: {app}\ScreenshotCaptor.exe; Tasks: desktopicon
[Tasks]
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}

So note how the desktop icon is setup in the [Icons] section, and has a TASK specified.
And then the task entry asks the user if they want to install it.
Logged
kyrathaba
N.A.N.Y. Organizer
Honorary Member
**
Posts: 3,010



while(! dead_horse){beat}

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #4 on: December 19, 2010, 08:49:34 PM »

Thanks, works great!
Logged

Win 7 Home Premium 64bit-SP1 AMD Athlon II X2 220 Socket AM3 (938) @ 2.1GHz 6GB RAM Firefox 26.0
_________________________________________________________________________________________

I'm fighting against patent trolls. Join me and tell your representative to support the #SHIELDAct: https://eff.org/r.b6JJ /via @EFF

My DC page: http://kyrathaba.dcmembers.com | My blog: http://williambryanmiller.com/ | Proofreading Service: http://bit.ly/1fQSqQP

kyrathaba
N.A.N.Y. Organizer
Honorary Member
**
Posts: 3,010



while(! dead_horse){beat}

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #5 on: December 19, 2010, 08:57:51 PM »

Another question.  The screenshot posted below should help explain.  I want to change the Program Files menu so that instead of looking like it does on the left of the screenshot, it instead looks like what I show on the right.  Can you show me what to change in my *.iss script?

Logged

Win 7 Home Premium 64bit-SP1 AMD Athlon II X2 220 Socket AM3 (938) @ 2.1GHz 6GB RAM Firefox 26.0
_________________________________________________________________________________________

I'm fighting against patent trolls. Join me and tell your representative to support the #SHIELDAct: https://eff.org/r.b6JJ /via @EFF

My DC page: http://kyrathaba.dcmembers.com | My blog: http://williambryanmiller.com/ | Proofreading Service: http://bit.ly/1fQSqQP

kyrathaba
N.A.N.Y. Organizer
Honorary Member
**
Posts: 3,010



while(! dead_horse){beat}

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #6 on: December 19, 2010, 09:12:31 PM »

Solved it:

Quote

[_ISTool]
EnableISX=true

[Setup]
AppName=TestProgram
AppVerName=TestProgram1.0
MinVersion=4.1,4.0
DefaultDirName={pf}\Kyrathasoft
DefaultGroupName=Kyrathasoft
UninstallDisplayIcon={app}\UninstallCharCreator.exe
Compression=lzma
SolidCompression=true
OutputBaseFilename=TestProgramSetup

[Files]
Source: scripts\isxdl\isxdl.dll; Flags: dontcopy
Source: src\TestProgForInnoSetup.exe; DestDir: {app}

[Messages]
WinVersionTooLowError=This application requires Windows NT4, Windows 98 or later.

[Icons]
Name: {group}\TestProgram; Filename: {app}\TestProgForInnoSetup.exe
Name: {group}\Uninstall TestProgram; Filename: {uninstallexe}
Name: {userdesktop}\Test Program; Filename: {app}\TestProgForInnoSetup.exe; Tasks: desktopicon

[Tasks]
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}

« Last Edit: December 19, 2010, 09:14:14 PM by kyrathaba » Logged

Win 7 Home Premium 64bit-SP1 AMD Athlon II X2 220 Socket AM3 (938) @ 2.1GHz 6GB RAM Firefox 26.0
_________________________________________________________________________________________

I'm fighting against patent trolls. Join me and tell your representative to support the #SHIELDAct: https://eff.org/r.b6JJ /via @EFF

My DC page: http://kyrathaba.dcmembers.com | My blog: http://williambryanmiller.com/ | Proofreading Service: http://bit.ly/1fQSqQP

mouser
First Author
Administrator
*****
Posts: 33,183



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #7 on: December 19, 2010, 09:17:52 PM »

Can i point out i also recently posted a tiny dll and inno script sample for people who want to have their programs shutdown automatically if running on install and uninstall:

http://www.donationcoder....m/index.php?topic=24786.0
Logged
kyrathaba
N.A.N.Y. Organizer
Honorary Member
**
Posts: 3,010



while(! dead_horse){beat}

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #8 on: December 20, 2010, 12:13:00 AM »

Thanks for the link, Mouser.

One more question:

Say I want my setup to copy two files (a small JPG, and a small text file) to the same application as the directory.  How do I do that in the script?
Logged

Win 7 Home Premium 64bit-SP1 AMD Athlon II X2 220 Socket AM3 (938) @ 2.1GHz 6GB RAM Firefox 26.0
_________________________________________________________________________________________

I'm fighting against patent trolls. Join me and tell your representative to support the #SHIELDAct: https://eff.org/r.b6JJ /via @EFF

My DC page: http://kyrathaba.dcmembers.com | My blog: http://williambryanmiller.com/ | Proofreading Service: http://bit.ly/1fQSqQP

mouser
First Author
Administrator
*****
Posts: 33,183



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #9 on: December 20, 2010, 08:29:06 AM »

i'm confused -- are you just asking the general question of how you specify what files get installed by Inno Setup? Or is there something i'm missing?
ps. try one of the Inno Ides, they make life easier.
Logged
kyrathaba
N.A.N.Y. Organizer
Honorary Member
**
Posts: 3,010



while(! dead_horse){beat}

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #10 on: December 20, 2010, 09:08:13 AM »

I figured it out. Thanks, all!
Logged

Win 7 Home Premium 64bit-SP1 AMD Athlon II X2 220 Socket AM3 (938) @ 2.1GHz 6GB RAM Firefox 26.0
_________________________________________________________________________________________

I'm fighting against patent trolls. Join me and tell your representative to support the #SHIELDAct: https://eff.org/r.b6JJ /via @EFF

My DC page: http://kyrathaba.dcmembers.com | My blog: http://williambryanmiller.com/ | Proofreading Service: http://bit.ly/1fQSqQP

Ath
Supporting Member
**
Posts: 2,183



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #11 on: December 26, 2010, 02:24:17 PM »

@kyrathaba You should really sign up to the news server on jrsoftware.org, it is so helpful if you have questions after reading the fine manual, which you seem to have missed, reading all these n00b questions here...
Logged

kyrathaba
N.A.N.Y. Organizer
Honorary Member
**
Posts: 3,010



while(! dead_horse){beat}

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #12 on: December 26, 2010, 02:30:03 PM »

Thanks, Ath.  RTFM, right?  tongue
Logged

Win 7 Home Premium 64bit-SP1 AMD Athlon II X2 220 Socket AM3 (938) @ 2.1GHz 6GB RAM Firefox 26.0
_________________________________________________________________________________________

I'm fighting against patent trolls. Join me and tell your representative to support the #SHIELDAct: https://eff.org/r.b6JJ /via @EFF

My DC page: http://kyrathaba.dcmembers.com | My blog: http://williambryanmiller.com/ | Proofreading Service: http://bit.ly/1fQSqQP

Ath
Supporting Member
**
Posts: 2,183



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #13 on: December 26, 2010, 02:36:57 PM »

That's what I write several times a month on the NG's there cheesy
Logged

kyrathaba
N.A.N.Y. Organizer
Honorary Member
**
Posts: 3,010



while(! dead_horse){beat}

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #14 on: December 27, 2010, 01:08:57 PM »

Here's a question.  It must be in the manual somewhere, but darned if I can find it:

I'm able to specify a custom icon for the setup installer that Inno Setup creates, by using the following in my script:

[copy or print]
[Setup]
SetupIconFile=src\excuseMan.ico

My question, then, is this: how do I similarly specify that same custom icon so that it will be used if the user specifies for a desktop icon to be created?  Something like the following, maybe, but I don't know the correct syntax:

[copy or print]
[Setup]
DesktopIconFile=src\excuseMan.ico
Logged

Win 7 Home Premium 64bit-SP1 AMD Athlon II X2 220 Socket AM3 (938) @ 2.1GHz 6GB RAM Firefox 26.0
_________________________________________________________________________________________

I'm fighting against patent trolls. Join me and tell your representative to support the #SHIELDAct: https://eff.org/r.b6JJ /via @EFF

My DC page: http://kyrathaba.dcmembers.com | My blog: http://williambryanmiller.com/ | Proofreading Service: http://bit.ly/1fQSqQP

worstje
Honorary Member
**
Posts: 555



The Gent with the White Hat

View Profile Give some DonationCredits to this forum member
« Reply #15 on: December 27, 2010, 01:17:37 PM »

Shouldn't you have said desktop icon listed in the [Icons] section?

You can simply use:

Quote
IconFilename: "{app}\myicon.ico"

to change the icon used for such an icon.
Logged
Ath
Supporting Member
**
Posts: 2,183



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #16 on: December 27, 2010, 01:38:03 PM »

kryathaba, you could (re)start with a fresh script generated from the wizard, that gives you all this stuff by default...
Then add the extra files you need to add, and don't be shy to use an editor like InnoIDE or ISTool (that one is going off-line right about now) to aid in the setting of 'fancy' features like icons etc.
And don't forget to add the .ico files in the [Files] section.

As said earlier, the newsgroups are quite helpful, but we expect you to have done at least a little homework...
Logged

kyrathaba
N.A.N.Y. Organizer
Honorary Member
**
Posts: 3,010



while(! dead_horse){beat}

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #17 on: December 27, 2010, 01:46:15 PM »

Quote
As said earlier, the newsgroups are quite helpful, but we expect you to have done at least a little homework...

I find, with a few exceptions, that people on this site respond more quickly and with less chastisement in their tone, and that it saves me time.  DC is like having a bunch of friends who are experts.  Instead of me digging and slogging through dry subject matter, 99.9% of which doesn't pertain, I can get the answer quickly and with little time/energy expenditure.


Thanks for pointing me to those tools smiley
« Last Edit: December 27, 2010, 01:48:04 PM by kyrathaba » Logged

Win 7 Home Premium 64bit-SP1 AMD Athlon II X2 220 Socket AM3 (938) @ 2.1GHz 6GB RAM Firefox 26.0
_________________________________________________________________________________________

I'm fighting against patent trolls. Join me and tell your representative to support the #SHIELDAct: https://eff.org/r.b6JJ /via @EFF

My DC page: http://kyrathaba.dcmembers.com | My blog: http://williambryanmiller.com/ | Proofreading Service: http://bit.ly/1fQSqQP

kyrathaba
N.A.N.Y. Organizer
Honorary Member
**
Posts: 3,010



while(! dead_horse){beat}

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #18 on: December 27, 2010, 02:43:59 PM »

Eureka!

[copy or print]
[Icons]
Name: {group}\ExcuseManager; Filename: {app}\ExcuseManager.exe
Name: {group}\Uninstall Excuse Manager v0.94; Filename: {uninstallexe}
Name: {userdesktop}\NANY Excuse Manager v0.94; Filename: {app}\ExcuseManager.exe; IconFilename: {app}\excuseMan.ico; Tasks: desktopicon
Logged

Win 7 Home Premium 64bit-SP1 AMD Athlon II X2 220 Socket AM3 (938) @ 2.1GHz 6GB RAM Firefox 26.0
_________________________________________________________________________________________

I'm fighting against patent trolls. Join me and tell your representative to support the #SHIELDAct: https://eff.org/r.b6JJ /via @EFF

My DC page: http://kyrathaba.dcmembers.com | My blog: http://williambryanmiller.com/ | Proofreading Service: http://bit.ly/1fQSqQP

Ath
Supporting Member
**
Posts: 2,183



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #19 on: December 27, 2010, 02:57:35 PM »

See, it isn't that hard cheesy

I'm not sure if putting the version number in the shortcut would be that handy, you would have to clean that up with every upgrade you publish (deleting the .lnk file of that name using [InstallDelete]), but also cater for in your script in any future release, might someone skip/miss one of your in-between updates.
Logged

kyrathaba
N.A.N.Y. Organizer
Honorary Member
**
Posts: 3,010



while(! dead_horse){beat}

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #20 on: December 27, 2010, 03:18:03 PM »

Good idea.  I'll remove it for v0.96 release.
Logged

Win 7 Home Premium 64bit-SP1 AMD Athlon II X2 220 Socket AM3 (938) @ 2.1GHz 6GB RAM Firefox 26.0
_________________________________________________________________________________________

I'm fighting against patent trolls. Join me and tell your representative to support the #SHIELDAct: https://eff.org/r.b6JJ /via @EFF

My DC page: http://kyrathaba.dcmembers.com | My blog: http://williambryanmiller.com/ | Proofreading Service: http://bit.ly/1fQSqQP

mouser
First Author
Administrator
*****
Posts: 33,183



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #21 on: December 27, 2010, 03:23:07 PM »

agree with ATH, using version # in start menus and start menu groups is messy and error prone.
Logged
Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.047s | Server load: 0.19 ]