Page 1 of 1

Command Worked before now not!!!

Posted: 21 Nov 2024 20:35
by Formingus
I Use this command to create directory and move a selected file created directory with name file name....
ex: File work.rar, will moved into directory name called WORK
Select then Move to Selected Named Folder
/*
Copy Name of Selected File OR Folder
Create new Folder with copied Name
Move that file OR FOLDER in that folder
While position will remain on root
*/
end( get("CountSelected") > 1 , Select one item only);
//GET Name of Selected File Folder
$ITEM = "<curitem>";
$NAME = "<curname>";
if(exists($ITEM)==2){
$FOLDER = $ITEM;
$FldTemp = $FOLDER . "_xyTEMPxy";
//Create new Folder with copied Name
new $FldTemp, dir;
//Move that file in that folder
//While position will remain on root
moveto $FldTemp, $FOLDER; wait 1000;
renameitem($NAME,$FldTemp);
}else{
$FILE = $ITEM;
$BASE = report("{BaseName}",1);
//Create new Folder with copied Name
if(exists("<curpath>\$BASE")!=2){new $BASE, dir;}
//Move that file in that folder
//While position will remain on root
moveto $BASE, $FILE;
}

For Newer Version

end(get("CountSelected") != 1, "You have to select only ONE item!");
$curItem = "<curitem>";
if not (exists("<curpath>\<curbase>") == 2) { new("<curpath>\<curbase>", "dir"); }
moveto "<curpath>\<curbase>", $curItem;
This script not work on last version, where is the problem ?

Re: Command Worked before now not!!!

Posted: 21 Nov 2024 23:10
by highend
It works fine, I guess you didn't indent the lines correctly...

Btw, this one does exactly the same:

Code: Select all

end(get("CountSelected") != 1, "You have to select only ONE file!");
    moveto "<curpath>\<curbase>", <curitem>, , 2, 2;

Re: Command Worked before now not!!!

Posted: 22 Nov 2024 14:05
by Formingus
Before i used wholle code, now i used only this one

end(get("CountSelected") != 1, "You have to select only ONE file!");
moveto "<curpath>\<curbase>", <curitem>, , 2, 2; and worked fine, thanks