find folder

178 views
Skip to first unread message

Lee Cley da Silva Lima

unread,
Jul 11, 2022, 2:34:16 PM7/11/22
to innosetup

Hi!

Does anyone know a command in which the installer opens a specific file and finds information which points to the installation location and uses that location to do the installation automatically?

as seen below I need it to locate the program folder that is in the path
E:\program

ie open which file locate

InstalledPackagesPath "E:\program"

and put as installation destination "E:\program"

Screenshot_21.png

Bill Stewart

unread,
Jul 11, 2022, 5:44:44 PM7/11/22
to innosetup
On Monday, July 11, 2022 at 12:34:16 PM UTC-6 leeli...@gmail.com wrote:

Does anyone know a command in which the installer opens a specific file and finds information which points to the installation location and uses that location to do the installation automatically?

If I understand the question, you are asking if it is possible to specify the default installation directory at the time you run the installer.

Yes, this is possible.

Specify /dir="E:\program\My App" (for example) on the installer's command line.

For example, if your installer is called MyAppSetup.exe, you would write something like this:

MyAppSetup /dir="E:\program\My App"

For more information, see the Inno Setup documentation section titled Setup Command Line Parameters [1].


Bill

Lee Cley da Silva Lima

unread,
Jul 12, 2022, 4:10:19 PM7/12/22
to innosetup
actually no, I sell add-ons for a game, and it is sold by microsoft and steam, so it has 2 installation possibilities in addition to custom installation, so this file contains the direction where it will always install the customizable folder, mine The idea is for the installer to open this file, read this line and set the installation location by itself!

Jernej Simončič

unread,
Jul 12, 2022, 4:32:06 PM7/12/22
to Lee Cley da Silva Lima on [innosetup]

On Tuesday, July 12, 2022, 22:10:19, Lee Cley da Silva Lima wrote:


actually no, I sell add-ons for a game, and it is sold by microsoft and steam, so it has 2 installation possibilities in addition to custom installation, so this file contains the direction where it will always install the customizable folder, mine The idea is for the installer to open this file, read this line and set the installation location by itself!

You can do this with [Code] – there are functions that let you read files, and also functions for reading from Registry. 

 

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


You no sooner get your head above water than someone pulls your flippers off.
       -- Stock's Observation

Wilenty

unread,
Jul 12, 2022, 4:45:25 PM7/12/22
to innosetup
Hello,
I created for you example function named: "Function GetInstallPathFromFile(FileName, Str2Find: String): String;"
And example with that function how to use it.

In the first parameter you will have specify the filename from which you want to get the install path, and second parameter named "Str2Find" is the "InstalledPackagesPath" in your example.
You only have to use that function in your InnoSetup [code] to replace default install path at runtime.

If my work helped you in any way, please consider to support me, you will find the support links on my GitHub, or in the attached (and packed) example.

Greetings,
Wilenty
GetInstallPathFromFile.7z

Eivind Bakkestuen

unread,
Jul 12, 2022, 9:18:19 PM7/12/22
to inno...@googlegroups.com
10 lines of code, and it's a download? Consider posting the source in the future, so your source is indexed, so others can find it. :)

Function GetInstallPathFromFile(FileName, Str2Find: String): String;
  Var
    aStr: TArrayOfString;
    i: Integer;
  begin
    SetLength( Result, 0 );
    If LoadStringsFromFile(FileName, aStr) then
      For i := 0 to GetArrayLength(aStr)-1 do
        If Pos(Str2Find, aStr[i]) > 0 then
          Result := RemoveQuotes( Trim( Copy( aStr[i], Length(Str2Find)+1, Length(aStr[i]) ) ) );
end;


--
You received this message because you are subscribed to the Google Groups "innosetup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to innosetup+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/innosetup/6ccd7c69-132f-4e68-83f7-2d74966392d3n%40googlegroups.com.

Wilenty

unread,
Jul 13, 2022, 6:24:40 AM7/13/22
to innosetup
Eivind wrote:
"10 lines of code, and it's a download? Consider posting the source in the future, so your source is indexed, so others can find it. :)"

For you it's only ten lines of code, it can be done in 100 or 1000 lines of code if you want. It's easy to post my work when it's already done. But in every programing skills is important to do that thing as short as possible, i.e. to use as low as possible hardware time and resources. You don't know how many time I've spend before monitor to learn programming languages myself, but you see only 10 lines of code...

But because the OP didn't shared the file from which he wants get that string, in my opinion, it's better to share minimum working working example, than single function ripped out of context. I shared them in one packed file, the minimum working example with example text file to keep these files together. I see that you knows better than me what is better, and the indexing is more important than understanding.
So, next time I will answer directly to the OP without posting my example(s) on this forum, if you like it or not. :)

By the way, in that function you posted probably is one bug. ;)+

Martijn Laan

unread,
Jul 13, 2022, 7:04:34 AM7/13/22
to inno...@googlegroups.com
Hi Wilently,

Your knowledge is appreciated and extensive but please stop turning everything into a personal fight.

Thanks & greetings,
Martijn

Op 13-7-2022 om 12:24 schreef Wilenty:
By the way, in that function you posted probably is one bug. ;)+ --
You received this message because you are subscribed to the Google Groups "innosetup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to innosetup+...@googlegroups.com.

Lee Cley da Silva Lima

unread,
Jul 13, 2022, 11:39:19 AM7/13/22
to innosetup
tks man
Reply all
Reply to author
Forward
0 new messages