There isn't any conditional logic in Opus's command "language" (if you could call it that) at the moment. You have to pass the filenames and other details you want to work with to some kind of external script or program. (Batch file, VBScript, Perl, etc.)
From those scripts, if you want to execute Opus commands, you have to run them via
dopusrt.exe /cmd <command here>
There is a way to include the VBScript itself in the button, so you don't have to have the script in a separate file somewhere and can keep everything in one place in your Opus configuration. See this post: