Page 1 of 1

Need Help from Some Developer

Posted: 15 Jul 2012 23:20
by Formingus
Hi guys i need any script Command to create button with this function

After i select File the button command should do next

Copy Name of Selected File Folder
Create new Folder with copied Name
Move that file in that folder
While position will remain on root

ex: I have c:\Ex.mp3 after i Select and press button that we will give him command
ex.mp3 will be moved to C:\ex\ex.mp3 and position will still remain on Root C:

Thanks in Advance

Re: Need Help from Some Developer

Posted: 16 Jul 2012 09:42
by Stefan
Hi Formingus, welcome.

Please think about better thread subjects next time.
E.g.: "Script needed: create folder from file name and move to" or like that.


For your issue try something like this:

Code: Select all


/*
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;
  }


See the link in my footer for an how-to execute scripts and create buttons.


.

Re: Need Help from Some Developer

Posted: 18 Jul 2012 00:14
by Formingus
Stefan wrote:Hi Formingus, welcome.

Please think about better thread subjects next time.
E.g.: "Script needed: create folder from file name and move to" or like that.


For your issue try something like this:

Code: Select all


/*
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;
  }


See the link in my footer for an how-to execute scripts and create buttons.


.
I Will Sorry if i made some mistake , i am not familiar with programing any way that exactly what u saved allot of mine time
thank u allot and best Regards

Formingus

Re: Need Help from Some Developer

Posted: 13 Dec 2013 14:22
by Formingus
Hi After Update this script not working any more.
If you can help me again it will be appreciated allot

Image

Thank You in Advance

Re: Need Help from Some Developer

Posted: 13 Dec 2013 14:31
by highend

Code: Select all

new($FldTemp, "dir");

Re: Need Help from Some Developer

Posted: 13 Dec 2013 14:41
by admin
This might help even more: ;)

Code: Select all

new($BASE, "dir");

Re: Need Help from Some Developer

Posted: 13 Dec 2013 15:52
by highend
:ugeek:
Let's say: just use new() instead of the old form without parentheses...

Re: Need Help from Some Developer

Posted: 13 Dec 2013 22:32
by Formingus
Guys neither of commands Work it Says New its not Valid Command.

Image

So if there is another Way it will appreciated.
So, i want Selected File to Move into new Created Folder from File Name

Ex: File Name : C:\Xyplorer.exe
After Select and press Button it Will be moved at c:\XyPlorer\XyPlorer.exe

Thank You Guys For Fast Replay

Re: Need Help from Some Developer

Posted: 14 Dec 2013 01:32
by highend
Because you didn't even use these commands?

Code: Select all

new $FldTemp, dir;
new $BASE, dir;
They must be replaced by

Code: Select all

new($FldTemp, "dir");
new($BASE, "dir");

Re: Need Help from Some Developer

Posted: 14 Dec 2013 12:48
by Formingus
Ok After Replacing those command its work fine but creating folder confirmation appear
I Read something about move to and there ask to put 2 thats mean overwrite without asking
Try couple of time but as unfamiliar with scripts yet didn't have success.

This is Whole Command i use so if you can re edit it please. Thank You

Code: Select all

/*
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;
So if you See hear Folder is not Created

Image

And its Ask to Create Folder

Image

Thank in Advance for helping Me

Re: Need Help from Some Developer

Posted: 14 Dec 2013 13:49
by highend

Code: Select all

    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 should be totally enough for what you want to achieve. Right?

Re: Need Help from Some Developer

Posted: 14 Dec 2013 14:47
by RalphM
Even easier than all the scripting, but only for one item at a time:

1. Right Mouse drag the item within the list
2. Select "Move to new subfolder" from the context menu.
3. You're asked for the name of the new subfolder which defaults to the basename of the file.
4. Klick OK and you're done.

Re: Need Help from Some Developer

Posted: 15 Dec 2013 01:16
by Formingus
highend wrote:

Code: Select all

    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 should be totally enough for what you want to achieve. Right?
Right Bro.. This one Worked like charm

Thank you :appl: :D

Re: Need Help from Some Developer

Posted: 15 Dec 2013 01:18
by Formingus
RalphM wrote:Even easier than all the scripting, but only for one item at a time:

1. Right Mouse drag the item within the list
2. Select "Move to new subfolder" from the context menu.
3. You're asked for the name of the new subfolder which defaults to the basename of the file.
4. Klick OK and you're done.
This is alternative method and work as well
But with Highend code i can use on button click even with hotkey
Any way thank you for Replay