Supressing script error message

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
LittleBiG
Posts: 1846
Joined: 08 Apr 2011 12:57
Location: Win10x64

Supressing script error message

Post by LittleBiG »

I have a script file containing only paths. I use it as a menu, so I load it with the load command. When I choose a path from the appearing menu, which doesn't exist, I get an error message "Not found location or item" then the script also send me an error message "Path could not be accessed." Is it possible to supress the second one, the script error message somehow?

jupe
Posts: 2794
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Supressing script error message

Post by jupe »

Not that I know of, but this is a workaround if you are interested, it would make sure you'd only have paths that are available shown in the menu, so no chance of either error messages:

Code: Select all

	$script = "";
   foreach($path, readfile("<xyscripts>\paths.xys"), <crlf>) { 
      if (exists($path) == 2 || $path == "-") { $script .= $path . <crlf>; } }
	load $script,, "s";

LittleBiG
Posts: 1846
Joined: 08 Apr 2011 12:57
Location: Win10x64

Re: Supressing script error message

Post by LittleBiG »

Great idea, thank you!

Post Reply