Page 1 of 1

Removable Drives Tab(s)

Posted: 14 Nov 2013 15:15
by murdock01
I created this to speed up copying files to usb drives. I find it helpful so I thought others might enjoy it.
Why I created it:
Daily I copy various files to various usb drives to use around my place of work. Usually I plug in the drives and I need to browse around to figure out what drives letters were assigned to the usb drives. Then I open a tab for each usb drive so I can then go to the 'source' tab and copy certain files to the various usb tabs via drag n drop. The files change so its not possible yet to automate the whole process.
My first thought was 'it would be nice to have a tab auto-open when I plugged in a usb drive'. Since that is not possible I thought I would try to automate the tabs via a script. This is what I have so far.

I run this from an item in the catalog. I don't use the tree or anything, I just have the catalog with all kinds of things in it.
The script:

Code: Select all

$drives = get("drives",2);
  foreach($tabroot, $drives, "|") {
    $index = tab("newb",$tabroot);
    $name = trim($tabroot, ":\");
    tab("rename","RD:$name|<xyicons>\shapes\rd.ico",$index);
    tab("sethome",$tabroot,$index);
  }
Here is the caption for the catalog item (if you are interested)

Code: Select all

Rem Drives Tabs|<xyicons>\shapes\rd.ico
The rundown:
The first line of the script scans for drives of the type removable and puts that into the variable $drives
The foreach breaks the list of drives in $drives apart one by one. Each drive is stored in $tabroot during each pass of the loop
The next line creates the new background tab and stores the index of the new tab in the variable $index
The next line cleans up the drive name by trimming off the ":\". The result is just the drive letter. This is stored in $name
The next line renames the tab using the $name variable and sets a custom icon to make it look pretty
The last line sets the tabs 'home' to the root of the drive that is in $tabroot

To customize:
You can change the name of the tab by changing the "RD:$name|<xyicons>\shapes\rd.ico" part. The RD is just something for Removable Drive, The $name is the drive letter, and the |<xyicons>.... is just the icon.

The future:
This seems to work fine. If anyone has any ideas just let me know.
I also thought it would be cool to figure out a way to read the drive, or volume, label and have that in the name of the tab. Then when using multiple tabs each one is better identified.

Enjoy, Shawn

Re: Removable Drives Tab(s)

Posted: 14 Nov 2013 20:13
by klownboy
Hi murdock01,
Nice idea. When I get a chance I may combine what you've done here with:
(1) the drag and drop catalog script from highend and myself on this thread http://www.xyplorer.com/xyfc/viewtopic. ... ash#p82446 and
(2) the remove drive script from this post http://www.xyplorer.com/xyfc/viewtopic. ... ive#p86237 which will also close any unlocked temporary tab(s)

All 3 scripts could be melded and work together to provide the option of dragging to the tab(s) or to the drag & drop folder list provided in the catalog script, and then close the tab(s) and even remove the drive after use.
Thanks,
Ken

Re: Removable Drives Tab(s)

Posted: 17 Nov 2013 20:34
by rebr
Is there a way to open tabs in drive letter alpha order?
Thank you, anyway. Your script is just super!!