PDA

View Full Version : i got a question about variables in inno


ahmedwaill
21-02-2019, 14:23
hello, i've got a question i'm using the WPI script, but i wanted to add in the

[Setup]
UninstallDisplaySize={#Size2}
and i can easily define a variable and called it Size 2 with the number, it should be like the file size in MB×1024×1024
so can't i just make a variable to calculate it automatically ?
i got already a variable called
Size
that got the file size in MB, so i can't use it like
define Size2 "{#Size}*1024*1024"
or something like that ?!
thanks a lot.

KaktoR
21-02-2019, 14:47
It would be better to write a function to do this math and then use the code for the function in UninstallDisplaySize

ahmedwaill
21-02-2019, 15:01
well u mean i define first a variable as longint, then do the calculations ?
but if that's how to goes how i can use it in the [Setup] section ? since that section is written before the [Code] section...

KaktoR
21-02-2019, 15:20
Well you can use
UninstallDisplaySize={code:YourCodeName}

ahmedwaill
21-02-2019, 15:37
well i don't think that i can really do it since i'm not that experienced in codes stuff, can't you tell me how to do it ?

[Setup]
UninstallDisplaySize={code:Size2}
{Code}
var
Size2: Longint;
function UninstallSize
Size2={#Size}*1024*1024;
end;

something like that ?
PS in the code section i wrote it as {Code} cuz it will end the CODE box in the site... i know that it should be [ Code ]

JRD!
21-02-2019, 17:30
The UninstallDisplaySize section is limited to 2GB with Inno Setup 5.5.1

#define SizeInMB 2047

[Setup]
UninstallDisplaySize={#SizeInMB * 1024 * 1024}

ahmedwaill
22-02-2019, 02:15
The UninstallDisplaySize section is limited to 2GB with Inno Setup 5.5.1

#define SizeInMB 2047

[Setup]
UninstallDisplaySize={#SizeInMB * 1024 * 1024}


alright , thanks a lot man :)

ahmedwaill
22-02-2019, 02:42
well i get this error when i use it
https://i.postimg.cc/sX29JSWZ/Image-10.png
EDIT: well it's cuz of the size i made for it 2048, but idk why it's maximum 2GB , and i managed to do it 5.6GB in the FMX Project by Razor , but when i made in the script.iss
[App]
Size2=6100234885
and in the wpi1801.engine that's included inside the script.iss
#define Size2 ReadIni(SourcePath + "\script.iss", "App", "Size2", "0")
[Setup]
UninstallDisplaySize={#Size2}

and it worked like that as you can see in the pic
https://i.postimg.cc/MX2mZPGJ/Image-11.png


Last Edit: well the issue is when it's passed to the Uninstall Display Size it goes as STR and it should be LONGINT, so what's the Convert to LONGINT Tag for Define tag ???

JRD!
22-02-2019, 12:49
well i get this error when i use it
https://i.postimg.cc/sX29JSWZ/Image-10.png
EDIT: well it's cuz of the size i made for it 2048, but idk why it's maximum 2GB , and i managed to do it 5.6GB in the FMX Project by Razor , but when i made in the script.iss
[App]
Size2=6100234885
and in the wpi1801.engine that's included inside the script.iss
#define Size2 ReadIni(SourcePath + "\script.iss", "App", "Size2", "0")
[Setup]
UninstallDisplaySize={#Size2}

and it worked like that as you can see in the pic
https://i.postimg.cc/MX2mZPGJ/Image-11.png



The Razor program writes the value itself into the registry.


Last Edit: well the issue is when it's passed to the Uninstall Display Size it goes as STR and it should be LONGINT, so what's the Convert to LONGINT Tag for Define tag ???

The typecasting is automatic if you go through ISPP. What is the version of inno setup that you used in your project?

ahmedwaill
22-02-2019, 13:43
5.5.1 Enhanced Edition build 121002
i managed to make it write the value i want but i have to calculate it myself so i write the exact value in bytes so it's not about having the maximum size 2GB, you can write whatever you want ...
but the values can't be auto calculated i guess for some reason, and i guess that it needs to be type Longint, not only Int ...

JRD!
24-02-2019, 06:07
5.5.1 Enhanced Edition build 121002
i managed to make it write the value i want but i have to calculate it myself so i write the exact value in bytes so it's not about having the maximum size 2GB, you can write whatever you want ...
but the values can't be auto calculated i guess for some reason, and i guess that it needs to be type Longint, not only Int ...

1. The easiest way is not to go through UninstallDisplaySize, by default Inno setup write the value by calculating the weight of the files. (I do not know if it supports 2GB + or 4GB +)
2. The safest way is to create a small program or dll that writes the size of the game in the registry at the end.

Like this:

if bAllOK then
SetGameSizeInRegisrty('5420m');


Regedit path:

HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Uninstall \ GAMENAME_is1

Note:

The size is stored in a DWORD value (32BITS), but it is expressed in KB, so we can store values ​​up to 3.99TB

ahmedwaill
24-02-2019, 07:57
well i got it to work with this way
UninstallDisplaySize= 2147483648
and got it to work like that too
ExtraDiskSpaceRequired= 2147483648
and those two displays 2GB, and i could make it more than that aswell, since u couldn't make it automatically calculated so i had to manually add the size in bytes so i guess the case is solved atm :D
thanks bro for your time and effort in trying to help me ..
as i said the issue is in the calculations itself.

JRD!
25-02-2019, 10:51
Sorry that I did not use Inno setup anymore, you can do it like this:


#define GameSize "42803" ; Size of game in MB;

[Setup]
UninstallDisplaySize="{#GameSize}000000"

ahmedwaill
26-02-2019, 08:19
Sorry that I did not use Inno setup anymore, you can do it like this:


#define GameSize "42803" ; Size of game in MB;

[Setup]
UninstallDisplaySize="{#GameSize}000000"


wow interesting one, alright mate will try it once am free cuz am kinda busy today. thanks mate<3