Hello,
Sapien Studio 2017: 5.4.145 running on Windows 7 Pro SP1 Retail x64.
I am working on a PowerShell GUI portable app. Most of the scripts were created under MainFunctions.ps1 and I import them before a specific usage scenario. I have some scripts that were *.vbs and converted them to *.exe. I want the PowerShell GUI to be portable with elevated manifest - here ok so the customer for example copies the GUI app to a folder with writable permissions and so forth -- all fine here. I understood that the packager does not support embedding other executables and unpacking them at runtime, because type of behavior is often flagged as virus behavior and frowned upon by Microsoft. Microsoft’s prescribed method is to use *.MSI installers.
Let's say I will provide the customer 2x files *.exe - signed etc.. one will be the GUI app and the *.VBS -> *.EXE that can be run when clicking on a button.
What I need as a suggestion is how to execute / run the *.exe file from a current dir when a button within the GUI app is clicked?
I found this but as far I know and understand this works for scripts only.
viewtopic.php?t=10327
call external *.exe on click within GUI app
Forum rules
Do not post any licensing information in this forum.
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 any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: call external *.exe on click within GUI app
PowerShell studio can generate MSI installers and deploy extra files.
To run an EXE in PowerShell just state the name of the EXE.
c:\folder\myapp.exe
This will execute the exe.
Note that PowerSHell can directly execute VBS files. Those files can be stored inside of PS as a text block.
$vbscript = @'
... vbs code here
...
@'
This can be executed with the VBS COM object as a string.
To run an EXE in PowerShell just state the name of the EXE.
c:\folder\myapp.exe
This will execute the exe.
Note that PowerSHell can directly execute VBS files. Those files can be stored inside of PS as a text block.
$vbscript = @'
... vbs code here
...
@'
This can be executed with the VBS COM object as a string.
Re: call external *.exe on click within GUI app
Can you jvierra point me to both options with more detailed examples for both options?
Thank you in advance for the quick feedback reply on this matter.
Thank you in advance for the quick feedback reply on this matter.
Re: call external *.exe on click within GUI app
Here is an old Sapien blog post on how to run VBScript in PowerShell:
https://www.sapien.com/blog/2009/09/15/ ... powershell
link to examples: Download Invoke-ActiveScript wrapper and demos
https://www.sapien.com/blog/2009/09/15/ ... powershell
link to examples: Download Invoke-ActiveScript wrapper and demos
Re: call external *.exe on click within GUI app
Hello,
First of all thanks for both options. Having in mind these:
https://www.sapien.com/blog/2009/09/15/ ... owershell/
Link to examples: Download Invoke-ActiveScript wrapper and demos
I will build the *.exe options for both x64 and x86 as in the example above I need to have the *.vbs option to rebuild the prerequisite option with the Functions etc. in order to meet it. .I thought there is an easy option to "run" it $vbs = @' vbs code '@ and not to rewrite all the *.vbs like it is described in the article.
Anyways..
Is there are best practice example to include within the click action to wait until the *.exe application is finished and go to the next action ?
Is this a good option what I want to accomplish:
$StartApplication = "Path_to\exe\aplication.exe"
Start-Process -FilePath $StartApplication -wait
Wait-Job $StartApplication
[void][System.Windows.Forms.MessageBox]::Show("The application $StartApplication is being executed", 'Please wait the completion of the application')
.. next action..
I would like to show a msgbox that will notify the user that the application will run and then the next steps will be proceeded . Currently the *.exe runs on the test machine for 1 min and 30 seconds upon completion. How to accomplish this?
Thanks
First of all thanks for both options. Having in mind these:
https://www.sapien.com/blog/2009/09/15/ ... owershell/
Link to examples: Download Invoke-ActiveScript wrapper and demos
I will build the *.exe options for both x64 and x86 as in the example above I need to have the *.vbs option to rebuild the prerequisite option with the Functions etc. in order to meet it. .I thought there is an easy option to "run" it $vbs = @' vbs code '@ and not to rewrite all the *.vbs like it is described in the article.
Anyways..
Is there are best practice example to include within the click action to wait until the *.exe application is finished and go to the next action ?
Is this a good option what I want to accomplish:
$StartApplication = "Path_to\exe\aplication.exe"
Start-Process -FilePath $StartApplication -wait
Wait-Job $StartApplication
[void][System.Windows.Forms.MessageBox]::Show("The application $StartApplication is being executed", 'Please wait the completion of the application')
.. next action..
I would like to show a msgbox that will notify the user that the application will run and then the next steps will be proceeded . Currently the *.exe runs on the test machine for 1 min and 30 seconds upon completion. How to accomplish this?
Thanks
Re: call external *.exe on click within GUI app
You are asking for us to design your form for you. That is your responsibility. To design a form you must be proficient in both PowerSHel and Windows Forms.
Here is a good resource to get you started: Learn PowerShell
Also this is a very good tutorial and reference: https://www.sapien.com/books_training/W ... werShell-4
Re: call external *.exe on click within GUI app
Hello and thanks for the suggestions.
I will build the *.exe options for both x64 and x86 as in the example above I need to have the *.vbs option to rebuild the prerequisite option with the Functions etc. in order to meet it. .I thought there is an easy option to "run" it $vbs = @' vbs code '@ and not to rewrite all the *.vbs like it is described in the article.
Thanks for the help.
I was more looking for a "best practice" one but found some other suggestions here within the forum .I would like to show a msgbox that will notify the user that the application will run and then the next steps will be proceeded . Currently the *.exe runs on the test machine for 1 min and 30 seconds upon completion. How to accomplish this?
I will build the *.exe options for both x64 and x86 as in the example above I need to have the *.vbs option to rebuild the prerequisite option with the Functions etc. in order to meet it. .I thought there is an easy option to "run" it $vbs = @' vbs code '@ and not to rewrite all the *.vbs like it is described in the article.
Thanks for the help.