Miscellaneous - Questions

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
MaxEnrik
Posts: 107
Joined: 20 Apr 2019 02:34

Miscellaneous - Questions

Post by MaxEnrik »

EDITED Version
Hello!

#1 - Suffix for Folder from Selected file.

1. Folder Name is '#1'
2. Selected File Name is 'New Name for #1 Folder'
3. Folder name would be like this: '#1New Name for #1 Folder'

Image

Code: Select all

    $SelectNumber1Folder = ; // '#1 Folder' don't know how to handle it that I will give it new name. 
    msg $SelectNumber1Folder;

    // this works good I copied from @highend
    $copyNameofSelectedFile = gpc(gettoken(<get SelectedItemsPathNames |>, 1, "|"), "base");
    msg $copyNameofSelectedFile; // gives correct name
P.S Sorry for my bad explanation at first attempt.
Thanks in advance.
Last edited by MaxEnrik on 14 May 2019 08:57, edited 1 time in total.

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Miscellaneous - Questions

Post by highend »

What (no clue what you mean)?
One of my scripts helped you out? Please donate via Paypal

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Miscellaneous - Questions

Post by bdeshi »

For pasteto to work, you have to have some files on the clipboard.
And you have give a correct path as paste target; (Why are you using pasteto "*"?)

Code: Select all

copy <get SelectedItemsPathNames |>; // or, copy <selitems |>;
pasteto "path\to\destination\folder";
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

MaxEnrik
Posts: 107
Joined: 20 Apr 2019 02:34

Re: Miscellaneous - Questions

Post by MaxEnrik »

( I was forgot to answer to your questions )

@highend - I re-write my initial post, hope I explained more clearly than previous one.
@SammaySarkar - Thanks a lot for your reply, I was tried them before re-write my initial post. I get correctly msg but not able to add msg result end of the folder (suffix).

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Miscellaneous - Questions

Post by highend »

So you are in
"R:\#1"

It contains the file, which is also selected:
"R:\#1\Some file name.extension"

And now you want
"R:\#1" be renamed into "R:\#1Some File name"?

Code: Select all

    $parent = gpc(<curitem>, "component", -2, 1);
    renameitem(gpc($parent, "file") . gpc(, "base"), $parent, 1);
One of my scripts helped you out? Please donate via Paypal

MaxEnrik
Posts: 107
Joined: 20 Apr 2019 02:34

Re: Miscellaneous - Questions

Post by MaxEnrik »

Wow, that is what I want. Thank you!
( I hadn't used right keywords in the forum and help docs. )

MaxEnrik
Posts: 107
Joined: 20 Apr 2019 02:34

Re: Miscellaneous - Questions

Post by MaxEnrik »

#2 - Copy Selected Folder Name and Rename all Items inside of the Folder

I tried below code, and can't rename files inside of the selected Folder.
And need to add suffix numbers.

Code: Select all

    $parent = gpc(<curitem>, "base", -2, 1);
    renameitem($parent, , 1, <#1>);
for example:
Selected Folder Name: 'Random Folder'
Files name in the Folder: 'Something Else.jpg' (file extension can be anything in this case)
I would like to rename files inside of the Folder like this: 'Random Folder - 1.jpg'

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Miscellaneous - Questions

Post by highend »

Loop over all items either via foreach or while...

Code: Select all

    $parent = gpc(<curitem>, "base", -2, 1);
    $itemsInside = listfolder(<curitem>, , 4);
    while ($i++ < gettoken($itemsInside, "count", "|")) {
        $item = gettoken($itemsInside, $i, "|");
        renameitem("$parent - $i." . gpc($item, "ext"), "<curitem>\$item");
    }
    end true;

    $parent = gpc(<curitem>, "base", -2, 1);
    $i = 1;
    foreach($item, listfolder(<curitem>, , 4), , "e") {
        renameitem("$parent - $i." . gpc($item, "ext"), "<curitem>\$item");
        $i++;
    }
One of my scripts helped you out? Please donate via Paypal

MaxEnrik
Posts: 107
Joined: 20 Apr 2019 02:34

Re: Miscellaneous - Questions

Post by MaxEnrik »

@highend - Thanks a lot, that is what I want.
And I will be able to use that script if renaming start from Created Date.

(p.s I tried to modify it by myself, failed. Scripting so hard.)

2nd Edited
Isn't that possible to start renaming from 1st Created Date?
(I am worrying that I am spending my time for nothing to searching about it.)

MaxEnrik
Posts: 107
Joined: 20 Apr 2019 02:34

Re: Miscellaneous - Questions

Post by MaxEnrik »

#3 - Rename Suffix from `Clipboard.

First of all, believe me I spent a lot of time to do this simple thing but failed.
@highend did similar thing above, but I failed to customize it for my this concern.

I want to clipboard will add as `Suffix` currently selected item in `Tree`

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Miscellaneous - Questions

Post by highend »

1. No clue what you are trying to say
2. You failed, ok. Where exactly?
One of my scripts helped you out? Please donate via Paypal

MaxEnrik
Posts: 107
Joined: 20 Apr 2019 02:34

Re: Miscellaneous - Questions

Post by MaxEnrik »

Image

I selected Folder in Tree.
Folder Name: '1-'
Clipboard: '(clipboard as suffix here)'
I want Result will be like this: `1-(clipboard as suffix here)`

Thanks in advance.

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Miscellaneous - Questions

Post by highend »

And where exactly did you fail trying to accomplish this?
One of my scripts helped you out? Please donate via Paypal

MaxEnrik
Posts: 107
Joined: 20 Apr 2019 02:34

Re: Miscellaneous - Questions

Post by MaxEnrik »

This is what I tried.

Code: Select all

    $parent = gpc(<curitem>, "component", -2, 1);
    renameitem(gpc($parent, "file") . <clipboard>, $parent, 1);

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Miscellaneous - Questions

Post by highend »

And for what should be $parent used? You just want to add <clipboard> to the "file" (from gpc()) for <curpath>
One of my scripts helped you out? Please donate via Paypal

Post Reply