Re: Scripting Bugs
Posted: 17 Jul 2013 08:05
I could only repro it with radical heredocs. Fixed (toughy).
Forum for XYplorer Users and Developers
https://www.xyplorer.com/xyfc/
Code: Select all
"A story of two literals..."
if ('a' != 'b') {
echo 'They are different...';
}
if ('a' == 'b') {
echo '... but they are the same.';
}
if ('a' != 'b' && 'a' == 'b') {
echo 'Maybe they are differently the same?';
}
if ('a' UnLike 'b') {
echo 'They hate each other...';
}
if ('a' Like 'b') {
echo '... but they like each other.';
}
if ('a' UnLike 'b' && 'a' Like 'b') {
echo 'Guess love breaks mathematical laws?';
}
Now that I think about it I'm not sure I ever got back to whatever it was I was attempting...admin wrote:Don't know about the wildcards... does it? Probably not...
Code: Select all
XYplorer.exe /script="::SaveSettings;" /flg=2And an Error dialog pops up:The current script appears to be recursive.
The stack size is 0.
5) Close the error dialog.Error: 400 (0x00000190)
Desc: Form already displayed; can't show modally
Dll: 0
Proc: script_Process
Source: XYplorer
XY ver: XYplorer 13.60.0010
OS: Windows 7 Professional (Service Pack 1), 64-bit
Locale: 1033
ANSI: 1252
ACP: 1252 (ANSI - Latin I)
DBCS: No
DPI: 96 (100%)
Date: 1/15/2014 7:51:22 AM
This will appear with every attempt to run any script until XY is restarted.Error: 9 (0x00000009)
Desc: Subscript out of range
Dll: 0
Proc: script_Process
Source: XYplorer
XY ver: XYplorer 13.60.0010
OS: Windows 7 Professional (Service Pack 1), 64-bit
Locale: 1033
ANSI: 1252
ACP: 1252 (ANSI - Latin I)
DBCS: No
DPI: 96 (100%)
Date: 1/15/2014 7:53:35 AM
Code: Select all
echo round(172.7368, 0); //173Code: Select all
echo 1+0.986328125 // displays 1,986328125 (correct, but again with comma)
echo 1+0,986328125 // displays 1 (XYplorer ignores 0,986328125)
echo 1+(0,986328125) // the only possible way to overcome this error
I don't understand this statement at all.admin wrote:This is such bad manners that I could not test it for ethic reasons.
Bad news... no difference noticed with v13.60.0013, even the error messages are the same.admin wrote:But I attempted an air-fix. Check next beta...
Hm, weird!TheQwerty wrote:I don't understand this statement at all.admin wrote:This is such bad manners that I could not test it for ethic reasons.![]()
Bad news... no difference noticed with v13.60.0013, even the error messages are the same.admin wrote:But I attempted an air-fix. Check next beta...
Indeed, a bug. Thanks lot! Fix comes.medder wrote:1) The behavior of the function ROUND() has changed.
Not a bug, but a change of behavior. Since v13.30.0008 - 2013-11-18 12:13 the returns of mathematical operations are in locale aware format. If your locale uses comma as decimal separator XY will use it too. But only in strings. Now all return values in XY's scripting are to be seen as strings. XY's script language is not really typed and the only place where there is an implicit difference in types is when you use number quoted (as numeric strings) or not quoted (as numbers).medder wrote:2) Talking about decimal point: XYplorer now uses the comma symbol instead of the period.
Code: Select all
v13.30.0008 - 2013-11-18 12:13
+ Scripting | Math Operations: Now, in German Windows, you can enter
fractional constants in international format (decimal separator =
dot) by leaving them unquoted. This is obviously the preferred way
to go now for locale-independent scripts.
Examples that now work in any Windows:
echo 17.5 * 2; //35
echo -17.5 * 2; //-35
echo 17.5 + 17.5; //35
echo format(17.5); //17,5
echo format(17.5, "00.00"); //17,50
Note: This only works in German Windows as "17,5" is no number in
English Windows:
echo format("17,5", "00.00"); //17,50
Note: Entering a fraction with dot in German Windows will not work
as "17.5" is no number in German Windows:
echo "17.5" * 2; //0
Note: Do not enter the German decimal separator unquoted:
echo format(17,5 , "00.00"); //5 (totally invalid syntax)
Note: Here format() sees the dot as German thousand separator and
simply ignores it when determining the value of the number:
echo format("17.5"); //175
echo format("17.5", "00.00"); //175,00
- Scripting | Math Operations: Removed the change in v13.30.0007.
Now you can do any of the following in German Windows:
$n = "17,5"; echo $n; //17,5
$n = 17.5; echo $n; //17,5
This will NOT work as expected since you must not enter German
decimal separator unquoted:
$n = 17,5; echo $n; //17!Well, frankly I think the current way is the correct one. "1010 some text" is not a number, and a non-number is auto-converted to 0 (zero) when it is found in a mathematical operation.medder wrote:3) XYplorer is unable to treat strings with numbers as numbers.
In earlier versions: "1010 some text"/1024 would return 0.986328125
In current version "1010 some text"/1024 returns 0.
It works, but I think it would probably be preferable, at least safer, to just ignore the attempts made while the stepping dialog is visible, rather than running them while a previous script is stepping.admin wrote:PS: Well, I tried one more air-fix...
To defend myself... I have a batch file which runs XY with a SaveSettings script periodically, and I'd occasionally come back to find those errors because I had forgotten to disable stepping after doing something else.admin wrote:the main cause is user error
I had thought about this, and decided that stepping is rather a debugging tool than a safety net, so I decided to let them run unhindered.TheQwerty wrote:It works, but I think it would probably be preferable, at least safer, to just ignore the attempts made while the stepping dialog is visible, rather than running them while a previous script is stepping.admin wrote:PS: Well, I tried one more air-fix...
That's fair reasoning... I concur.admin wrote:I had thought about this, and decided that stepping is rather a debugging tool than a safety net, so I decided to let them run unhindered.TheQwerty wrote:It works, but I think it would probably be preferable, at least safer, to just ignore the attempts made while the stepping dialog is visible, rather than running them while a previous script is stepping.admin wrote:PS: Well, I tried one more air-fix...
Code: Select all
"It's All Unicode"
$tests = 'abc|€|';
$results = '';
foreach ($test, $tests, '|') {
$verdict = IsUnicode($test) ? 'is' : 'is not';
$results = $results . "'$test' $verdict unicode.<crlf>";
}
Text $results;For once I'm going to argue that we should break compatibility with old versions and correct this so that IsUnicode returns 1 or 0.return: True (1) if wide characters are present in string, else False (0).