FileForums

FileForums (https://fileforums.com/index.php)
-   Conversion Tutorials (https://fileforums.com/forumdisplay.php?f=55)
-   -   ASIS: Advanced Simple Installer Script (https://fileforums.com/showthread.php?t=99481)

Schabik 22-03-2019 04:53

Ok, sory @bubobih for the "out of the blue" question for @KaktoR but.


@KaktoR can You tell me what I must add to Your script if I want to check if the component was selected or not and components are checked ("=1") in the settings.ini



For example I want to check if Components are enabled in settings.ini and Polish language was selected (As Components name I'll use cm:PL) can I check if it is selected by adding something like this:

Code:

if ({#UseComponents} = 1) and (IsComponentSelected(GetIniString('ComponentsSettings', 'Component' + IntToStr(CompIndexList[I])+ '.Name' = 'cm:PL')) then
      begin


Of course I know the code above is wrong and It won't work but with some adjustments I'm sure it would.

KaktoR 22-03-2019 06:07

I think I don't understand your question right.

If you select a cmomponent in installer, it will be extracted. If it is not selected, installer will not extract it.

Schabik 22-03-2019 07:10

Quote:

Originally Posted by KaktoR (Post 480325)
I think I don't understand your question right.

If you select a cmomponent in installer, it will be extracted. If it is not selected, installer will not extract it.

The extract part is OK, although I'm having problems with understanding the new code.

I have to run a program conditionally that targets in AC1 .forge.patch files.

The condition is that it only should run when Polish or Czech language is selected. How to check if Polish (for example component3.Name=cm:PL) is selected to run the program and run it if the condition is fulfilled?

In Beta6 or 7 it was easy, check if "IsComponentSelected('lang\PolishLang')" and then run program to patch the forge files but now it's not clear for me.

KaktoR 22-03-2019 14:57

Ok now I understand.

I will look.

Schabik 22-03-2019 22:09

Quote:

Originally Posted by KaktoR (Post 480332)
Ok now I understand.

I will look.

Thanks 😊

Cesar82 23-03-2019 19:41

ASIS - Valid Component
 
1 Attachment(s)
Quote:

Originally Posted by Schabik (Post 480327)
The extract part is OK, although I'm having problems with understanding the new code.

I have to run a program conditionally that targets in AC1 .forge.patch files.

The condition is that it only should run when Polish or Czech language is selected. How to check if Polish (for example component3.Name=cm:PL) is selected to run the program and run it if the condition is fulfilled?

In Beta6 or 7 it was easy, check if "IsComponentSelected('lang\PolishLang')" and then run program to patch the forge files but now it's not clear for me.

How to use by ID (ID is the number of the component represented by "#" in keys Component#.Name=):
Code:

  if IsComponentSelectedByID(3) then
    MsgBox('True', mbInformation, MB_OK)
  else
    MsgBox('False', mbInformation, MB_OK);

How to use by Name (Same name that you used in INI):
- If you have "Character Backslash" in the name you will check with dependence on "Level".
- If you do not have "Character Backslash" in the name you will only check on the components with "Component#.File" other than empty.
Code:

  if IsComponentSelectedByName('Game Components\') then
    MsgBox('True', mbInformation, MB_OK)
  else
    MsgBox('False', mbInformation, MB_OK);

Code:

  if IsComponentSelectedByName('Game Components\Custom Name') then
    MsgBox('True', mbInformation, MB_OK)
  else
    MsgBox('False', mbInformation, MB_OK);

Code:

  if IsComponentSelectedByName('Game Components\cm:FR') then
    MsgBox('True', mbInformation, MB_OK)
  else
    MsgBox('False', mbInformation, MB_OK);


Schabik 24-03-2019 09:45

Quote:

Originally Posted by Cesar82 (Post 480343)
How to use by ID (ID is the number of the component represented by "#" in keys Component#.Name=):
Code:

  if IsComponentSelectedByID(3) then
    MsgBox('True', mbInformation, MB_OK)
  else
    MsgBox('False', mbInformation, MB_OK);

How to use by Name (Same name that you used in INI):
- If you have "" in the name you will check with dependence on "Level".
- If you do not have "" in the name you will only check on the components with "Component # .File" other than empty.
Code:

  if IsComponentSelectedByName('Game Components\') then
    MsgBox('True', mbInformation, MB_OK)
  else
    MsgBox('False', mbInformation, MB_OK);

Code:

  if IsComponentSelectedByName('Game Components\Custom Name') then
    MsgBox('True', mbInformation, MB_OK)
  else
    MsgBox('False', mbInformation, MB_OK);

Code:

  if IsComponentSelectedByName('Game Components\cm:FR') then
    MsgBox('True', mbInformation, MB_OK)
  else
    MsgBox('False', mbInformation, MB_OK);


Do I need to add some decelerations to the code for IsComponentSelectedByID or IsComponentSelectedByName functions?

KaktoR 24-03-2019 09:54

You can use the folowing for CurStep = ssPostInstall or CurStep = ssDone (like you wish)

Code:

if IsComponentSelectedByName('Game Components\cm:PL') then
    {Execute program here (you can use Exec2 function)}
if IsComponentSelectedByName('Game Components\cm:CZ') then
    {Execute program here (you can use Exec2 function)}

Btw, I rework the Redist page. New update will follow in the next days.

Schabik 24-03-2019 11:35

2 Attachment(s)
Quote:

Originally Posted by KaktoR (Post 480350)
You can use the folowing for CurStep = ssPostInstall or CurStep = ssDone (like you wish)

Code:

if IsComponentSelectedByName('Game Components\cm:PL') then
    {Execute program here (you can use Exec2 function)}
if IsComponentSelectedByName('Game Components\cm:CZ') then
    {Execute program here (you can use Exec2 function)}

Btw, I rework the Redist page. New update will follow in the next days.

OK, thanks a lot guys 😁 I'll check it out tomorrow, because today is Sunday and in my country about 8:30 PM. 😋


Ok, after adding the conditions and trying to compile I've got an error says that a comma is expected. after looking at the end of the line the comma is added but in the 94-th column there should't be a comma.
Attachment 24411


I'm attaching my script.

Cesar82 25-03-2019 01:58

1 Attachment(s)
Quote:

Originally Posted by Schabik (Post 480352)
OK, thanks a lot guys 😁 I'll check it out tomorrow, because today is Sunday and in my country about 8:30 PM. 😋


Ok, after adding the conditions and trying to compile I've got an error says that a comma is expected. after looking at the end of the line the comma is added but in the 94-th column there should't be a comma.
Attachment 24411


I'm attaching my script.

try:
Goto line 4225 and replace in this line end; by #endif
Now goto line 3945 and delete this for lines ( 3945, 3946, 3947, 3948 ) and insert:
Code:

    #if UseComponents == "1"
    if (IsComponentSelectedByName('cm:GameLang\cm:PL')) then
    begin
      WizardForm.ProgressGauge.Hide;
      WizardForm.StatusLabel.Caption := ExpandConstant('{cm:PatchingFiles}');


Attached is a way for you to simplify the code of applying the path with xdelta.
Only the file names change, so it's more practical to create a loop

Schabik 25-03-2019 02:13

Quote:

Originally Posted by Cesar82 (Post 480358)
try:
Goto line 4225 and replace in this line end; by #endif
Now goto line 3945 and delete this for lines ( 3945, 3946, 3947, 3948 ) and insert:
Code:

    #if UseComponents == "1"
    if (IsComponentSelectedByName('cm:GameLang\cm:PL')) then
    begin
      WizardForm.ProgressGauge.Hide;
      WizardForm.StatusLabel.Caption := ExpandConstant('{cm:PatchingFiles}');



Nope, still the same :(
Ok, I've got it now.


in:
Code:

RegWriteDWordValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#Name}_is1', 'EstimatedSize', Round(InstallationSize / 1024));

my {#Name} constant is "Assassin's Creed", the apostrophe causes the error...
Is there a way to replace the apostrophe for the name of the Game to be complete?
Unfortunately I think the game's name must be with the apostrophe for registry entries to work :(

Cesar82 25-03-2019 02:28

Quote:

Originally Posted by Schabik (Post 480359)
Nope, still the same :(
Ok, I've got it now.


in:
Code:

RegWriteDWordValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#Name}_is1', 'EstimatedSize', Round(InstallationSize / 1024));

my {#Name} constant is "Assassin's Creed", the apostrophe causes the error...
Is there a way to replace the apostrophe for the name of the Game to be complete?
Unfortunately I think the game's name must be with the apostrophe for registry entries to work :(

replace line by:
Code:

RegWriteDWordValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#StringChange(Name, "'", "''")}_is1', 'EstimatedSize', Round(InstallationSize / 1024));
Look at the previous post the script I posted;

Schabik 25-03-2019 03:24

2 Attachment(s)
Quote:

Originally Posted by Cesar82 (Post 480360)
replace line by:
Code:

RegWriteDWordValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#StringChange(Name, "'", "''")}_is1', 'EstimatedSize', Round(InstallationSize / 1024));
Look at the previous post the script I posted;


Thanks :)
Ok, About DPICalculator, I think it Does work for 125% Scale but on 100% it does This:


Attachment 24413


and on 150% does this:


Attachment 24414

KaktoR 25-03-2019 07:40

Unfortunatelly I only have a FullHD monitor (1920x1080) and therefore I can't test the DPI right. Maybe Cesar is in the mood to fix this someday :(

Cesar82 25-03-2019 07:41

Quote:

Originally Posted by Schabik (Post 480361)
Thanks :)
Ok, About DPICalculator, I think it Does work for 125% Scale but on 100% it does This:


Attachment 24413


and on 150% does this:


Attachment 24414

I do not know what's happening to you.
Here in Full HD resolution change to 125%, 150% 175% works normal.
https://i.imgur.com/bu87yFH.png


All times are GMT -7. The time now is 12:59.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
FileForums @ https://fileforums.com