- + Scripting got a new command:
- Assert
Action: Interrupt processing on certain conditions.
Syntax: assert condition, [message], [continue=0]
condition: [required] any expression that evaluates
to True or False
message: [optional] message that's displayed if
condition evaluates to False
continue: [optional] set to 1 to allow continuing the
script after displaying the message; else the "Continue"
button is disabled; default is 0
Usage: This is mainly a debugging feature to interrupt
processing on certain conditions. If the condition evaluates
to True the program flow is not interrupted, otherwise you are
notified and can investigate what went wrong and decide
whether to continue and cancel (if continue=1). So, "assert"
can be very useful to keep your scripts under some control.
Apart from debugging you may use it to check (continue=1) or
enforce (continue=0) critical preconditions for your scripts
to run successfully.
Examples:
::$a="A"; assert $a=="A", '$a has wrong value!'
= no message (condition is True)
::$a="A"; assert $a=="B", '$a has wrong value!', 1
= message (condition is False)
::$a="A"; assert $a=="B", '$a has wrong value!', 0
= message (condition is False) and no option to continue
::getinfo $count, "CountSelected";
assert $count!=0,
"You must select a file before running this script!"
= if no files are selected: message - * Scripting | Step dialog: Improved coloring in the bottom list to better distinguish spaces from nothing. Also made it wider.
- ! SC "download" needed extra refresh to actually display the downloaded file if the target folder was the current one. Done.
- ! Scripting, ternary conditional: The following examples were not parsed correctly for various reasons:
::msg "Good "."12" <=<date>? "afternoon": "morning"."!";
::?regexreplace $name, "some name [ETA: 12-2008]",
"^(.+?) \[ETA: .+$", "$1";
Fixed.
Sunday, September 14, 2008
v7.60.0008 - 2008-09-14 21:28
Entry Type: Beta Update Posted by XYplorer user : J_C_Hallgren at 3:30 PM