Sorting Audio Files Into Folder Script

Discuss and share scripts and script files...
cldcp00
Posts: 52
Joined: 20 Jun 2019 15:26

Re: Sorting Audio Files Into Folder Script

Post by cldcp00 »

Thanks for you help
amended code to
writefile($auditTrailFile, $auditLog, "a");
but script still will not run, any other pointers?
Regards

jupe
Posts: 2669
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Sorting Audio Files Into Folder Script

Post by jupe »

So you indented the whole script as advised? When you say it "will not run", what actually happens? Try this mod that has the necessary changes already applied:

Code: Select all

    $moveItem = 0; // 0 = Copy item, 1 = Move item
    $menuPosX = 500;
    $menuPosY = 500;

    $auditLog = "";
    $auditTrailFile = "D:\New Music Library\0000 Music Files Library & Information\Xyplorer Music File Audit.txt"; // Set the path to your audit trail file.

    $destinations = <<<>>>
D:\New Music Library\New Music Library 2020\Dance
D:\New Music Library\New Music Library 2020\Country
D:\New Music Library\New Music Library 2020\Classical
    >>>;

    $selected = <get SelectedItemsPathNames>;
    end (!$selected), "No item(s) selected, aborted!";

    setting "BackgroundFileOps", 0;
    foreach($item, $selected, <crlf>, "e") {
        $base = gpc($item, "file");
        $menu = <<<>>>
            $base||$item|4
            -
            $destinations
        >>>;
        $menu = regexreplace($menu, "^[ \t]+");
        $target = popupmenu($menu, $menuPosX, $menuPosY, 6:=<crlf>, 7:="|");
        if (!$target) { continue; }

        copyto $target, $item, , 2, 2, 2, 1, 0, 0, 1, 0, 0;

        // Log the operation to the audit trail file.
        $auditLog .= "Copied: $item to: $target<crlf>";

        if ($moveItem == 1) { runret(lax("cmd" /c DEL /F /Q "$item"), "%TEMP%"); }
    }
    writefile($auditTrailFile, $auditLog, "a");

cldcp00
Posts: 52
Joined: 20 Jun 2019 15:26

Re: Sorting Audio Files Into Folder Script

Post by cldcp00 »

Hi Jupe,
Thank you, now working fine, try to work out what i was doing wrong.
Thanks again much appreciated

Post Reply