renameitem function

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
atjnjk
Posts: 32
Joined: 04 Nov 2009 07:03

renameitem function

Post by atjnjk »

I don't know how to use renameitem as a function. Could anyone show me some examples for it? Thank you very much.

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

Re: renameitem function

Post by admin »

For example, this renames a current file "hash.jpg" (or whatever is the current item) to "Copy of hash.jpg" and shows the new name "Copy of hash.jpg" in a text box:
::text renameitem("Copy of *");

zer0
Posts: 2676
Joined: 19 Jan 2009 20:11

Re: renameitem function

Post by zer0 »

And some more from this entry in the changelog thread http://www.xyplorer.com/xyfc/viewtopic. ... 176#p55176

Code: Select all

Examples:
  // rename current file" to "John[.ext]" in current folder
  ::renameitem "John", , , "-00";
  // rename "Paul.txt" to "John.txt" in current folder
  ::renameitem "John", "Paul.txt", , "-00";
  // rename current file" to "<clipboard>[.ext]" in current folder
  ::renameitem <clipboard>;
Note that "::" are for use in the address bar.
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build

atjnjk
Posts: 32
Joined: 04 Nov 2009 07:03

Re: renameitem function

Post by atjnjk »

That is what I don't understand. I expected renameitem to be used as a command. How can I rename files using it as a function?

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

Re: renameitem function

Post by admin »

atjnjk wrote:That is what I don't understand. I expected renameitem to be used as a command. How can I rename files using it as a function?
Simply add the parentheses (they are obligatory in functions):

Code: Select all

::renameitem("John", , , "-00");

atjnjk
Posts: 32
Joined: 04 Nov 2009 07:03

Re: renameitem function

Post by atjnjk »

Thank you very much. I've learned a new trick. Although it's a little unusual to use function like this.

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

Re: renameitem function

Post by admin »

atjnjk wrote:Thank you very much. I've learned a new trick. Although it's a little unusual to use function like this.
To make it/you feel better you can also do this:

Code: Select all

call renameitem("John", , , "-00");

atjnjk
Posts: 32
Joined: 04 Nov 2009 07:03

Re: renameitem function

Post by atjnjk »

A new trick again! It would be very helpful if these things are documented in the help file.

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

Re: renameitem function

Post by admin »

atjnjk wrote:A new trick again! It would be very helpful if these things are documented in the help file.
Yep, done.

Post Reply