Go Back   FileForums > Game Backup > PC Games > PC Games - CD/DVD Conversions > Conversion Tutorials

Reply
 
Thread Tools Display Modes
  #1396  
Old 19-06-2020, 10:07
bunti_o4u's Avatar
bunti_o4u bunti_o4u is offline
Registered User
 
Join Date: Aug 2017
Location: India
Posts: 162
Thanks: 29
Thanked 167 Times in 61 Posts
bunti_o4u is on a distinguished road
Loading items in combobox from text file

I am trying to load the items in a combobox from a text file but whats it loading is the last line and not all the lines..

Pl help. Thnx in advance..
Code:
var
  S: String;

function GetFileLines(const FileName: string; out Items: string): Boolean;
var
  FileLines: TArrayOfString;
  LineIndex: Integer;
begin
  Result:= LoadStringsFromFile(FileName, FileLines);
  if Result then
    for LineIndex:=0 to (GetArrayLength(FileLines)-1) do
    Items:= FileLines[LineIndex];
end;

  Combobox1:= TComboBox.Create(WizardForm);
  with Combobox1 do
  begin
    Parent:=WizardForm;
    SetBounds(left, Top, Width, Height);
    Style:=csDropDown;
    Color:=clWhite;
    if GetFileLines(ExpandConstant('{src}\Text.ini'), S) then
      Items.Add(S);
  end;

Last edited by bunti_o4u; 19-06-2020 at 10:12.
Reply With Quote
Sponsored Links
  #1397  
Old 19-06-2020, 12:16
Cesar82's Avatar
Cesar82 Cesar82 is offline
Registered User
 
Join Date: May 2011
Location: Brazil
Posts: 944
Thanks: 1,628
Thanked 2,083 Times in 699 Posts
Cesar82 is on a distinguished road
Quote:
Originally Posted by bunti_o4u View Post
I am trying to load the items in a combobox from a text file but whats it loading is the last line and not all the lines..

Pl help. Thnx in advance..
Code:
var
  S: String;

function GetFileLines(const FileName: string; out Items: string): Boolean;
var
  FileLines: TArrayOfString;
  LineIndex: Integer;
begin
  Result:= LoadStringsFromFile(FileName, FileLines);
  if Result then
    for LineIndex:=0 to (GetArrayLength(FileLines)-1) do
    Items:= FileLines[LineIndex];
end;

  Combobox1:= TComboBox.Create(WizardForm);
  with Combobox1 do
  begin
    Parent:=WizardForm;
    SetBounds(left, Top, Width, Height);
    Style:=csDropDown;
    Color:=clWhite;
    if GetFileLines(ExpandConstant('{src}\Text.ini'), S) then
      Items.Add(S);
  end;
TRY:
Code:
procedure GetFileLines(const FileName: string; var Combo: TComboBox);
var
  FileLines: TArrayOfString;
  LineIndex: Integer;
begin
  if  LoadStringsFromFile(FileName, FileLines) then
    for LineIndex := 0 to GetArrayLength(FileLines) - 1 do
      Combo.Items.Add(FileLines[LineIndex]);
end;

  Combobox1:= TComboBox.Create(WizardForm);
  with Combobox1 do
  begin
    Parent := WizardForm;
    SetBounds(left, Top, Width, Height);
    Style := csDropDown;
    Color := clWhite;
    GetFileLines(ExpandConstant('{src}\Text.ini'), Combobox1)
  end;
Reply With Quote
The Following User Says Thank You to Cesar82 For This Useful Post:
bunti_o4u (19-06-2020)
  #1398  
Old 19-06-2020, 14:49
bunti_o4u's Avatar
bunti_o4u bunti_o4u is offline
Registered User
 
Join Date: Aug 2017
Location: India
Posts: 162
Thanks: 29
Thanked 167 Times in 61 Posts
bunti_o4u is on a distinguished road
Quote:
Originally Posted by Cesar82 View Post
TRY:
I have done the same but forgot to put var in the procedure
Code:
procedure GetFileLines(const FileName: string; var Combo: TComboBox);
Thank you.. it worked but now I am facing another problem.

I have second Combobox which is dependent on first combobox for its filename. Procedure is generating Combobox1.Items.Text as Line1Line2Line3(...).ini

Pl tell me how to fix it..
Code:
  Combobox2:= TComboBox.Create(WizardForm);
  with Combobox2 do
  begin
    Parent := WizardForm;
    SetBounds(left, Top, Width, Height);
    Style := csDropDown;
    Color := clWhite;
    GetFileLines(ExpandConstant('{src}\'+ ComboBox1.Items.Text +'.ini'), Combobox2)
  end;

Last edited by bunti_o4u; 19-06-2020 at 14:52.
Reply With Quote
  #1399  
Old 19-06-2020, 18:39
Cesar82's Avatar
Cesar82 Cesar82 is offline
Registered User
 
Join Date: May 2011
Location: Brazil
Posts: 944
Thanks: 1,628
Thanked 2,083 Times in 699 Posts
Cesar82 is on a distinguished road
Quote:
Originally Posted by bunti_o4u View Post
I have second Combobox which is dependent on first combobox for its filename. Procedure is generating Combobox1.Items.Text as Line1Line2Line3(...).ini

Pl tell me how to fix it..
Code:
  Combobox2:= TComboBox.Create(WizardForm);
  with Combobox2 do
  begin
    Parent := WizardForm;
    SetBounds(left, Top, Width, Height);
    Style := csDropDown;
    Color := clWhite;
    GetFileLines(ExpandConstant('{src}\'+ ComboBox1.Items.Text +'.ini'), Combobox2)
  end;
TRY
Code:
var
  I: Integer

  Combobox2:= TComboBox.Create(WizardForm);
  with Combobox2 do
  begin
    Parent := WizardForm;
    SetBounds(left, Top, Width, Height);
    Style := csDropDown;
    Color := clWhite;
    for I := 0 to Combobox1.Items.Count - 1 do
      GetFileLines(ExpandConstant('{src}\' + ComboBox1.Items.Strings[I]), Combobox2)
  end;
Reply With Quote
The Following User Says Thank You to Cesar82 For This Useful Post:
bunti_o4u (20-06-2020)
  #1400  
Old 20-06-2020, 02:54
bunti_o4u's Avatar
bunti_o4u bunti_o4u is offline
Registered User
 
Join Date: Aug 2017
Location: India
Posts: 162
Thanks: 29
Thanked 167 Times in 61 Posts
bunti_o4u is on a distinguished road
Quote:
Originally Posted by Cesar82 View Post
TRY
Thank you for helping me out..

This code didn't work.. I am trying something else and I don't know whether it would fix it or not..

Pl have a look at the attached script..
Attached Files
File Type: rar MyScript.rar (14.8 KB, 6 views)
Reply With Quote
  #1401  
Old 20-06-2020, 08:22
Cesar82's Avatar
Cesar82 Cesar82 is offline
Registered User
 
Join Date: May 2011
Location: Brazil
Posts: 944
Thanks: 1,628
Thanked 2,083 Times in 699 Posts
Cesar82 is on a distinguished road
Quote:
Originally Posted by bunti_o4u View Post
Thank you for helping me out..

This code didn't work.. I am trying something else and I don't know whether it would fix it or not..

Pl have a look at the attached script..
Try attached file.
I added 2 modes. (I commented on the mode with external functions)
Attached Files
File Type: 7z MyScript.7z (14.4 KB, 4 views)
Reply With Quote
The Following User Says Thank You to Cesar82 For This Useful Post:
bunti_o4u (20-06-2020)
  #1402  
Old 20-06-2020, 09:52
bunti_o4u's Avatar
bunti_o4u bunti_o4u is offline
Registered User
 
Join Date: Aug 2017
Location: India
Posts: 162
Thanks: 29
Thanked 167 Times in 61 Posts
bunti_o4u is on a distinguished road
Quote:
Originally Posted by Cesar82 View Post
Try attached file.
I added 2 modes. (I commented on the mode with external functions)
Thank you very much..

it's working smooth as butter..
Reply With Quote
The Following User Says Thank You to bunti_o4u For This Useful Post:
Cesar82 (20-06-2020)
  #1403  
Old 20-06-2020, 10:55
Cesar82's Avatar
Cesar82 Cesar82 is offline
Registered User
 
Join Date: May 2011
Location: Brazil
Posts: 944
Thanks: 1,628
Thanked 2,083 Times in 699 Posts
Cesar82 is on a distinguished road
Hey guys.

Can someone help me with a problem.
I was wondering if you have a way to convert hexadecimal Cyrillic characters (string) to a string using only inno setup functions or just the windows API without including additional libraries.
Summing up: I would like to convert: C := Chr($05E2);

I attached a file with a function that uses this, but I can't get it to work without including an additional library (I don't want to use Libs)
If some of the more knowledgeable users can help me, thank you in advance.
Please look at the attached code.
Attached Files
File Type: rar ChrW.rar (46.6 KB, 5 views)
Reply With Quote
  #1404  
Old 21-06-2020, 04:24
Razor12911's Avatar
Razor12911 Razor12911 is offline
Noob
 
Join Date: Jul 2012
Location: South Africa
Posts: 3,746
Thanks: 2,141
Thanked 11,076 Times in 2,295 Posts
Razor12911 is on a distinguished road
Quote:
Originally Posted by Cesar82 View Post
Hey guys.

Can someone help me with a problem.
I was wondering if you have a way to convert hexadecimal Cyrillic characters (string) to a string using only inno setup functions or just the windows API without including additional libraries.
Summing up: I would like to convert: C := Chr($05E2);

I attached a file with a function that uses this, but I can't get it to work without including an additional library (I don't want to use Libs)
If some of the more knowledgeable users can help me, thank you in advance.
Please look at the attached code.
$05E2 is not Cyrillic, it's Hebrew
Chr accepts byte value and returns ASCII value, $0532 is a Word value
You must use #$???? For UTF-8 format, example C := #$05E2

Last edited by Razor12911; 21-06-2020 at 04:28.
Reply With Quote
  #1405  
Old 21-06-2020, 06:58
Cesar82's Avatar
Cesar82 Cesar82 is offline
Registered User
 
Join Date: May 2011
Location: Brazil
Posts: 944
Thanks: 1,628
Thanked 2,083 Times in 699 Posts
Cesar82 is on a distinguished road
Quote:
Originally Posted by Razor12911 View Post
$05E2 is not Cyrillic, it's Hebrew
Chr accepts byte value and returns ASCII value, $0532 is a Word value
You must use #$???? For UTF-8 format, example C := #$05E2
Yes, I ended up putting the non-Cyrillic example, but it has the same meaning.
They are Word values.
I know that chr only supports Byte and these type of characters are word type.
But as in the script example, I need to convert a hexadecimal string read from the inno setup language file and convert it to a string (text).

Code:
S1 := '<0420><0443><0441><0441><043A><0438><0439>';
From this string above I need to return: "Русский"
I want to do this using only API or in the script itself if there is im way to do this without external DLL.
Please take a look at the script.
Reply With Quote
  #1406  
Old 21-06-2020, 12:37
bunti_o4u's Avatar
bunti_o4u bunti_o4u is offline
Registered User
 
Join Date: Aug 2017
Location: India
Posts: 162
Thanks: 29
Thanked 167 Times in 61 Posts
bunti_o4u is on a distinguished road
Quote:
Originally Posted by Cesar82 View Post
Code:
S1 := '<0420><0443><0441><0441><043A><0438><0439>';
From this string above I need to return: "Русский"
I hope you want this...

BTW if you are on discord pl add me (discord id: buntionly4u#4466)
Code:
function InitializeSetup(): Boolean;
var
  S1, S2: String;
begin
  S1 := #$0420+#$0443+#$0441+#$0441+#$043A+#$0438+#$0439;
  MsgBox(S1, mbInformation, MB_OK);
end;
Attached Images
File Type: png Untitled.png (1.6 KB, 62 views)

Last edited by bunti_o4u; 21-06-2020 at 12:43.
Reply With Quote
  #1407  
Old 21-06-2020, 13:51
Cesar82's Avatar
Cesar82 Cesar82 is offline
Registered User
 
Join Date: May 2011
Location: Brazil
Posts: 944
Thanks: 1,628
Thanked 2,083 Times in 699 Posts
Cesar82 is on a distinguished road
Quote:
Originally Posted by bunti_o4u View Post
I hope you want this...

BTW if you are on discord pl add me (discord id: buntionly4u#4466)
Code:
function InitializeSetup(): Boolean;
var
  S1, S2: String;
begin
  S1 := #$0420+#$0443+#$0441+#$0441+#$043A+#$0438+#$0439;
  MsgBox(S1, mbInformation, MB_OK);
end;
Thanks for responding, but it's not that simple.
I get the string using the ISPP by calling the ReadIni function.
Check the Russian.isl language language of Inno Setup and try to read the key LanguageName= using GetIniString and try to transform it into text as in your message.
Download the ChrW script that you will understand.
Reply With Quote
  #1408  
Old 22-06-2020, 06:27
KaktoR's Avatar
KaktoR KaktoR is offline
Lame User
 
Join Date: Jan 2012
Location: From outer space
Posts: 4,191
Thanks: 1,068
Thanked 6,766 Times in 2,542 Posts
KaktoR is on a distinguished road
Hey guys&girls

I'm looking for a char (preferably) or icon (max 14x14px) to display free/need space, which can be understand in any language (or at least most).

Anyone have ideas?

I already had looked through windows charmap but can't find anything usefull.
__________________
Haters gonna hate

Last edited by KaktoR; 22-06-2020 at 06:32.
Reply With Quote
  #1409  
Old 22-06-2020, 13:15
bunti_o4u's Avatar
bunti_o4u bunti_o4u is offline
Registered User
 
Join Date: Aug 2017
Location: India
Posts: 162
Thanks: 29
Thanked 167 Times in 61 Posts
bunti_o4u is on a distinguished road
If we want to run any task during installation we can use below command which run the task or other program in a separate window:
Code:
function Exec(const Filename, Params, WorkingDir: String; const ShowCmd: Integer; const Wait: TExecWait; var ResultCode: Integer): Boolean;
I just want to know - can we add console within wizard page instead of separate windows to show console details to user.

If yes then pl tell how to do it..

Thanks in advance..
Reply With Quote
  #1410  
Old 22-06-2020, 14:25
DiCaPrIo DiCaPrIo is offline
Registered User
 
Join Date: Apr 2017
Location: Don't Know
Posts: 50
Thanks: 90
Thanked 49 Times in 30 Posts
DiCaPrIo is on a distinguished road
Quote:
Originally Posted by bunti_o4u View Post
If we want to run any task during installation we can use below command which run the task or other program in a separate window:
Code:
function Exec(const Filename, Params, WorkingDir: String; const ShowCmd: Integer; const Wait: TExecWait; var ResultCode: Integer): Boolean;
I just want to know - can we add console within wizard page instead of separate windows to show console details to user.

If yes then pl tell how to do it..

Thanks in advance..
here
download ISutils and got the CaptureConsole.iss
https://www.fileforums.com/showthread.php?t=99835
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
INNO TROUBLESHOOT - Tutorials and Answers about INNO Setup REV0 Conversion Tutorials 129 21-05-2021 06:51
INNO TUTORIAL - Using Unicode and ANSI Versions of INNO Setup REV0 Conversion Tutorials 51 26-03-2015 07:57
Frequently Asked Questions Joe Forster/STA PC Games - Frequently Asked Questions 0 29-11-2005 10:48



All times are GMT -7. The time now is 19:46.


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