User talk:Perhelion/massrename.js

Hi, I'm a newby to scripts. Could you give me a short hint on how to install that script so I can actually fire it up and run it? Thx in advance. --TUBS 08:19, 10 February 2020 (UTC)

@Perhelion: I am also interested to know how to launch it. I already copied it under my username space. Best — WikiLucas (🖋️) 08:16, 26 August 2021 (UTC)
Pinging @Ahmad252: since Perhelion was not active since 2019. — WikiLucas (🖋️) 08:27, 26 August 2021 (UTC)
@WikiLucas00: / @TUBS: : Insert the following line into your user script (see, for example, my common.js): mw.loader.load('//commons.wikimedia.org/w/index.php?title=User:Perhelion/massrename.js&action=raw&ctype=text/javascript');. Now, after clearing the browser cache, the js is available throught the "MassRename" action. --Fl.schmitt (talk) 17:32, 23 August 2022 (UTC)
Or even easier: add
importScript( 'User:Perhelion/massrename.js');
to your user script. Fl.schmitt (talk) 17:52, 23 August 2022 (UTC)
After refreshing with ctrl+shift+R where is the script supposed to show a button? I don't understand why people can write a script like this but not a short documentation on how it's used like where the button(s) for it are showing up (it's neither under "More" on a category page nor in the left panel), could somebody write it? Commons:File renaming only has the info "A user script that can rename many files: User:Perhelion/massrename.js." Prototyperspective (talk) 22:36, 31 August 2024 (UTC)
@Prototyperspective:
MediaWiki portlet names
Seen technically, the JS places its button into the "p-cactions" toolbar (see Help:Customizing_toolbars). Display depends on the wikimedia skin you're using - with "Vector legacy", you'll find a MassRename entry inside the "More" menu next to the search box. With new vector (2022) skin, it's in the right sidebar "Tool" -> "Actions". Fl.schmitt (talk) 09:30, 1 September 2024 (UTC)
BTW: Since the script only works on category pages, you won't see the menu entry (button) on any other page, e.g. a File page. Fl.schmitt (talk) 09:59, 1 September 2024 (UTC)
Thanks for the info. However, even after using Firefox "Clear cookies and site data…" and logging in again, it doesn't show this tool under "More" in a category page. Maybe I imported it in a wrong way? Prototyperspective (talk) 00:19, 2 September 2024 (UTC)
Seems ok. Do you have a different browser available for testing? Fl.schmitt (talk) 05:51, 2 September 2024 (UTC)
I tried it with another Firefox profile and I also tried replacing my common.js with just the importScript line so it contains nothing else as well as the mw.loader version. Nothing worked: it does not show up under More after pressing ctrl+shift+r in a category. Maybe it's because other gadgets like petscan and deepcat search take up the space where the entry for it should show up? In the development window under Network it shows the script is loading, just the button to use it is missing or do I need some special permissions to be able to see the button for it? Prototyperspective (talk) 09:32, 2 September 2024 (UTC)
It also doesn't show when disabling the other gadgets which have buttons under "More". And I also tried it with the other skin where it should show up under Tools. Prototyperspective (talk) 09:49, 2 September 2024 (UTC)
@Prototyperspective: Oh - yes - permissions... sorry, i missed this. See line 308 of massrename.js: if (AQD.userRights === 'filemover' || AQD.userRights === 'sysop') ... - you need at least the filemover privilege. See Help:RenameLink#How_to_become_a_filemover and Commons:File_renaming/en-gb#How_to_rename_a_file - i don't think that there will be any objections, with regard to your edit count. Fl.schmitt (talk) 11:02, 2 September 2024 (UTC)
That is why it needs a documentation page. This can only be inferred from code at line 308, really? Prototyperspective (talk) 11:04, 2 September 2024 (UTC)
Hi @Prototyperspective, indeed you need filemover rights to move files.
This cannot only be inferred from line 308, as this is stated in Commons:File_renaming#How_to_rename_a_file: "only authorised users can actually rename files for now.".
This script is only here to help filemovers in their work, it seemed pretty obvious to me that if you don't have rights to move a single file, a "mass rename" script wouldn't be very helpful. Maybe the script could add a reminder about this in its documentation, but IMHO it's the responsibility of the user to know if they have the rights to do what they intend to use a tool for. All the best — WikiLucas (🖋️) 12:31, 2 September 2024 (UTC)
Indeed, thanks and yes that makes sense. I still think it should be on a documentation page because people may only read the subsection about the massrename tool or only the part "authorised users" where it's not clear whether they have that authorization or may come to this page from elsewhere such as the WMC search where that info is only in the "File renaming" page. I thought it would create many file move requests and this is a very plausible way this tool could work. Prototyperspective (talk) 12:36, 2 September 2024 (UTC)

Try to replace usage immediately using your user account

Un/ticking the option Try to replace usage immediately using your user account doesn't affect the result. The script always tries to rename the local files immediately, which is undesirable. What has changed? — Draceane talkcontrib. 08:58, 19 May 2026 (UTC)

Category:Commons scripts
Category:Commons scripts