ExtractTemporaryFile() display file name in GUI

236 views
Skip to first unread message

Christian Blackburn

unread,
Mar 17, 2022, 2:31:36 PM3/17/22
to innosetup
Hi Guys,

I'd like to use ExtractTemporaryFile() during the [Files] portion using code and have the names of the files I'm extracting appear the same place as the rest of the files.  I understand the progress bar wouldn't account for the additional size/file count and that's okay.  Can someone tell me how to write to the appropriate label?  

Also I assume I can use NextButtonClick(CurPageID = wpInstalling) as the event trigger to start extracting temporary files. 

Thanks,
Christian Blackburn

Laurent Combémorel

unread,
Mar 18, 2022, 4:40:43 AM3/18/22
to innosetup
You can use  ExtractTemporaryFile()  even in InitializeSetup(), so the place where you call it from depends on when the files are needed... The files are extracted to {temp} directory,. After that, you just have to copy to the correct place using FileCopy() at the time you consider the most appropriate during the setup (ideally, after the destination directory has been created).

But if you want to put them in the same place than the other files, then there is no point on doing a temporary extract by yourself, except if you want to use the file (like a sound to be played or an image to be displayed) during the wizard execution before the actual installation. And in this case, no need to copy it afterwards!

Christian Blackburn

unread,
Mar 23, 2022, 12:56:46 AM3/23/22
to innosetup
Hi Laurent,

I appreciate your response.  I want to do the ExtractTemporaryFile() because I need to run a complicated rule set to determine whether or not to copy each file and I don't want ~100 character lines per each file.  I'd rather it just loop through a list of files as a way to make more maintainable code.  I would however like the UI to list the file name while extracting so I'm fine doing it during the same time files would normally be extracted.  My question is what's the full name and property name (a.b.c.text := 'file.ext'; or a.b.c.caption := 'file.text') of the control so I can write to the label without having to employ Win32, AutoIt, or create a whole new custom page in Inno Setup.  

Thanks,
Christian Blackburn

Laurent Combémorel

unread,
Mar 23, 2022, 5:44:43 AM3/23/22
to innosetup
You will have great interest in looking at support classes reference sheet... and specially at WizardForm.StatusLabel.Caption...
For the progress bar, it is quite tricky because the global progression does not consider your specific coded tasks, but you can try to play with WizardForm.ProgressGauge.Position... Check the progress level when you start your specific process, compute a desired progress level (depending on the initial level when you start your process, and the level in your pocess and your estimation of the total of your process in the global installation total) and set the Gauge.Position to this progress level *  WizardForm.ProgressGauge Div 100 to have it as a progress percent...

Gavin Lambert

unread,
Mar 23, 2022, 6:05:05 PM3/23/22
to inno...@googlegroups.com
On 23/03/2022 17:56, Christian Blackburn wrote:
> I appreciate your response.  I want to do the ExtractTemporaryFile()
> because I need to run a complicated rule set to determine whether or not
> to copy each file and I don't want ~100 character lines per each file.
> I'd rather it just loop through a list of files as a way to make more
> maintainable code.

I strongly discourage you from using ExtractTemporaryFile to do mass
installation. Only use [Files] entries. This allows proper
uninstallation and use of the other Flags.

Note that you can use a combination of Check functions or Components
(the latter is preferred) to let you flexibly decide whether or not to
install a file, and you can either use wildcards or iterate and generate
entries with ISPP to reduce the number of files that need to be
explicitly listed.

A good tactic is to group the files in your source directories by
component, such that you can just use `Source: component1\*` to easily
include all the files for that component. The final installed directory
structure does not need to be the same as your source layout.

Also note that boolean expressions are supported for components, so you
can condition a particular file or fileset on `ComponentA and not
ComponentB`, for example.

Christian Blackburn

unread,
Mar 23, 2022, 10:43:00 PM3/23/22
to innosetup
Hi Laurent,

Thank you very much again for both of your replies.  That works perfectly.  I'm not sure if I'll reuse their status bar.  I may just do an ellipsis animation since the progress bars that roll back are weird.  I do appreciate knowing how to do it though :-).  

Thanks,
Christian Blackburn

Christian Blackburn

unread,
Mar 23, 2022, 10:52:48 PM3/23/22
to innosetup
Hi Gavin,

Thank you for your reply.  I completely agree that using Check conditions and Components is how to get the job done.  I do that plenty in the installer I've been working on for the past 4 years.  I just have ~45 python libraries that need to work in offline mode and I don't like maintaining 90+ lines to extract the files and then run them.  I would love an example of an ISPP function that returns a string (other needs), and a procedure that writes a string to the script (current need).  Do you have either?  So far all I've done with ISPP is set constants and do basic string operations like StringChange().  I'm definitely familiar with the concept of writing code that writes code since I used to be an ASP.NET web developer.  

Thanks,
Christian Blackburn

Gavin Lambert

unread,
Mar 24, 2022, 3:15:59 AM3/24/22
to inno...@googlegroups.com
On 24/03/2022 15:52, Christian Blackburn wrote:
> I would love an example of an ISPP function that returns a string
> (other needs), and a procedure that writes a string to the script
> (current need). Do you have either? So far all I've done with ISPP
> is set constants and do basic string operations like StringChange().
> I'm definitely familiar with the concept of writing code that writes
> code since I used to be an ASP.NET web developer.
https://jrsoftware.org/ispphelp/index.php?topic=findfirst

Jernej Simončič

unread,
Mar 24, 2022, 8:29:48 AM3/24/22
to Christian Blackburn on [innosetup]

On Thursday, March 24, 2022, 03:52:48, Christian Blackburn wrote:


I would love an example of an ISPP function that returns a string (other needs), and a procedure that writes a string to the script (current need).  Do you have either? 

You can look at the GIMP installer: https://gitlab.gnome.org/GNOME/gimp/-/blob/master/build/windows/installer/associations.isi this include file reads a list of extensions from a file, and generates [Registry] entries to set up file associations for each extension.

 

-- 
< Jernej Simončič ><><><><>< https://eternallybored.org/ >


Clothes make the man. Naked people have little or no influence on society.
       -- Haberdasher's Instruction

Christian Blackburn

unread,
Mar 25, 2022, 4:45:31 AM3/25/22
to innosetup
Hi Gavin and Jernej,

Thank you both for your useful responses.  I look forward to putting them to good use.  

Thanks,
Christian Blackburn

Reply all
Reply to author
Forward
0 new messages