User Button Not Working as Expected

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
phred
Posts: 686
Joined: 26 Dec 2021 02:10
Location: XY 64bit on Win10 at 100% from Boston USA

User Button Not Working as Expected

Post 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>));

highend
Posts: 15006
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: User Button Not Working as Expected

Post by highend »

If you've selected the files: attrstamp("r", 3);?
One of my scripts helped you out? Please donate via Paypal

phred
Posts: 686
Joined: 26 Dec 2021 02:10
Location: XY 64bit on Win10 at 100% from Boston USA

Re: User Button Not Working as Expected

Post 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.

highend
Posts: 15006
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: User Button Not Working as Expected

Post by highend »

Animation.gif
To see the attached files, you need to log into the forum.
One of my scripts helped you out? Please donate via Paypal

phred
Posts: 686
Joined: 26 Dec 2021 02:10
Location: XY 64bit on Win10 at 100% from Boston USA

Re: User Button Not Working as Expected

Post 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
To see the attached files, you need to log into the forum.

highend
Posts: 15006
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: User Button Not Working as Expected

Post 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;
One of my scripts helped you out? Please donate via Paypal

phred
Posts: 686
Joined: 26 Dec 2021 02:10
Location: XY 64bit on Win10 at 100% from Boston USA

Re: User Button Not Working as Expected

Post 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

highend
Posts: 15006
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: User Button Not Working as Expected

Post 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
One of my scripts helped you out? Please donate via Paypal

phred
Posts: 686
Joined: 26 Dec 2021 02:10
Location: XY 64bit on Win10 at 100% from Boston USA

Re: User Button Not Working as Expected

Post 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.

admin
Site Admin
Posts: 66822
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: User Button Not Working as Expected

Post by admin »

Can you describe the bug shortly?

phred
Posts: 686
Joined: 26 Dec 2021 02:10
Location: XY 64bit on Win10 at 100% from Boston USA

Re: User Button Not Working as Expected

Post 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.

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

Re: User Button Not Working as Expected

Post 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>)); }

Post Reply