Page 1 of 1

renameitem function

Posted: 09 Dec 2010 12:34
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.

Re: renameitem function

Posted: 09 Dec 2010 12:36
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 *");

Re: renameitem function

Posted: 09 Dec 2010 12:39
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.

Re: renameitem function

Posted: 09 Dec 2010 12:45
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?

Re: renameitem function

Posted: 09 Dec 2010 13:53
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");

Re: renameitem function

Posted: 09 Dec 2010 14:05
by atjnjk
Thank you very much. I've learned a new trick. Although it's a little unusual to use function like this.

Re: renameitem function

Posted: 09 Dec 2010 15:05
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");

Re: renameitem function

Posted: 10 Dec 2010 03:50
by atjnjk
A new trick again! It would be very helpful if these things are documented in the help file.

Re: renameitem function

Posted: 10 Dec 2010 09:23
by admin
atjnjk wrote:A new trick again! It would be very helpful if these things are documented in the help file.
Yep, done.