mli04
Posts: 25
Joined: Tue Mar 02, 2021 10:15 am

Use PwerShell script to modify property and display in window

Hi AI Team,

I want to save a file via a save file dialog in a PowerShell script, and then I want the full path to the file set by the user to be displayed in the window after saving.
Clicking the [Next] button in the "WelcomeDlg" window will execute the custom Action written in PowerShell. This Action will store some data in the file specified by the user and store the file path in the attribute TEXT_1_PROP. There is a text Text_1 associated with this property in the "FolderDlg" window.
After executing the PowerShell script, the text in the "FolderDlg" window is not updated, can you help me find the reason?
Please find my project files in the attachment.

Thanks,
Andrew
Attachments
RomanSampleProject - SaveFileDlg.aip
(15.34 KiB) Downloaded 286 times
Liviu
Posts: 1048
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: Use PwerShell script to modify property and display in window

Hello Andrew,

The property is actually updated, but the displayed text is not modified.

You need to add the [TEXT_1_PROP] value on the Text field under the Display option:
property update.png
property update.png (104.95 KiB) Viewed 13429 times

You can either update this or add an EditBox control/MessageBox from within the script to display the value.
messagebox PS.png
messagebox PS.png (13.77 KiB) Viewed 13429 times

Hope this helps!

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mli04
Posts: 25
Joined: Tue Mar 02, 2021 10:15 am

Re: Use PwerShell script to modify property and display in window

Hi AI Team,

Thank you for helping me find the cause of the problem.

Thanks,
Andrew
Liviu
Posts: 1048
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: Use PwerShell script to modify property and display in window

You're always welcome, Andrew!

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mli04
Posts: 25
Joined: Tue Mar 02, 2021 10:15 am

Re: Use PwerShell script to modify property and display in window

Hi Liviu,

I encountered another problem and hope to get your help.
Update properties in the current window, but the window is not refreshed.
Problem Description:
There is a text box in the window, and the associated attribute is EDIT_1_PROP. Click the [Select...] button in the current window to execute the PowerShell script and update the attribute EDIT_1_PROP value in the PowerShell script. After the script is executed, the content of the text box in the window is not updated.

To reproduce the problem, please refer to the attached project file SaveFileDlg.aip.

Thanks,
Andrew
Attachments
SaveFileDlg.aip
(16.01 KiB) Downloaded 198 times
Liviu
Posts: 1048
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: Use PwerShell script to modify property and display in window

Hello Andrew,

In order to initiate a refresh on a dialog, you only need to trigger the Refresh the current dialog published event after your property has been updated. Each time the Refresh the current dialog event is triggered, the user interface refreshes.
refresh.png
refresh.png (65.73 KiB) Viewed 12014 times

Threfore, please add this event after your script on the Published Events of your [Select...] button.

Hope this helps!

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mli04
Posts: 25
Joined: Tue Mar 02, 2021 10:15 am

Re: Use PwerShell script to modify property and display in window

Hi Liviu,

Thank you for your help. I made a perfect installer.

Thanks,
Andrew
Liviu
Posts: 1048
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: Use PwerShell script to modify property and display in window

You're always welcome, Andrew!

I'm happy to know that everything is now running smoothly.

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”