Hi,
I'm having trouble debugging these 3 lines of code as I do not get any errors, it just hangs. It is a custom written DLL.
This connects to another computer "A10" and sets some variables in an application on that system.
When I have this code in a ps1 file I get it to run successfully.
Add-Type -path "C:\ECM\Exams_ExamCenterManager\CFSocketConnection.dll"
$connected = [CFSocketConnection.ExamConnection]::GetConnection("A10").Result
$connected.setexamtime(30)
But the below does not work. Please let me know if I need to supply anything else.
$form1_Load={
Add-Type -path "C:\ECM\Exams_ExamCenterManager\CFSocketConnection.dll"
$connected = [CFSocketConnection.ExamConnection]::GetConnection("A10").Result
$connected.setexamtime(30)
}
The second line is where it hangs. ($connected = [CFSocketConnection.ExamConnection]::GetConnection("A10").Result)
PowerShell Studio 2017 v5.4.145
64 bit
Windows 10 64 bit
STA mode
Elevated Mode
script works in ps1 but in psf
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.
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
Re: script works in ps1 but in psf
Sounds like a network timeout. You probably need to make a firewall exception.
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: script works in ps1 but in psf
Thank you for the reply. It works if I run it as a ps1 so I don't think it is a firewall issue. However I disabled both firewalls and I still have the same result.
I have also tried localhost with the same results. Works in ps1 script but not on form.
I have also tried localhost with the same results. Works in ps1 script but not on form.
Re: script works in ps1 but in psf
This could have to do with the way the command works internally. Since the GUI is holding up the pipeline, it is possible that some events aren't triggered that the command relies on.
Try running the command via a Job using the Button - Start Job control set and see if that works for you.
https://info.sapien.com/index.php/guis/ ... sive-forms
Try running the command via a Job using the Button - Start Job control set and see if that works for you.
https://info.sapien.com/index.php/guis/ ... sive-forms
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.