Dropping files to Flash/External drive folders

Discuss and share scripts and script files...
klownboy
Posts: 4459
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.8037 at 100% 2560x1440

Re: Dropping files to Flash/External drive folders

Post by klownboy »

Don, to avoid reposting the same script...it's the 1st post with the following minor change in the menu line. I added a comment to the first post.

Code: Select all

"Select Flash Drive Folder|:wipe"  load self(file);
and also try the line:

Code: Select all

"Select Flash Drive Folder|:wipe"  load *;
Obviously the script may not run properly if you don't have a removable drive installed or you haven't changed the pre-set folders.
Thanks,
Ken

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

Re: Dropping files to Flash/External drive folders

Post by admin »

Thanks, but no time for this now. If you happen to find a minimal script to reproduce the problem I can look into it.

klownboy
Posts: 4459
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.8037 at 100% 2560x1440

Re: Dropping files to Flash/External drive folders

Post by klownboy »

Don, as I said above I'm not sure it is a problem. Here are 2 shortened and butchered scripts that you can try when you have time (certainly no rush - when you have breathing time - your change works) and follow the modified direction in the dialog boxes. I don't want to repeat what I said above, but the first script illustrates the 'resource' error message when using load self(file) in the menu heading, and the the 2nd script illustrates the execution of "_Terminate" twice when using load * in the same menu heading. Drag a file onto the scripts to run it.

Code: Select all

"_Initialize"
    perm $Flash_Folder, $Rem_Dr; 

    $Rem_Dr = get("drives", 3), "|");
    $Dr_Cnt = gettoken($Rem_Dr, "count", "|");
      msg "You have $Dr_Cnt drive(s) installed!";
    $Rem_Dr = inputselect("Select the Target Drive - Don, for testing only<crlf>select C:\:","$Rem_Dr", | ,4, ,350, 250, "Target Drive Selection");}

"_Main";
"Select Drive Folder - Don for testing select this heading instead of a menu item on the first pass, C:\ on the second pass.|:wipe" load self(file);
"-"
"        $Rem_Dr&";
    sub _drop_it;
"        $Rem_Dr&Windows";
    sub _drop_it;
"        $Rem_Dr&Program Files";
    sub _drop_it;
    

"_drop_it";
     if (<get drop |> == ""){
       status "Nothing to do" , , "alert";
     }
     else {
       $Flash_Folder = ($Rem_Dr . gettoken(caller("caption"), -1, "&", "t"));
       if (exists($Flash_Folder) >= 1) {
              copyto $Flash_Folder, <get drop |>;
       }
       else {
             msg "This path doesn't exist!";
       }
     }  
"_Terminate"
 unset $Flash_Folder; unset $Rem_Dr;
 
The 2nd script:

Code: Select all

"_Initialize"
    perm $Flash_Folder, $Rem_Dr; 

    $Rem_Dr = get("drives", 3), "|");
    $Dr_Cnt = gettoken($Rem_Dr, "count", "|");
      msg "You have $Dr_Cnt drive(s) installed!";
    $Rem_Dr = inputselect("Select the Target Drive - Don, for testing only<crlf>select C:\:","$Rem_Dr", | ,4, ,350, 250, "Target Drive Selection");}

"_Main";
"Select Drive Folder - Don for testing select this heading instead of a menu item on the first pass, C:\ on the second pass.|:wipe" load *;
"-"
"        $Rem_Dr&";
    sub _drop_it;
"        $Rem_Dr&Windows";
    sub _drop_it;
"        $Rem_Dr&Program Files";
    sub _drop_it;
    

"_drop_it";
     if (<get drop |> == ""){
       status "Nothing to do" , , "alert";
     }
     else {
       $Flash_Folder = ($Rem_Dr . gettoken(caller("caption"), -1, "&", "t"));
       if (exists($Flash_Folder) >= 1) {
              copyto $Flash_Folder, <get drop |>;
       }
       else {
             msg "This path doesn't exist!";
       }
     }  
"_Terminate"
 unset $Flash_Folder; unset $Rem_Dr;
 
Thanks,
Ken

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

Re: Dropping files to Flash/External drive folders

Post by admin »

Probably fixed the load self(file) thing...

klownboy
Posts: 4459
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.8037 at 100% 2560x1440

Re: Dropping files to Flash/External drive folders

Post by klownboy »

Thanks Don. I'm not sure the 2nd situation (load *) needs fixing. :?: It seems to make sense that "_Terminate" would run again due to the reload (i.e., original stack and stack 1), but maybe that could be detected and prevented.

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

Re: Dropping files to Flash/External drive folders

Post by admin »

Maybe, not sure yet.

klownboy
Posts: 4459
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.8037 at 100% 2560x1440

Re: Dropping files to Flash/External drive folders

Post by klownboy »

As you said the load self(file) issue we discussed did go away. I can't remember the version number, but it's gone for me as well.
Thanks,
Ken

Post Reply