Sending files automatically to appropriate collections?

Would this be possible: i have a hotkey, to send items to a special collection, but everytime, certain file types are sent, they should be added to their associated group, like .mp3, .wav, .ape etc would end up in coll://USB, as the normal case.

I don´t know, if this idea sounds weird, but it surely would be a powerful function.

Assuming all these files start out in one folder, or a folder that's in flat view, you could try a button like the following to do it.

Select NONE Select *.(avi|mpeg) Copy TO coll://films Select NONE Select *.(mp3|wav|ape) Copy TO coll://music Select NONE Select ~(*.(avi|mpeg|mp3|wav|ape)) Copy TO coll://USB

John, thank you very much! That is almost what i looked for. It works well, if you there are files to be distributed all in one folder. But the button was meant to be quite a bit differently: let´s say, you randomly chose three MP3 files to be added, it should "know", they "belong" to coll://music. The difference is, these files are added rather randomly, not simultaneously.

So if i have a hotkey, it would add music, video & other stuff to their appropriate collections, depending on what filetypes they are. It looks like the "select none" deselects chosen files, thus they aren´t added to te collections, when i try to send random files.

Sorry, there are a few typos in my answer. basically what i mean is something like the old Basic (or was it Pascal?) CASE command.

Something like this:

CASE file=(mp3, wav, ape) copy to coll://music
CASE file=(avi, mpeg) copy to coll://film
ELSE copy stuff to coll://USB

:smiley:

Hi abr,

I'm familiar with the case command, I use it often when I write scripts in IMatch. However that's the problem, it requires a script which Opus only has limited support for (other than for renaming files). However I know Leo has found ways to tweak some VB scripts to do other things, if he can think of a way to do what you want perhaps he'll jump into this thread.

If not, I might be able to do this with a standard command line script.

thx, John. It would be cool, to have such a function & surely is interesting to some other users. The only problem with this idea is, it can handle only files, so if i add folders containing music or movies, i have to use two extra buttons for that task, which is ok for me.

abr if I have some extra time this weekend I'll see if I can put together a command line script (batch file) that can do this via a button.

But I've also got about 40 quarts of tomatoes to can this weekend, so we'll see who wins, my wife or my computer. lol

That´s very cool!

Is that a year´s supply of base material for pasta & pizzas? It is almost 40kg! :open_mouth:

Ok this wasn't very hard to do via a batch file after all so I cranked it out tonight.

Create a new text file and paste the following code into and save it some place you want with a name giving it a file extension of: .cmd

[code]@echo off

set FileType=
IF "%~x1" == ".mpeg" set FileType=films
IF "%~x1" == ".avi" set FileType=films

IF "%~x1" == ".mp3" set FileType=music
IF "%~x1" == ".ape" set FileType=music
IF "%~x1" == ".wav" set FileType=music

if not defined FileType set FileType=USB
dopusrt /CMD Copy "%~1" TO coll://%FileType%[/code]

Next with Opus in customize mode, drag that text file you made to a toolbar somewhere then edit it and add a {f} at the end of it like indicated in the screen grab below.

Then exit customize mode and see how it works for you. If all works as it should you can edit the Opus button again and add RunMode Hide to avoid the DOS box.

I need more than a year's worth of canned tomatoes, last year's harvest was terrible so we need to stock up! :slight_smile:

I just made a minor change to the script so it does nothing if you happen to double click on the script name instead of running it from the button.

[code]@echo off
if "%~1" == "" exit

set FileType=
IF "%~x1" == ".mpeg" set FileType=films
IF "%~x1" == ".avi" set FileType=films

IF "%~x1" == ".mp3" set FileType=music
IF "%~x1" == ".ape" set FileType=music
IF "%~x1" == ".wav" set FileType=music

if not defined FileType set FileType=USB
dopusrt /CMD Copy "%~1" TO coll://%FileType%
[/code]

hmm, i can´t get it to work, sorry. I testet the .cmd, & as a .bat, too. I had to change "FileType"=film to "FileType=filme", & "FileType=music" to "FileType=Music2", though. I added the {f}, like you said, & some DOS-boxes are seen for a split second, but somehow the files won´t be added.

For the cmd i chose the most simple text editor in windows, because i know that notepad will have that header, which will mess up batch files, so this shouldn´t be the reason. Does the script require admin rights (i have an XP here)?

this is the changed code from the .cmd

img35.imageshack.us/img35/805/batch.png

I'm running XP here too, and I do have admin rights but I don't think that's an issue. To debug it try using the following which should echo the important line to the DOS box. Post what that says and I'll see if I can figure out what's not working.

[code]@echo off
if "%~1" == "" exit

set FileType=
IF "%~x1" == ".mpeg" set FileType=filme
IF "%~x1" == ".avi" set FileType=filme

IF "%~x1" == ".mp3" set FileType=music2
IF "%~x1" == ".ape" set FileType=music2
IF "%~x1" == ".wav" set FileType=music2

if not defined FileType set FileType=USB
echo dopusrt /CMD Copy "%~1" TO coll://%FileType%
pause
[/code]

But no hurry though, for my Friday night pizza is just about ready and there is a football game coming on now (a guy has to have his priorities ya know. lol), so I'll check back in about 12 hours.

John, thanks a lot. I´m in no hurry. I´ll try that new button & post the outcome later, because i have almost similar plans (Pizza, yes, but i´m going to watch a movie :laughing: )

The result of the paused cmd is as follows, but it still doesn´t actually work, as i will explain later:

there ist a small problem with non-movie/music files, which are supposed to be added to coll://USB, but only coll:// is indicated as destination. Movies & music are added to their right locations, with the "pause" command i get even a progress bar displayed, claiming the items to be correctly added one by one, but actually they won´t. I also tried it logged in as admin, to no avail.

I think i found the culprit now, it´s not Opus or your script, but most likely the CIS (Comodo Firewall) messing it up somehow. It´s obviously having problems with the external Dopusrt.exe command, maybe being "overprotective". From inside Opus the commands do work (from the CLI), so this is obviously caused by the firewall, stopping external access. Maybe CIS is assuming, it´s some kind of "code injection", "hook" or otherwise undesirable action :imp:

I tried to allow program access between cmd.exe, Opus.exe & Opusrt.exe, as well as interprocess stuff, but no effect. Well, i posted the problem in Comodo´s forums, maybe they know how to solve this problem. At least i hope that, because this is a very interesting code.

I will report, as soon as there are some news.

Ok, I'm curious to hear what you find out.

Hmm, i´m not sure, if it´s really just the firewall. I suspect the part "if not defined FileType set FileType=USB " not to be executed correctly:

img38.imageshack.us/img38/6676/cmdh.png

The path for this file should be coll://US.
When choosing film or music, the paths are shown correctly, yet the copy doesn´t arrive. Maybe the said part is making problems? :confused:

I don't know why that line wouldn't be executed correctly but you can change it to the following which does the same thing.

if "%FileType%" == "" set FileType=USB

Sorry, that didn´t work either. A guy from the german forums couldn´t get it to run, when he tested it. Did you actually test in on you system? If so, then i wonder what the reason might be. Environment variables maybe?

Yes, the script works fine for me, it has with all versions of it. Try changing the last line in the script from this:

dopusrt /CMD Copy "%~1" TO coll://%FileType%

To this:

echo dopusrt /CMD Copy "%~1" TO coll://%FileType% pause

Make sure you do not have Runmode Hide turned on in the button, then select a few files and try it. The script should open a "DOS Box" window one at a time for each file selected, and it should display what command it is trying to send to Opus. If that looks good, then maybe you need to use the full path to dopusrt?