Trouble "building" EXE from PowerShell Script

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
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.
This topic is 7 years and 8 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
Tzadok85
Posts: 8
Last visit: Wed Sep 27, 2017 12:58 pm

Trouble "building" EXE from PowerShell Script

Post by Tzadok85 »

Product, version and build: PrimalScript 2016 // 7.2.92.0
32 or 64 bit version of product: x64
Operating system: Windows 10 Enterprise
32 or 64 bit OS: x64

Hello - I've written a script that runs perfectly on it's own - I'm attempting to use the "Build" feature within PrimalScript to convert it to an EXE.
This feature/app works just fine on other scripts I've written on this same system.

When building, I get 0 warnings & 0 errors - it produces the EXE just fine.

When I build using the "SAPIEN PowerShell V5 Host (Windows) x64" Engine, it results in a number of "odd popups" & errors that continue until I "End Task" on the EXE... (see screenshots)
04.png
04.png (2.98 KiB) Viewed 4482 times
05.png
05.png (2.96 KiB) Viewed 4482 times
06.png
06.png (2.59 KiB) Viewed 4482 times
Additionally, if I building using another engine type (e.g. a the "Command Line" variant of the same V5 engine), it can result in a powershell window that shows some variant of the following text:

./3506EFD6.PS1 : The term './3506EFD6.PS1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1


Hopefully this is enough info to provide some insight...
Thanks much!
DevinL
Posts: 1098
Last visit: Tue Jun 06, 2017 9:15 am

Re: Trouble "building" EXE from PowerShell Script

Post by DevinL »

Would you mind uploading the script that you attempted to package into an executable?

If you don't wish for it to be public you can upload it to https://sapien.com/support/upload and we can take a look at the cause of this.
DevinL
SAPIEN Technologies, Inc.
User avatar
Alexander Riedel
Posts: 8488
Last visit: Tue Apr 16, 2024 8:42 am
Answers: 20
Been upvoted: 37 times

Re: Trouble "building" EXE from PowerShell Script

Post by Alexander Riedel »

Looks like the powershell engine cannot understand the encoding of your script file.
Check in PrimalScript what the encoding of your file is. You can see that at the status bar.
Powershell cannot comprehend a few common encoding types even if a BOM (Byte Order Mark) is present.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
Tzadok85
Posts: 8
Last visit: Wed Sep 27, 2017 12:58 pm

Re: Trouble "building" EXE from PowerShell Script

Post by Tzadok85 »

Thanks! Sorry for my delayed response - assumed I would receive a notification of any posts/replies...

I just uploaded two PS1 files that net similar results (via the URL you provided).
User avatar
Tzadok85
Posts: 8
Last visit: Wed Sep 27, 2017 12:58 pm

Re: Trouble "building" EXE from PowerShell Script

Post by Tzadok85 »

For what it's worth - based on what PrimalScript shows:

The original file that I posed about was "ASCII"
The second example (included in the upload) is "UNICODE LE"...

Thanks!
User avatar
Alexander Riedel
Posts: 8488
Last visit: Tue Apr 16, 2024 8:42 am
Answers: 20
Been upvoted: 37 times

Re: Trouble "building" EXE from PowerShell Script

Post by Alexander Riedel »

Unfortunately I cannot not run your code here, for obvious reasons. I will try to make some generic samples.
I see nothing unusual in these files though (other than using a WScript popup :D )
Can you post what actual packager settings you use on those files and what the issue is on the second file?
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
Tzadok85
Posts: 8
Last visit: Wed Sep 27, 2017 12:58 pm

Re: Trouble "building" EXE from PowerShell Script

Post by Tzadok85 »

Yeah, absolutely. Here are the build settings:
Build Settings.jpg
Build Settings.jpg (243.32 KiB) Viewed 4436 times
additionally, I have a few more screenshots that show the results of a few different engine types (for the second file):
01 - File 2 - Sapien PS V5 Host (Command Line) x64.jpg
01 - File 2 - Sapien PS V5 Host (Command Line) x64.jpg (35.52 KiB) Viewed 4433 times
03 - Windows PS (Command Line) x64.jpg
03 - Windows PS (Command Line) x64.jpg (29.07 KiB) Viewed 4431 times
User avatar
Tzadok85
Posts: 8
Last visit: Wed Sep 27, 2017 12:58 pm

Re: Trouble "building" EXE from PowerShell Script

Post by Tzadok85 »

04 - Windows PS (Command Line) Native.jpg
04 - Windows PS (Command Line) Native.jpg (46.46 KiB) Viewed 4430 times
User avatar
Alexander Riedel
Posts: 8488
Last visit: Tue Apr 16, 2024 8:42 am
Answers: 20
Been upvoted: 37 times

Re: Trouble "building" EXE from PowerShell Script

Post by Alexander Riedel »

Make your extension .ps1 instead of .PS1 and see if that helps.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
Tzadok85
Posts: 8
Last visit: Wed Sep 27, 2017 12:58 pm

Re: Trouble "building" EXE from PowerShell Script

Post by Tzadok85 »

Innnnnnteresting! so far, this corrected the issue(s) with the second one. I'm assuming (based on these results) that it will likely correct the initial issue too! Well played!

Any idea why this may be?

Thanks a million!
This topic is 7 years and 8 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.