STDOUT/STRERR to PROGRESSTEXT

Interested in developing new plug-ins? Got one to share? Post here!
mihai
Posts: 27
Joined: Fri Nov 29, 2013 3:53 am

STDOUT/STRERR to PROGRESSTEXT

Postby mihai » Thu Oct 08, 2020 5:45 am

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".

FrancescoT
Site Admin
Posts: 5047
Joined: Sun Aug 22, 2010 4:28 am

Re: STDOUT/STRERR to PROGRESSTEXT

Postby FrancescoT » Thu Oct 08, 2020 12:00 pm

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.
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

mihai
Posts: 27
Joined: Fri Nov 29, 2013 3:53 am

Re: STDOUT/STRERR to PROGRESSTEXT

Postby mihai » Thu Oct 08, 2020 12:08 pm

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?

FrancescoT
Site Admin
Posts: 5047
Joined: Sun Aug 22, 2010 4:28 am

Re: STDOUT/STRERR to PROGRESSTEXT

Postby FrancescoT » Thu Oct 08, 2020 1:26 pm

Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

mihai
Posts: 27
Joined: Fri Nov 29, 2013 3:53 am

Re: STDOUT/STRERR to PROGRESSTEXT

Postby mihai » Fri Oct 09, 2020 5:03 am

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.

FrancescoT
Site Admin
Posts: 5047
Joined: Sun Aug 22, 2010 4:28 am

Re: STDOUT/STRERR to PROGRESSTEXT

Postby FrancescoT » Fri Oct 09, 2020 1:10 pm

That's exactly the purpose of the LpPlugProgressIndicator.
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

mihai
Posts: 27
Joined: Fri Nov 29, 2013 3:53 am

Re: STDOUT/STRERR to PROGRESSTEXT

Postby mihai » Wed Oct 14, 2020 5:40 am

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.

FrancescoT
Site Admin
Posts: 5047
Joined: Sun Aug 22, 2010 4:28 am

Re: STDOUT/STRERR to PROGRESSTEXT

Postby FrancescoT » Wed Oct 14, 2020 11:20 am

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.
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

mihai
Posts: 27
Joined: Fri Nov 29, 2013 3:53 am

Re: STDOUT/STRERR to PROGRESSTEXT

Postby mihai » Wed Oct 14, 2020 11:41 am

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.

FrancescoT
Site Admin
Posts: 5047
Joined: Sun Aug 22, 2010 4:28 am

Re: STDOUT/STRERR to PROGRESSTEXT

Postby FrancescoT » Thu Oct 15, 2020 9:32 am

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.
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

mihai
Posts: 27
Joined: Fri Nov 29, 2013 3:53 am

Re: STDOUT/STRERR to PROGRESSTEXT

Postby mihai » Thu Oct 15, 2020 10:11 am

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!

FrancescoT
Site Admin
Posts: 5047
Joined: Sun Aug 22, 2010 4:28 am

Re: STDOUT/STRERR to PROGRESSTEXT

Postby FrancescoT » Fri Oct 16, 2020 6:38 am

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>
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

mihai
Posts: 27
Joined: Fri Nov 29, 2013 3:53 am

Re: STDOUT/STRERR to PROGRESSTEXT

Postby mihai » Fri Oct 16, 2020 6:51 am

Understood, thanks for the confirmation & suggestion. Thanks!


Return to “Plug-In Development”

Who is online

Users browsing this forum: No registered users and 2 guests