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

Use PwerShell script to modify property and display in window

Mon Dec 11, 2023 8:24 am

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.34KiB)Downloaded 171 times

Liviu
Posts: 1026
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

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

Thu Dec 14, 2023 3:45 pm

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.95KiB)Viewed 9596 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.77KiB)Viewed 9596 times

Hope this helps!

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

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

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

Mon Dec 18, 2023 7:55 am

Hi AI Team,

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

Thanks,
Andrew

Liviu
Posts: 1026
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

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

Tue Dec 19, 2023 8:55 am

You're always welcome, Andrew!

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

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

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

Wed Dec 20, 2023 10:12 am

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.01KiB)Downloaded 148 times

Liviu
Posts: 1026
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

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

Thu Dec 21, 2023 9:36 am

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.73KiB)Viewed 8181 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: 23
Joined: Tue Mar 02, 2021 10:15 am

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

Thu Dec 21, 2023 2:55 pm

Hi Liviu,

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

Thanks,
Andrew

Liviu
Posts: 1026
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

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

Thu Dec 21, 2023 3:33 pm

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”