Go Back   FileForums > Game Backup > PC Games > PC Games - CD/DVD Conversions > Conversion Tutorials
Register FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 20-08-2017, 10:13
danswano danswano is offline
Registered User
 
Join Date: Feb 2013
Location: Luxm
Posts: 314
Thanks: 218
Thanked 27 Times in 22 Posts
danswano is on a distinguished road
Question Progress for 7z unpacking on {app}

Hello,
How to show progress while inno is unpacking .7z file inside {app} folder like it does to arc?
It's just freezes until it's fully unpacked with no progress then it continue to the other files.
Thanks.
Reply With Quote
Sponsored Links
  #2  
Old 20-08-2017, 21:04
78372 78372 is offline
Registered User
 
Join Date: Dec 2016
Location: Bangladesh
Posts: 650
Thanks: 772
Thanked 953 Times in 309 Posts
78372 is on a distinguished road
What script are you using?
__________________
NOT AVAILABLE
Reply With Quote
  #3  
Old 20-08-2017, 23:49
danswano danswano is offline
Registered User
 
Join Date: Feb 2013
Location: Luxm
Posts: 314
Thanks: 218
Thanked 27 Times in 22 Posts
danswano is on a distinguished road
The original ISDone:
Quote:
if not ISExec ( 0, 0, 0, ExpandConstant('{tmp}\7z.exe'), '-o"' + ExpandConstant('{app}') + '" x -y "' + ExpandConstant('{app}\data.001') + '" ', ExpandConstant('{tmp}'), 'extracting, please wait.',false) then break;
DeleteFile(ExpandConstant('{app}\data.001'));
Reply With Quote
  #4  
Old 21-08-2017, 04:54
78372 78372 is offline
Registered User
 
Join Date: Dec 2016
Location: Bangladesh
Posts: 650
Thanks: 772
Thanked 953 Times in 309 Posts
78372 is on a distinguished road
Use IS7ZIPExtract from ISDone
__________________
NOT AVAILABLE
Reply With Quote
The Following User Says Thank You to 78372 For This Useful Post:
danswano (21-08-2017)
  #5  
Old 21-08-2017, 07:58
danswano danswano is offline
Registered User
 
Join Date: Feb 2013
Location: Luxm
Posts: 314
Thanks: 218
Thanked 27 Times in 22 Posts
danswano is on a distinguished road
Cna you paste a modified full line of IS7ZIPExtract to unpack data.001 with passowrd support please?
Reply With Quote
  #6  
Old 21-08-2017, 08:28
Gupta Gupta is offline
Banned
 
Join Date: Aug 2016
Location: https://t.me/pump_upp
Posts: 399
Thanks: 139
Thanked 715 Times in 231 Posts
Gupta is on a distinguished road
Send a message via ICQ to Gupta Send a message via AIM to Gupta Send a message via Yahoo to Gupta
>>Use IS7ZIPExtract from ISDone
can only extract 7z format

here is the answer, understand it yourself
Code:
function BufferToAnsi(const Buffer: string): AnsiString;
var
  W: Word;
  I: Integer;
begin
  SetLength(Result, Length(Buffer) * 2);
  for I := 1 to Length(Buffer) do
  begin
    W := Ord(Buffer[I]);
    Result[(I * 2)] := Chr(W shr 8); { high byte }
    Result[(I * 2) - 1] := Chr(Byte(W)); { low byte }
  end;
end;

type
  TTimerProc = procedure(H: LongWord; Msg: LongWord; IdEvent: LongWord; Time: LongWord);

function SetTimer(Wnd: LongWord; IDEvent, Elapse: LongWord; TimerFunc: LongWord): LongWord;
  external '[email protected] stdcall';
function KillTimer(hWnd: LongWord; uIDEvent: LongWord): BOOL;
  external '[email protected] stdcall';

function WrapTimerProc(Callback: TTimerProc; ParamCount: Integer): LongWord;
  external 'wrapcallback@files:innocallback.dll stdcall';

var
  ProgressPage: TOutputProgressWizardPage;
  ProgressFileName: string;

procedure UpdateProgressProc(H: LongWord; Msg: LongWord; Event: LongWord; Time: LongWord);
var
  S: AnsiString;
  L: Integer;
  P: Integer;
  Max: Integer;
  Progress: string;
  Buffer: string;
  Stream: TFileStream;
  Percent: Integer;
  Found: Boolean;
begin
  Found := False;
  if not FileExists(ProgressFileName) then
  begin
    Log(Format('Progress file %s does not exist', [ProgressFileName]));
  end
    else
  begin
    try
      { Need shared read as the output file is locked for writting, }
      { so we cannot use LoadStringFromFile }
      Stream := TFileStream.Create(ProgressFileName, fmOpenRead or fmShareDenyNone);
      try
        L := Stream.Size;
        Max := 100*2014;
        if L > Max then
        begin
          Stream.Position := L - Max;
          L := Max;
        end;
        SetLength(Buffer, (L div 2) + (L mod 2));
        Stream.ReadBuffer(Buffer, L);
        S := BufferToAnsi(Buffer);
      finally
        Stream.Free;
      end;

      if S = '' then
      begin
        Log(Format('Progress file %s is empty', [ProgressFileName]));
      end;
    except
      Log(Format('Failed to read progress from file %s - %s', [
                 ProgressFileName, GetExceptionMessage]));
    end;
  end;

  if S <> '' then
  begin
    { Log(S); }
    P := Pos('Everything is Ok', S);
    if P > 0 then
    begin
      Log('Extraction done');
      Percent := 100;
      Found := True;
    end
      else
    begin
      P := Pos('%', S);
      if P > 0 then
      begin
        repeat
          Progress := Copy(S, 1, P - 1);
          Delete(S, 1, P);
          P := Pos('%', S);
        until (P = 0);

        P := Length(Progress);
        while (P > 0) and
              (Progress[P] in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.']) do
        begin
          Dec(P);
        end;

        Progress := Copy(Progress, P + 1, Length(Progress) - P);

        P := Pos('.', Progress);
        if P > 0 then
        begin
          Progress := Copy(Progress, 1, P - 1);
        end;

        Percent := StrToInt(Progress);
        Log(Format('Percent: %d', [Percent]));
        Found := True;
      end;
    end;
  end;

  if not Found then
  begin
    Log('No new data found');
    { no new progress data, at least pump the message queue }
    ProgressPage.SetProgress(ProgressPage.ProgressBar.Position, 100);
  end
    else
  begin
    ProgressPage.SetProgress(Percent, 100);
    ProgressPage.SetText(Format('Extracted: %d%%', [Percent]), '');
  end;
end;

procedure ExtractArc(ArcArchivePath: string);
var
  ArcExtracterPath: string;
  TempPath: string;
  CommandLine: string;
  Timer: LongWord;
  ResultCode: Integer;
  S: AnsiString;
  Message: string;
begin
  ExtractTemporaryFile('7z.exe');
  ExtractTemporaryFile('7z.dll');

  ProgressPage := CreateOutputProgressPage('Decompression', 'Decompressing archive...');
  ProgressPage.SetProgress(0, 100);
  ProgressPage.Show;
  try
    Timer := SetTimer(0, 0, 250, WrapTimerProc(@UpdateProgressProc, 4));

    TempPath := ExpandConstant('{tmp}');
    ArcExtracterPath := TempPath + '\7z.exe';
    ProgressFileName := ExpandConstant('{tmp}\progress.txt');
    Log(Format('Expecting progress in %s', [ProgressFileName]));
    CommandLine :=
      Format('"%s" x -y -o"%s" -bb3 -bsp1 "%s" 1> "%s"', [
        ArcExtracterPath, ExpandConstant('{app}'), ArcArchivePath, ProgressFileName]);
    Log(Format('Executing: %s', [CommandLine]));
    CommandLine := Format('/C "%s"', [CommandLine]);
    if not Exec(ExpandConstant('{cmd}'), CommandLine, '', SW_HIDE,
                ewWaitUntilTerminated, ResultCode) then
    begin
      RaiseException('Cannot start extracter');
    end
      else
    if ResultCode <> 0 then
    begin
      LoadStringFromFile(ProgressFileName, S);
      Message := Format('Arc extraction failed failed with code %d', [ResultCode]);
      Log(Message);
      Log('Output: ' + S);
      RaiseException(Message);
    end
      else
    begin
      Log('Arc extraction done');
    end;
  finally
    { Clean up }
    Log('Arc extraction cleanup');
    KillTimer(0, Timer);
    ProgressPage.Hide;
    DeleteFile(ProgressFileName);
  end;
  Log('Arc extraction end');
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep = ssPostInstall then
  begin
    ExtractArc(ExpandConstant('{src}\{#ArcArchive}'));
  end;
end;

Last edited by Gupta; 21-08-2017 at 09:14.
Reply With Quote
The Following 4 Users Say Thank You to Gupta For This Useful Post:
78372 (21-08-2017), Cesar82 (10-09-2017), danswano (21-08-2017), EzzEldin16 (21-08-2017)
  #7  
Old 21-08-2017, 09:11
78372 78372 is offline
Registered User
 
Join Date: Dec 2016
Location: Bangladesh
Posts: 650
Thanks: 772
Thanked 953 Times in 309 Posts
78372 is on a distinguished road
Quote:
Originally Posted by danswano View Post
Cna you paste a modified full line of IS7ZIPExtract to unpack data.001 with passowrd support please?
splitted 7zip archives are not supported by ISDone. You can use is7z.dll, but unfortunately it will not work for inno setup 5.3.0 and higher editions.
__________________
NOT AVAILABLE
Reply With Quote
The Following User Says Thank You to 78372 For This Useful Post:
danswano (21-08-2017)
  #8  
Old 21-08-2017, 10:23
danswano danswano is offline
Registered User
 
Join Date: Feb 2013
Location: Luxm
Posts: 314
Thanks: 218
Thanked 27 Times in 22 Posts
danswano is on a distinguished road
Question

Quote:
Originally Posted by PrinceGupta2000 View Post
>>Use IS7ZIPExtract from ISDone
can only extract 7z format

here is the answer, understand it yourself
[/CODE]
Thanks for the effort, can you strip the arc extraction stage out of the code cause i want to execute the 7z extraction after the arc isarcextract is finished.
I mean i want to extract the arc from {src} then extract the 7z from {app}
7z multi parts are packed inside the arc file.
Reply With Quote
  #9  
Old 28-08-2017, 01:51
danswano danswano is offline
Registered User
 
Join Date: Feb 2013
Location: Luxm
Posts: 314
Thanks: 218
Thanked 27 Times in 22 Posts
danswano is on a distinguished road
Quote:
Originally Posted by vint56 View Post
danswano
if not ISArcExtract ( 0, 0, ExpandConstant('{src}\arc.arc'), ExpandConstant('{app}\'), '', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
if not IS7ZipExtract ( 0, 0, ExpandConstant('{app}\CODMW2.7z'), ExpandConstant('{app}\'), false, '') then break;
It won't work with multi part 7z .001 .002 etc ..
Reply With Quote
  #10  
Old 28-08-2017, 03:19
vint56 vint56 is offline
Registered User
 
Join Date: May 2011
Location: almaty
Posts: 52
Thanks: 145
Thanked 55 Times in 31 Posts
vint56 is on a distinguished road
danswano
Then use WinRar there too there is an opportunity to break into archives

ISDone does not support unpacking of 7z multi-volume files only from rar

[Files]
Source: Include\7z.exe; DestDir: {tmp}; Flags: dontcopy

procedure CurStepChanged(CurStep: TSetupStep);

ExtractTemporaryFile('7z.exe');

if not ISExec ( 0, 0, 0, ExpandConstant('{tmp}\7z.exe'), '-o"' + ExpandConstant('{app}') + '" x -y -pPASSWORD "' + ExpandConstant('{src}\bundles.7z.001') + '" ', ExpandConstant('{tmp}'), '...',false) then break;

Last edited by vint56; 28-08-2017 at 03:37.
Reply With Quote
The Following User Says Thank You to vint56 For This Useful Post:
danswano (28-08-2017)
  #11  
Old 28-08-2017, 03:31
danswano danswano is offline
Registered User
 
Join Date: Feb 2013
Location: Luxm
Posts: 314
Thanks: 218
Thanked 27 Times in 22 Posts
danswano is on a distinguished road
Thanks

Last edited by danswano; 28-08-2017 at 03:36.
Reply With Quote
  #12  
Old 28-08-2017, 05:52
danswano danswano is offline
Registered User
 
Join Date: Feb 2013
Location: Luxm
Posts: 314
Thanks: 218
Thanked 27 Times in 22 Posts
danswano is on a distinguished road
One more question please!
Is it possible to split rar into discs and let inno ask for the next part on the next disc?
like data.rar on disc 1
and data.r0 on disc 2?
Reply With Quote
  #13  
Old 28-08-2017, 07:34
vint56 vint56 is offline
Registered User
 
Join Date: May 2011
Location: almaty
Posts: 52
Thanks: 145
Thanked 55 Times in 31 Posts
vint56 is on a distinguished road
danswano
if not ISArcExtract ( 0, 0, ExpandConstant('{src}\Disk-1.arc'), ExpandConstant('{app}\'), '', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
if not ShowChangeDiskWindow ('Пожалуйста, вставьте второй диск и дождитесь его инициализации.', ExpandConstant('{src}'),'Disk-2.arc') then break;
if not ISArcExtract ( 0, 0, ExpandConstant('{src}\Disk-2.arc'), ExpandConstant('{app}\'), '', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
if not ISRarExtract ( 0, 0, ExpandConstant('{app}\xxx.part01.rar'), ExpandConstant('{app}'), false, '') then break;
Reply With Quote
The Following User Says Thank You to vint56 For This Useful Post:
danswano (28-08-2017)
  #14  
Old 28-08-2017, 09:58
danswano danswano is offline
Registered User
 
Join Date: Feb 2013
Location: Luxm
Posts: 314
Thanks: 218
Thanked 27 Times in 22 Posts
danswano is on a distinguished road
Thanks but i meant directly without packing into arc files.
Reply With Quote
  #15  
Old 28-08-2017, 22:32
vint56 vint56 is offline
Registered User
 
Join Date: May 2011
Location: almaty
Posts: 52
Thanks: 145
Thanked 55 Times in 31 Posts
vint56 is on a distinguished road
danswano
if not ISRarExtract ( 0, 0, ExpandConstant('{src}\xxx.part01.rar'), ExpandConstant('{app}'), false, '') then break;
if not ShowChangeDiskWindow ('Пожалуйста, вставьте второй диск и дождитесь его инициализации.', ExpandConstant('{src}'),'xxx.part02.rar') then break;
if not ISRarExtract ( 0, 0, ExpandConstant('{src}\xxx.part02.rar'), ExpandConstant('{app}'), false, '') then break;
Reply With Quote
The Following User Says Thank You to vint56 For This Useful Post:
danswano (29-08-2017)
Reply


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
Unpack files with progress in batch gozarck Conversion Tutorials 3 29-06-2016 12:38
Lethis - Path of Progress 1xDVD5 CIUV2 pakrat2k2 PC Games - CD/DVD Conversions 0 25-10-2015 09:32
How to use IsArcextract without mentioning progress bar Alash Als Conversion Tutorials 0 30-09-2014 07:05
Inno Setup - Progress Bar, Help Needed silentnight512 PC Games - CD/DVD Conversions 4 28-12-2013 14:15
Progress bar for Tasks danswano PC Games - CD/DVD Conversions 22 09-03-2013 12:09



All times are GMT -7. The time now is 10:55.


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