Page 1 of 2

STDOUT/STRERR to PROGRESSTEXT

Posted: Thu Oct 08, 2020 5:45 am
by mihai
Hi,

Is there a way to capture the messages to STDOUT/STRERR and display them to the user, via PROGRESSTEXT? I'm talking about a very long running operation, that displays its progress in the console.

Thanks,
Mihai

PS: I'm talking about the raw output that some installers display when you press "Show Details".

Re: STDOUT/STRERR to PROGRESSTEXT

Posted: Thu Oct 08, 2020 12:00 pm
by FrancescoT
Unfortunately there isn't a built-in method capable to redirect the console output.
However, it's surely possible to release a custom plug-in at such purpose.

Re: STDOUT/STRERR to PROGRESSTEXT

Posted: Thu Oct 08, 2020 12:08 pm
by mihai
Unfortunately there isn't a built-in method capable to redirect the console output.

Understood.

However, it's surely possible to release a custom plug-in at such purpose.

What exactly does that entail?

Re: STDOUT/STRERR to PROGRESSTEXT

Posted: Thu Oct 08, 2020 1:26 pm
by FrancescoT

Re: STDOUT/STRERR to PROGRESSTEXT

Posted: Fri Oct 09, 2020 5:03 am
by mihai
So say a plugin that executes the given command through _popen/CreateProcess?

If that's the case, how do I periodically update the PROGRESSTEXT variable? Is that what the 2nd parameter of the lpPlugProgressIndicator is for? The documentation is unclear, although I guess I could just try it out and see what happens:
This parameter should contain a textual description of the currently executing task.

PS: That's what it does, I just tested.

Re: STDOUT/STRERR to PROGRESSTEXT

Posted: Fri Oct 09, 2020 1:10 pm
by FrancescoT
That's exactly the purpose of the LpPlugProgressIndicator.

Re: STDOUT/STRERR to PROGRESSTEXT

Posted: Wed Oct 14, 2020 5:40 am
by mihai
Thanks for the confirmation and the guidance so far.

However, if I read back the PROGRESSTEXT variable after lpPlugProgressIndicatorW has updated the text in the UI, the value of the variable is still the one set previously through MSI Code. What's going on? I need a way to get the actual value in the UI.

Re: STDOUT/STRERR to PROGRESSTEXT

Posted: Wed Oct 14, 2020 11:20 am
by FrancescoT
Please keep in mind that "PlugInProgressIndicator" points to the address of a callback function.
So, this callback should be defined as follow in your code:

Code: Select all

typedef BOOL(WINAPI* lpPlugProgressIndicatorW)(int, const WCHAR*);

Then from the plugin process, for example:

Code: Select all

int WINAPI RunTimeExecuteW(int Window, const wchar* Variables, const wchar* State, lpPlugProgressIndicatorW Progress, int* Return, wchar* NewVariables);
{
   /******************/
   std::wstring sMyString(_T("Hello..."));
   BOOL bUserCancelled = Progress(50, sMyString.c_str());
   /*****************/
}

Finally, in your script code you can test the progress as follow:

Code: Select all

Display Dialog: progress, use as progress dialog (non-modal)
MyPlugin
Hide Dialog

(*)The "Progress Dialog" will receive the plugin progress notifications.

Hope this helps you.

Re: STDOUT/STRERR to PROGRESSTEXT

Posted: Wed Oct 14, 2020 11:41 am
by mihai
Thanks for the reply. But how can it be an error in the plugin if I can see the text it sends through the callback? Please re-read what I wrote previously.

To reiterate, the text makes it just fine from the plugin into the progress text control, but if I then want to show a dialog using MSI Code to contain the $PROGRESSTEXT$, it shows the value before the plugin used the callback.

In other words, does the plugin callback only update the UI, but not the PROGRESSTEXT variable?

PS: I see you have edited your previous message making some of what I replied here appear out of context.

Re: STDOUT/STRERR to PROGRESSTEXT

Posted: Thu Oct 15, 2020 9:32 am
by FrancescoT
No, the "PlugInProgressIndicator" callback doesn't set the value of the PROGRESSTEXT pre-defined variable.
In all honesty, I don't understand the reason why you need to set such variable. It's just enough to use a modeless dialog to display all notifications the plugin routes through the callback.

At any rate, from the plugin there is no limitation to set the value of any script variable (including PROGRESSTEXT).
The "RunTimeExecute" has a "wchar* NewVariables" parameter specifacally for that.

Hope this helps you.

Re: STDOUT/STRERR to PROGRESSTEXT

Posted: Thu Oct 15, 2020 10:11 am
by mihai
In all honesty, I don't understand the reason why you need to set such variable.

One might want to parse the very last console line - that's already on screen - to extract additional details on the execution outcome.

At any rate, from the plugin there is no limitation to set the value of any script variable (including PROGRESSTEXT).

Ah, right. I actually did that for another variable.

OK then, one last question please, to come back to the original "Show Details" idea: is there a way to access the history of the progress text control? In other words, I'd like to display a listbox or a multi-line static text control with everything that was / is displayed there. As is now clear from your last confirmation, this would be a combination of the values of %PROGRESSTEXT$ and the texts that come from the plugin callbacks. Please keep in mind that for the lengthy duration of the plugin execution I'd like to see the multi-line control update dynamically, just as the progress text control is.

Thanks!

Re: STDOUT/STRERR to PROGRESSTEXT

Posted: Fri Oct 16, 2020 6:38 am
by FrancescoT
No, it doesn't exist a method to access the history of the progress text control.

If you want such kind of customization, the only solution it's to implement a Customized Progress Dialog with the plugin itself. So, in place of displaying the IA Progress Dialog, your plugin should display its own progress.

Hope this helps you.

<THIS POST HAS BEEN MOVED TO THE MORE APPROPRIATE "Plug-In Development" section of the forum>
<THIS POST WILL BE SUCCESSIVELY REMOVED from the "Technical Support" section of the forum>

Re: STDOUT/STRERR to PROGRESSTEXT

Posted: Fri Oct 16, 2020 6:51 am
by mihai
Understood, thanks for the confirmation & suggestion. Thanks!

Re: STDOUT/STRERR to PROGRESSTEXT

Posted: Mon Nov 09, 2020 12:39 pm
by FrancescoT
Btw, you can even try with implementing a multi-line progress text, which displays the content of a dedicated "console" custom variable using the $NEWLINE$ variable to split each new line.

For example;
<TEXT1>$NEWLINE$<TEXT2>$NEWLINE$<TEXT3>$NEWLINE$ ...and so on.

Re: STDOUT/STRERR to PROGRESSTEXT

Posted: Tue Nov 10, 2020 10:44 am
by mihai
Thanks for the suggestion. What exactly do you mean by 'a dedicated "console" custom variable'? If I recall correctly, the normal variables only update when the execution of the command completes. Or would it involve developing a UI control that would monitor variables for hot changes?