Page 15 of 41
Re: Scripting Bugs
Posted: 11 Aug 2010 21:02
by zer0
admin wrote:Without any testing I would say simply append the delimiter manually if you really need it at the end:
Code: Select all
$filelist = getinfo('SelectedItemsPathNames', '|') . '|';
Yep, that works, thanks!
P.S. Would be nice for XY to identify such pitfalls and alert the user

Re: Scripting Bugs
Posted: 11 Aug 2010 21:02
by admin
zer0 wrote:admin wrote:Without any testing I would say simply append the delimiter manually if you really need it at the end:
Code: Select all
$filelist = getinfo('SelectedItemsPathNames', '|') . '|';
Yep, that works, thanks!
P.S. Would be nice for XY to identify such pitfalls and alert the user

XY != God.
Re: Scripting Bugs
Posted: 11 Aug 2010 21:40
by TheQwerty
Just a suggestion: You'd probably be better off using GetToken() instead of substr and strpos.
Re: Scripting Bugs
Posted: 11 Aug 2010 23:43
by zer0
admin wrote:XY != God.
Agreed. But not all people who use scripts are experts at scripting. I was able to narrow down the cause to a particular change of a specific beta release. Proactive action is not only smart, but also saves time which is in my case means money.
Re: Scripting Bugs
Posted: 18 Aug 2010 22:39
by PeterH
zer0 wrote:admin wrote:XY != God.
Agreed. But not all people who use scripts are experts at scripting. I was able to narrow down the cause to a particular change of a specific beta release. Proactive action is not only smart, but also saves time which is in my case means money.
You're a kind of right here...
...but what would you expect? Don could have added:
Code: Select all
If your script depends on the now deleted trailing delimiter, you have to change it accordingly
I think most people would say: of course you must!
He also could have added:
Code: Select all
If you wrongly misused the token separators including the last one as a kind of end-of-token-identifiers, you either have to add a separator to the end of the string, or change the logic to interpret the string as character-separated tokens.
For this version he would be in need of some God-like skills, I think..
So I'm afraid that such situations could only be avoided, if Don would never change anything regarding scripting. And I think we would not like that...
Re: Scripting Bugs
Posted: 28 Oct 2010 13:35
by zer0
As of late, I have to do renaming that involves removing a string that ends with a dot and appears at either beginning or end of a file name. I would use this command to accomplish the desired:
However, if that string is at the end of the base name, XYplorer refuses to remove it. My suspicion is that this is because it thinks that removing that dot would alter the extension and since there is no "/e" switch present, it does not proceed.
Here comes the fun part...if that string appears at the end, it is always preceded by a dot. So, in the context of the above example, it would be ".text.remove.<ext>". Renaming manually works as the dot just before <ext> is replaced by the dot before the removed string. Thus, XYplorer baulking when a string is at the end is unwanted behaviour -- a file's extension isn't modified in any way. Can some smartness please be injected in this situation?

Re: Scripting Bugs
Posted: 28 Oct 2010 13:44
by TheQwerty
zer0 wrote: However, if that string is at the end of the base name, XYplorer refuses to remove it. My suspicion is that this is because it thinks that removing that dot would alter the extension and since there is no "/e" switch present, it does not proceed.
Not arguing against teaching Search & Replace some new tricks, but could you not use regex here instead?
Code: Select all
rename r, "text\.to\.remove\. > ";
Re: Scripting Bugs
Posted: 28 Oct 2010 15:05
by zer0
TheQwerty wrote:Not arguing against teaching Search & Replace some new tricks, but could you not use regex here instead?
Code: Select all
rename r, "text\.to\.remove\. > ";
I can, but not being very proficient in RegEx meant that it wasn't the first renaming method that I went for. Your method works, but that trick should definitely be taught to S&R.
Re: Scripting Bugs
Posted: 29 Oct 2010 11:40
by zer0
Running
html() with the following code causes XYplorer to stop responding
Code: Select all
<html><head>
<style type="text/css">
#a {
margin:0 10px 10px;
}
#b {
width:100%;
}
</style>
<title>Makes XYplorer non-responsive</title>
</head>
<body>
<table><tr><td>
<div id="a">
<form id="b">
<input type="text" name="test"/>
</div>
</td><td width="1"></td></tr></table>
</body></html>
Technically, it's not a problem with XYplorer, but IE. That said, since we can't help but use IE's engine, there should be some safety nets.
Re: Scripting Bugs
Posted: 29 Oct 2010 12:48
by admin
zer0 wrote:Running
html() with the following code causes XYplorer to stop responding
Code: Select all
<html><head>
<style type="text/css">
#a {
margin:0 10px 10px;
}
#b {
width:100%;
}
</style>
<title>Makes XYplorer non-responsive</title>
</head>
<body>
<table><tr><td>
<div id="a">
<form id="b">
<input type="text" name="test"/>
</div>
</td><td width="1"></td></tr></table>
</body></html>
Technically, it's not a problem with XYplorer, but IE. That said, since we can't help but use IE's engine, there should be some safety nets.
Problem confirmed, but since the conditions for problematic HTML code are not known there is no way to provide a safety net.
Re: Scripting Bugs
Posted: 29 Oct 2010 13:08
by zer0
admin wrote:Problem confirmed, but since the conditions for problematic HTML code are not known there is no way to provide a safety net.
I've run it through the W3C Validator, played around some more and I believe this is the error that validator flagged that is the cause:
required attribute "ACTION" not specified
<form id="b">
The attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element.
Typical values for type are type="text/css" for <style> and type="text/javascript" for <script>.
Changing that id from "b" to "a" -- in line with <div> tag's name above -- makes the page load fine.
Re: Scripting Bugs
Posted: 26 Sep 2011 17:13
by TheQwerty
Seems giving Report() an item list causes it to ignore the user-defined column formats.
Looks like it's been there since v9.40 so I'm guessing it goes all the way back to when Report was blessed with ItemList support.
Code: Select all
"Report Column Format Discrepency"
Sel 1;
$r1 = Report("{Created} {Size}", "<focitem>");
$r2 = Report("{Created} {Size}", 1);
Echo("F: $r1<crlf>S: $r2");
Re: Scripting Bugs
Posted: 26 Sep 2011 21:25
by admin
TheQwerty wrote:Seems giving Report() an item list causes it to ignore the user-defined column formats.
Looks like it's been there since v9.40 so I'm guessing it goes all the way back to when Report was blessed with ItemList support.
Code: Select all
"Report Column Format Discrepency"
Sel 1;
$r1 = Report("{Created} {Size}", "<focitem>");
$r2 = Report("{Created} {Size}", 1);
Echo("F: $r1<crlf>S: $r2");
That's on purpose. Giving a source list disconnects the report from the current list and it's formatting.
Re: Scripting Bugs
Posted: 26 Sep 2011 21:49
by TheQwerty
admin wrote:That's on purpose. Giving a source list disconnects the report from the current list and it's formatting.
Errr why? Why wouldn't I want the formatting here?
If I didn't want the formatting I would have included the desired formatting in the template, but I didn't because I want the same formatting as the column.
This means if a user wanted to compare the data from the focused item with the rest of the items they now have to jump through hoops; especially if they need to then use this data in SelFilter which expects the filter pattern to be in the exact same format as the column.
Unfortunately "{Created List}" doesn't work either, and in this case that would be more of a pain since I'm getting the column/template name from a Get("Sort") in the first place.
I really don't understand why I'd want to ignore the current list formatting just because I'm using a source list?
Re: Scripting Bugs
Posted: 27 Sep 2011 12:28
by admin
TheQwerty wrote:admin wrote:That's on purpose. Giving a source list disconnects the report from the current list and it's formatting.
Errr why? Why wouldn't I want the formatting here?
If I didn't want the formatting I would have included the desired formatting in the template, but I didn't because I want the same formatting as the column.
This means if a user wanted to compare the data from the focused item with the rest of the items they now have to jump through hoops; especially if they need to then use this data in SelFilter which expects the filter pattern to be in the exact same format as the column.
Unfortunately "{Created List}" doesn't work either, and in this case that would be more of a pain since I'm getting the column/template name from a Get("Sort") in the first place.
I really don't understand why I'd want to ignore the current list formatting just because I'm using a source list?
Can't really give a good reply now. The reporting code is quite complex and I did not look at it for more than a year. No idea how many users are using these functions but yours is the first complaint. From first impression I agree with you and wonder why it is as it is. But I would have to look very deep to make a good decision. No space for this in my schedule right now.