Sunday, January 9, 2011

Inno Setup prepareToInstall scripts updated to 0.5.1

Hi all,

I'm at the risk that this blog looks like an Inno Setup only tour, but that's not the intention. I'm just doing some scripting with Inno these days, other projects I can't disclose here (yet).

I've updated the PrepareToInstall scripts (original post is here) to version 0.5 and it's available for download here.
(Updated to v0.5.1 because of a minor mishap in the demo script. Thanks Robert.)

The previous posts on this subject are updated to point to this one, so new finders can have the latest release.

The improvement I made is:
+ Added support for local NextButtonClick, NeedsRestart and PrepareToInstall event functions (set a define and add the prefix 'Local' to the local function name)

20 comments:

upd said...

Thank's for that, but i had to add #define use_dotnetfx40 for .net framework 4.0 as use have
#ifdef use_dotnetfx40

Unknown said...

That's great. Thanks for all the hard work.

I can't get the "restart at the end of the installation if a dependency required it" feature to work.

It appears that there is a function defined called NeedRestart, which tests if a restart is needed. There is another function called PrepareToInstall that will set Windows up to continue the installation after a reboot. But I can't see where either of those functions are called.

What's the solution?

Unknown said...

OK: I've now realised that PrepareToInstall etc. are hooks that get called by the installer.

I've tracked down the problem enough to work around it. It seems that NeedRestart is either not being run or is being ignored. So the only way to get .RequestRestart noticed is, having checked for the ResultCode of 3010, to also set rebootRequired := true and rebootMessage := something not empty (otherwise PrepareToInstall doesn't return anything).

A solution would pin down why NeedRestart doesn't get picked up. This at least triggers the necessary reboot

Unknown said...

Thank's so much
how i can set a local folder for download .net framework for example
a folder inside setup folder that setup file inside it

Ton said...

@James: I don't want to restart the setup because I can't be sure the same user will be the next to log in to the computer.

Ton said...

@reza: The only thing that is downloaded for the .NET framework (v4 that is) is the web-installer, not the framework itself. The web-installer downloads only the pieces needed for the system at hand.
If you need the full installers somewhere, then go to the Microsoft site and download it there.
The location of the temp files is not directly settable from inside the Inno Setup script, but it can be copied later to a more appropriate location. But for the reason I just wrote above, that's pretty useless.

Peter Lee said...

Hi Ton,

I'm using your scripts. and I want to install "2007 Microsoft Office System Update: Redistributable Primary Interop Assemblies". but the package downloaded from "https://www.blogger.com/comment.g?blogID=1435671103640374014&postID=4406709462781140836" is a compressed file, and the user has to uncompress it and then click the file "o2007pia.msi" to install.

So I want to install it locally, that is, I will distribute o2007pia.msi with my app.

My question is how to let your script to call this local file to install it?

and if possible would you mind writing and sending me the script?

Thanks a lot!

Peter

Ton said...

Peter,

I'd never download a Microsoft update or fix from a non-microsoft downloadsite. You'd better get it straight from the source: http://download.microsoft.com/download/e/1/d/e1df4622-5f6c-4fb9-845b-38d009cc1188/PrimaryInteropAssembly.exe
The MSI can be extracted using a zip-extraction tool, like 7-zip or Peazip.
Depending on the size of your install package, you could include the msi, and install it when needed. This file hasn't changed since 2006, it seems, looking at the download page: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=59daebaa-bed4-4282-a28c-b864d8bfa513&displaylang=en

Any chance you know how to detect the state of installation for this update? Most likely a value in/or a registry key, I guess. That would be required, to avoid an unneeded (download and) run if it's already installed.

Regards,
Ton

Peter Lee said...

Hi Ton,

I do know how to detect, and I have also written o2007pia.iss.

As I said before, I will download the PrimaryInteropAssemblies.exe and extract the o2007pia.msi from it, and then wrap the o2007pia.msi up to the setup.exe.

The reason why I want to do so is the PrimaryInteropAssemblies.exe is a zipped file, and the default behavior to double-click it is just to unzip it (it won't INSTALL it), so the user has to go to the extraction folder, find and double-click the o2007pia.msi to install.

Hope I made myself clear.

Thanks.

Peter Lee said...

Hi Ton,

I found the solution using ExtractTemporaryFile:
http://stackoverflow.com/questions/797888/inno-setup-extracting-files-at-the-start-up-setup-instead-of-the-end

and then I changed the AddProduct function:
path := ExpandConstant('{tmp}{\}') + CustomMessage('DependenciesDir') + '\' + FileName;

Thanks anyway.

Ton said...

If you send me the script I could add it to the archive for others to benefit of your work.

Peter Lee said...

@Ton, writing the script code here is not so convenient. So I posted the detailed scripts in my blog:

Office PIA Installation Scripts for InnoSetup(InnoSetup的Office PIA安装脚本)


Please check it out. Let me know if anything unclear.

Peter Lee

Peter Lee said...

@Ton, I have written some scripts, and I have put them in my blog. I feel it's not convenient to pos the code here.

Please check it out:
Office PIA Installation Scripts for InnoSetup(InnoSetup的Office PIA安装脚本)
http://www.peterlee.com.cn/blog.php?getArticleID=116&getYearMonth=20112

Unknown said...

I try to write a script for the "Microsoft Access Database Engine 2010 Redistributable" but i have no idea how to check if it is already installed. Would u please add this to the scripts like Jet and MDAC? That would be awesome!

Download:
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=C06B8369-60DD-4B64-A44B-84B371EDE16D&displaylang=en

Unknown said...

Hi Ton,
Been two days that I am looking at Inno Setup for software deployment and I came across your blog on the internetz ;). Your samples and scripts, simply brilliant.
I have a questions that is similar to what reza asked (actually exactly the same;) and I would love your opinion on it. What are the options that I have to install dependencies, if the users of the system cannot get to and are not required to have internet connection, (I am writing software for third world consumptions) which makes the web installer of .NET framework 4 out of the question?

Unknown said...

Hello, can you please reupload?
MediaFire gives me "empty response" error.

Thank you.

Markus said...

Hi Ton, Thanks again for the scripts. I have a problem with using #define use_scceruntime. On my test xm the path doesn't exist but innosetup don't installed the sql compact.
I search for hours but I did not find the reason.

Gruß Markus

Unknown said...

Is there any script to install AccessDatabaseEngine_x64.exe?

Unit 399 said...

about sqlExpress2005 script-installer:

it detects the requirement, downloads it, but when download reaches to %99, it gives "URL error".

how can i fix this?

error corresponds to code:122 in your lang file.

with my best regards,

Tim said...

Hi Ton, thank you seems like the holy grail is here!
;)
Just kind of unsure about the following...

#ifdef use_dotnetfx35
dotnetfx35();
#ifdef use_dotnetfx35lp
dotnetfx35lp();
#endif
dotnetfx35sp1();
#ifdef use_dotnetfx35lp
dotnetfx35sp1lp();
#endif
#endif

Why you did not endif earlier so that dotnetfx35sp1 can be used without having to install dotnetfx35?
Is dotnetfx35 mandatory for dotnetfx35sp1 ?

Thanks!