Droplist / List Dropped Items

Discuss and share scripts and script files...
Post Reply
bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Droplist / List Dropped Items

Post by bdeshi »

== Ushering in a new era of inter-program interactivity! ==
A simple premise: Drag and drop files from other programs and see them listed in XYplorer!

If only one file is dropped, the script tries to figure out if that file is a filelist itself, and loads that list. Such deep intelligence!

-- -- --
The feature is best used as a CTB or a catalog item. A CTB implementation is given here, as a snippet.
Left-click houses the main droplist script. Right-click displays a menu to show or remove last droplist.

Code: Select all

Snip: CTB 1
  XYplorer 18.50.0307, 12/13/2017 5:48:14 PM
Action
  NewUserButton
Name
  Droplist
Icon
  :mrl
ScriptL
  // drop a collection of file/folders from any app and see them listed in XYplorer.
    $drop = <drop>;
    $list = '';
    // <drop> is some item(s) dragged from some app
    if exists(gettoken($drop, 1, <crlf>)){
      $list = $drop;
    }
  
    // <drop> is *one* file, may be a filelist
    // not elseif; an alternative branch
    if (exists($drop)==1) {
      // ~line 1 points to a file? assume drop is a file list
      if exists(gettoken(readfile($drop,, 2048), 1, <crlf>)) {
        if confirm("$drop<crlf>Dropped file may be a filelist. Try to load that list?") {
          $list = readfile($drop);
        }
      }
    }
  
    // show $list items with tied paper folder
    if $list {
      paperfolder("paper:tmp\droplist", $list);
    }
  
ScriptR
  "Open last drop list|:autorefresh"
    paperfolder("paper:tmp\droplist",,, 'l');
  "Forget last drop list|:del"
    paperfolder("paper:tmp\droplist",,, 'd');
    setting 'backgroundfileops', 0;
    delete 0, 0, "<xypaper>\tmp\droplist.txt";
    if (property('#empty', "<xypaper>\tmp")==2) {
      delete 0, 0, "<xypaper>\tmp";
    }
FireClick
  0
Type "::snippet;" into the addressbar (no quotes), and enter the above code into the textbox that opens. You'll find a new nutty button with the script.
this uses a paper folder at paper:tmp\droplist.
You can use the Left-click script of that button as a catalog script without any modifications.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

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

Re: Droplist / List Dropped Items

Post by admin »

Cool idea! :tup:

giuliastar
Posts: 365
Joined: 14 Sep 2013 07:22

Re: Droplist / List Dropped Items

Post by giuliastar »

Hi
is the same script viewtopic.php?f=3&t=18232&e=1&view=unread#unread
or are there some improvements?
thanks a lot :tup: :tup:

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Droplist / List Dropped Items

Post by bdeshi »

Thanks! :tup:

It's basically a combination of the two scripts I posted on that topic. You can drag-drop both actual files themselves, or a list like TotalCommander collections file. There are other changes behind the scenes that you as a user don't need to be concerned about.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

Post Reply