Need Help from Some Developer

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Formingus
Posts: 28
Joined: 14 Jan 2009 11:44

Need Help from Some Developer

Post 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

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Need Help from Some Developer

Post 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.


.

Formingus
Posts: 28
Joined: 14 Jan 2009 11:44

Re: Need Help from Some Developer

Post 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

Formingus
Posts: 28
Joined: 14 Jan 2009 11:44

Re: Need Help from Some Developer

Post 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

highend
Posts: 14571
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Need Help from Some Developer

Post by highend »

Code: Select all

new($FldTemp, "dir");
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 64917
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Need Help from Some Developer

Post by admin »

This might help even more: ;)

Code: Select all

new($BASE, "dir");

highend
Posts: 14571
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Need Help from Some Developer

Post by highend »

:ugeek:
Let's say: just use new() instead of the old form without parentheses...
One of my scripts helped you out? Please donate via Paypal

Formingus
Posts: 28
Joined: 14 Jan 2009 11:44

Re: Need Help from Some Developer

Post 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

highend
Posts: 14571
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Need Help from Some Developer

Post 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");
One of my scripts helped you out? Please donate via Paypal

Formingus
Posts: 28
Joined: 14 Jan 2009 11:44

Re: Need Help from Some Developer

Post 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

highend
Posts: 14571
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Need Help from Some Developer

Post 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?
One of my scripts helped you out? Please donate via Paypal

RalphM
Posts: 2042
Joined: 27 Jan 2005 23:38
Location: Cairns, Australia

Re: Need Help from Some Developer

Post 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.
Ralph :)
(OS: W11 24H2 Home x64 - XY: Current x32 beta - Office 2024 32-bit - Display: 1920x1080 @ 125%)

Formingus
Posts: 28
Joined: 14 Jan 2009 11:44

Re: Need Help from Some Developer

Post 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

Formingus
Posts: 28
Joined: 14 Jan 2009 11:44

Re: Need Help from Some Developer

Post 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

Post Reply