not getting output from msgbox

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 SUBSCRIPTION NUMBERS, LICENSE 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.
User avatar
Olga_B
Site Admin
Posts: 126
Joined: Mon May 15, 2017 9:06 am

Re: not getting output from msgbox

Post by Olga_B » Tue Jul 16, 2019 10:09 am

The 'Microsoft.PowerShell.Core' in Get-Location is expected PowerShell behavior

Check this:

https://community.idera.com/database-to ... hell-paths

Also, If you can, please zip and load up the original psf file, so that we can attempt to recreate the issue using your file:

https://www.sapien.com/support/upload

User avatar
ocsscott
Posts: 47
Joined: Thu Dec 17, 2015 7:24 am

Re: not getting output from msgbox

Post by ocsscott » Tue Jul 16, 2019 10:43 am

im about to upload uncomment line 53-65 to see the behavior the first sections for $a and $b

the code for $C is working but previously the $a code was what you suggested I use.

thanks

User avatar
brittneyr
Site Admin
Posts: 234
Joined: Thu Jun 01, 2017 7:20 am

Re: not getting output from msgbox

Post by brittneyr » Tue Jul 16, 2019 11:40 am

We have been able to reproduce the problem you are having with getting values from PSScriptRoot and PSCommmandPath not returning anything when packaged. The issue has been sent to the proper place for evaluation and correction. When a fix is issued with a service build, it will be listed in the change log.

We apologize for any inconvenience.
Brittney Ryn
SAPIEN Technologies, Inc.

User avatar
Alexander Riedel
Posts: 7120
Joined: Tue May 29, 2007 4:43 pm

Re: not getting output from msgbox

Post by Alexander Riedel » Tue Jul 16, 2019 4:12 pm

$PSScriptRoot and $PSCommandPath are filled where possible as a convenience to users. You must keep in mind though that packaged code does not run as a script.
It is executed as code in a custom host. So there are some differences to keep in mind and PowerShell is likely getting confused as to the scope of these variables.
Which is why they show up empty rather than producing an error.

Please refer to: https://www.sapien.com/blog/2009/09/02/ ... nvocation/

The proper way to reliably determine the path of a script and likewise that of the underlying executable executable in a script package is as follows:

function get-scriptdirectory{
if($hostinvocation -ne $null) {
Split-Path $hostinvocation.MyCommand.path
}
else {
$invocation=(get-variable MyInvocation -Scope 1).Value
Split-Path $invocation.myinvocation.path
}
}

Calling this function will return the correct path whether the code is run as a script file or if it is packaged as an executable file.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
ocsscott
Posts: 47
Joined: Thu Dec 17, 2015 7:24 am

Re: not getting output from msgbox

Post by ocsscott » Wed Jul 17, 2019 8:06 am

Thanks for the code and explanation of the issue