This should do what you're describing:
[Move;Copy] [file;files] to [Smooth jazz;Lounge;Elevator music;Grindcore] [overwrite;]Begin Text Compare : [{CMDSEGMENT:0}] Equals 'Move'
Set Boolean [~moveFile] to True
End Condition
Set Text [~targetPath] to 'C:\{CMDSEGMENT:3}\'
Begin Text Compare : [{CMDSEGMENT:4}] Equals 'overwrite'
Set Boolean [~forceOverwrite] to True
End Condition
Press Left Ctrl+C keys and hold for 0,06 seconds and release
Inline C# Function: Move or copy clipboard files
Where the inline C# function contains:
using System;
using System.Windows.Forms;
using System.IO;
public class VAInline
{
public void main()
{
string targetPathDir = @VA.GetText("~targetPath");
if (String.IsNullOrEmpty(targetPathDir))
{
VA.WriteToLog("Error: No target directory specified", "red");
return;
}
if (!Directory.Exists(targetPathDir))
{
VA.WriteToLog("Error: The specified target directory ('" + targetPathDir + "')does not exist", "red");
return;
}
if (!targetPathDir.EndsWith("\\"))
{
targetPathDir += "\\";
}
bool? moveFile = VA.GetBoolean("~moveFile");
bool? forceOverwrite = VA.GetBoolean("~forceOverwrite");
if (forceOverwrite == true)
{
VA.WriteToLog("Warning: Files will be overwritten without further notice", "orange");
}
int copyCount = 0;
int moveCount = 0;
System.Collections.Specialized.StringCollection returnList = null;
if (Clipboard.ContainsFileDropList())
{
returnList = Clipboard.GetFileDropList();
}
else
{
VA.WriteToLog("Error: No files in clipboard", "red");
return;
}
foreach (string i in returnList)
{
try
{
if (!File.Exists(i))
{
VA.WriteToLog("Error: The file '" + i + "' does not exist and was not moved","red");
continue;
}
string fileName = Path.GetFileName(i);
string targetPath = targetPathDir + fileName;
if (File.Exists(targetPath))
{
if (forceOverwrite == true && moveFile == true)
{
File.Delete(targetPath);
}
else
{
VA.WriteToLog("Error: The file '" + fileName + "' already exists in the target directory and was not " + ((moveFile == true) ? "moved" : "copied") ,"red");
continue;
}
}
if (moveFile != true)
{
File.Copy(i, targetPath);
copyCount++;
}
else
{
File.Move(i, targetPath);
if (File.Exists(i))
{
VA.WriteToLog("Warning: '" + i + "' still exists, check that it is not in use.", "red");
copyCount++;
}
else
{
moveCount++;
}
}
}
catch (Exception e)
{
VA.WriteToLog("The " + ((moveFile == true) ? "move" : "copy") + " operation failed: "+ e.Message, "red");
}
}
VA.WriteToLog("Operation complete" + ((moveCount != 0) ? ", " + moveCount + " files moved" : "") + ((copyCount != 0) ? ", " + copyCount + " files copied" : ""), "green");
Clipboard.Clear();
}
}
It'll copy the files you select to the clipboard, at which point the inline function will move or copy them to the specified directory.
Note that the target directory must exist, it will not be created for you(though you could add that feature if you want it).
In the example command,
Set Text [~targetPath] to 'C:\{CMDSEGMENT:2}\'
Will be set to whatever directory you speak from the command name.
E.G. "copy file to smooth jazz" would result in "C:\smooth jazz\".
You can replace "C:\" with a different path(and you'll probably want to), E.G.
Set Text [~targetPath] to 'D:\My Files\Music\{CMDSEGMENT:2}\'
There is a reasonable amount of(user
) error handling in the inline function, that should be verbose enough to find out what's going wrong if it does.