I am using the latest version of powershell studio 2017 5.4.145. I am running on a windows 10 64-bit pc.
I used the following code below to filter a directory/share file path. I know this code works well enough for my needs. What
I discovered today with testing is if I type in a long path like the following below the error provider test code hangs the script when I get to the "."
e.g. \\bot\temp\bot-duplicates-report-which-does-not-including-any-filtering-options-whatsoever.txt
I removed the error provider and it works as expected. I use the code to put a message to the screen and it works great.
I would have liked to use the error provider. Unfortunately it hangs. I think this is a bug. I noticed another behavior just prior to failing the code slows down and then hangs. I realize with a long path the errorprovider will get called over 60 times with
the entry of each character.
$textboxFolderReport_TextChanged={
#TODO: Place custom script here
IF (($textbox1Report.text -match '^([a-zA-Z]+:)?(\\[a-zA-Z0-9_.-: :]+)*\\?$') -or ($textbox1Report.text -match '^\\(\\[\w-]+){1,}(\\[\w-()]+(\s[\w-()]+)*)+(\\(([\w-()]+(\s[\w-()]+)*)+\.[\w]+)?)?$') -or ($textbox1Report.Text -match "\\\\([a-zA-Z0-9])+(([\-_])?([a-zA-Z0-9])+)*(?:\\[\w\s$]+)+") -or ($textbox1Report.Text -EQ ""))
{
$errorprovider1Path.clear()
}
else
{
$errorprovider1Path.SetError($textbox1Report, "Invalid File Path")
}
}
Can anything be done here to remedy the situation?
thanks,
John
issue arose with the errorprovider
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.
- jsira2003@yahoo.com
- Posts: 117
- Last visit: Tue Jul 11, 2023 6:18 am
Re: issue arose with the errorprovider
Can you attach the psf file to this topic?
Also check that you are running the script in STA mode. Some controls are dependent on this setting to work.
Also check that you are running the script in STA mode. Some controls are dependent on this setting to work.
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
- jsira2003@yahoo.com
- Posts: 117
- Last visit: Tue Jul 11, 2023 6:18 am
Re: issue arose with the errorprovider
What is sta mode? Enclosed is the psf file.
thanks,
John
thanks,
John
- Attachments
-
- DupReport-with-Adj-Threshold.psf
- (983.54 KiB) Downloaded 105 times
Re: issue arose with the errorprovider
After debugging the script, I found that the regular expression is causing the lock up. You might consider using a different method to validate the path.
In regards to STA Mode:
https://www.sapien.com/blog/2015/03/09/ ... -sta-mode/
In regards to STA Mode:
https://www.sapien.com/blog/2015/03/09/ ... -sta-mode/
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
- jsira2003@yahoo.com
- Posts: 117
- Last visit: Tue Jul 11, 2023 6:18 am
Re: issue arose with the errorprovider
Since I didn't select sta or mta mode. It should have defaulted with sta mode. I suspect that wasn't my issue. I tried it both with and without the error provider. I only froze while using the error provider.
Thanks,
John
Thanks,
John
Re: issue arose with the errorprovider
Set a breakpoint on the line where the error provider is called and run the debugger (F5). If it freezes before that line, then it is the Regular Expression. If it freezes after Stepping (F10) then it is the ErrorProvider.
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
- jsira2003@yahoo.com
- Posts: 117
- Last visit: Tue Jul 11, 2023 6:18 am
Re: issue arose with the errorprovider
I elected to ditch the error provider. It is working fine now.
Thanks!
John
Thanks!
John