Page 1 of 1
User Button Not Working as Expected
Posted: 03 Aug 2026 15:33
by phred
Using XY 28.30.1600 on Win10 desktop.
I created a user button to toggle Read Only on or off. I select all the files in the list, click the button and only one file changes. I expected all selected files to change. This is the code I'm using. What do I need to change in order for it to work on all selected files?
attrstamp("r", 3, quicksearch("/f", <curitem>));
Re: User Button Not Working as Expected
Posted: 03 Aug 2026 15:36
by highend
If you've selected the files: attrstamp("r", 3);?
Re: User Button Not Working as Expected
Posted: 03 Aug 2026 15:57
by phred
Okay, this is now getting a little weird.
I tried your suggestion and it didn't change anything. Not with the entire list selected nor with one file selected. I went back to what I had originally and the attribute did not change with one or all files selected.
Re: User Button Not Working as Expected
Posted: 03 Aug 2026 16:14
by highend
Re: User Button Not Working as Expected
Posted: 03 Aug 2026 16:42
by phred
Yes, I see that it works for you, but not for me.
2026-08-03_10-40-22.jpg
2026-08-03_10-40-44.jpg
Re: User Button Not Working as Expected
Posted: 03 Aug 2026 16:53
by highend
No clue what you want to say with these pictures...
Select
one file, execute the script (from Scripting - Run Script...)
Post the result
Code: Select all
$log = <curitem> . <crlf>;
$result = attrstamp("r", 3, <curitem>);
$log .= "Attributes before: " . $result . <crlf>;
$result = attrstamp("r", 3, <curitem>);
$log .= "Attributes after: " . $result;
text $log;
Re: User Button Not Working as Expected
Posted: 03 Aug 2026 17:22
by phred
The screenshots were my attempt to show you that the modified code you listed
attrstamp("r", 3);
didn't work.
One file selected, your script executed from Run Script. No attributes changed despite what this shows. 13 files in the directory; 2 are HS-A and 11 are R-A. Before and
Z:\Pending Audio\Chicago - Chicago Carnegie Hall Apr 5-10, 1971\CD3\04. Anxiety's Moment.mp3
Attributes before: 33
Attributes after: 32
Re: User Button Not Working as Expected
Posted: 03 Aug 2026 17:58
by highend
It obviously did work (at least that's what attrstamp says)
That file had the attribute +R before the script was executed
Then the script set it -R and again to +R
Re: User Button Not Working as Expected
Posted: 03 Aug 2026 21:10
by phred
Then might there be an issue with the attributes in the list not updating? Because that's what I'm basing my "it doesn't work" on.
The files show RA attributes. Before and after executing it.
EDIT: I found the problem. XY is not updating/refreshing the list after the script has run. I have view > auto-refresh enabled but it isn't auto-refreshing. Hitting F5 refreshes the list and updates the attribute.
I rolled back to 28.30.0702 and the issue is present. I toggles auto-refresh off and then on and XY is not refreshing the attributes. Looks like Don will have something to do when he returns. Do you think I should post this in the Bugs section?
Thanks, highend for helping me figure out what was going on.
Re: User Button Not Working as Expected
Posted: 25 Aug 2026 18:55
by admin
Can you describe the bug shortly?
Re: User Button Not Working as Expected
Posted: 25 Aug 2026 20:09
by phred
admin wrote: ↑25 Aug 2026 18:55
Can you describe the bug shortly?
The behavior I was seeing was that after running the script to toggle the R/O attribute the Attr column wasn't updating to reflect the change. But it has been working as expected for the past couple of weeks.
No need to do anything, Don.
Re: User Button Not Working as Expected
Posted: 12 Sep 2026 04:14
by jupe
Regarding the OP, the script you quoted was as supplied in your original request here:
https://www.xyplorer.com/xyfc/viewtopic ... 96#p236796
and the orig request was for you to select a single folder and ±R the
recursive file contents, meanwhile in this thread you have changed the request to select a group of files instead, which as I originally mentioned would require a script modification, so no wonder it didn't perform as expected. Anyway if you use a script such as this:
attrstamp("r", 3, quicksearch("/fl", <get sip>));
it should work in both cases, ie. a selection of files, or a selection of folders to which the recursive file contents are ±R'd (or even if a combo of both files + folder(s) is selected)
I RECOMMEND TO BE CAREFUL IF USING THIS THOUGH, ie YOU WOULDN'T WANT TO ACCIDENTALLY PRESS IT WITH THE WRONG FOLDER(S) SELECTED,
BUT YOU COULD ADD A CONFIRMATION DIALOG IF ACCIDENTAL PRESS IS A POSSIBILITY, eg,
Code: Select all
if (confirm("Really toggle R attr on selected items?", 3:=4)) { attrstamp("r", 3, quicksearch("/fl", <get sip>)); }