Hello everybody,
I have received a script for my self-made tool from my colleagues and would like to incorporate it. Unfortunately I do not know how I can execute a script with a push of a button. The script as seen the attachments should be included in the project.
To open other forms i can use: Show-Exchange_psf
So my question is: How can i start a script in my project?
Best regards
Start ps1-Script in a form
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Start ps1-Script in a form
It depends on the settings of the files in the project. To check the Build property, first select the file in the Project panel and then look the settings in the Properties panel:
If the ps1 Build property is set to Include and Shared = False, then you will need to use the Invoke reference function method:
If Build = Include and Shared = True, then the file is merged into the script and doesn't need to be invoked.
If the file's Build property is set to Content, then you will have to dot source the file normally:
The following article covers how to pass and return values in GUI and projects:
https://info.sapien.com/index.php/guis/ ... sing-forms
Note: The verbs have changes since this article was written from Call to Invoke and Show.
If the ps1 Build property is set to Include and Shared = False, then you will need to use the Invoke reference function method:
Code: Select all
Invoke-FileName_ps1
If Build = Include and Shared = True, then the file is merged into the script and doesn't need to be invoked.
If the file's Build property is set to Content, then you will have to dot source the file normally:
Code: Select all
. .\Filename.ps1
The following article covers how to pass and return values in GUI and projects:
https://info.sapien.com/index.php/guis/ ... sing-forms
Note: The verbs have changes since this article was written from Call to Invoke and Show.
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.