Page 1 of 8

Miscellaneous - Questions

Posted: 14 May 2019 05:35
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.

Re: Miscellaneous - Questions

Posted: 14 May 2019 07:29
by highend
What (no clue what you mean)?

Re: Miscellaneous - Questions

Posted: 14 May 2019 07:43
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";

Re: Miscellaneous - Questions

Posted: 14 May 2019 14:40
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).

Re: Miscellaneous - Questions

Posted: 14 May 2019 14:53
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);

Re: Miscellaneous - Questions

Posted: 14 May 2019 15:01
by MaxEnrik
Wow, that is what I want. Thank you!
( I hadn't used right keywords in the forum and help docs. )

Re: Miscellaneous - Questions

Posted: 16 May 2019 10:36
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'

Re: Miscellaneous - Questions

Posted: 16 May 2019 11:00
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++;
    }

Re: Miscellaneous - Questions

Posted: 16 May 2019 11:45
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.)

Re: Miscellaneous - Questions

Posted: 20 May 2019 21:44
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`

Re: Miscellaneous - Questions

Posted: 20 May 2019 22:27
by highend
1. No clue what you are trying to say
2. You failed, ok. Where exactly?

Re: Miscellaneous - Questions

Posted: 20 May 2019 22:36
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.

Re: Miscellaneous - Questions

Posted: 20 May 2019 22:40
by highend
And where exactly did you fail trying to accomplish this?

Re: Miscellaneous - Questions

Posted: 20 May 2019 22:42
by MaxEnrik
This is what I tried.

Code: Select all

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

Re: Miscellaneous - Questions

Posted: 20 May 2019 22:49
by highend
And for what should be $parent used? You just want to add <clipboard> to the "file" (from gpc()) for <curpath>