I have an answer, but almost certainly it isn't the answer you are looking for.
I'll be disappointed if I don't see a better answer to this posted tomorrow morning.
My answer is this:[ul]1) write a batch file external to the the button.
In other words write a file named If-Then.bat.
If %1 == " " SET /P test1= Enter Test1
If Not %1 == " " SET /P test2= Enter Test2
2) Make a button using MS-DOS Batch function.
Call If-Then.bat {f}
pause[/ul]
This doesn't use {RS}, it prompts for a string at the command line.
The string entered is then %test1% or %test2%.
Not quite what you wanted, but it does solve the problem you posted.
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:
Dear Zippo & Leo, thank you very much for your replies. Your ideas help me to solve my problem
@Zippo
Your code gave me an idea to use a Function instead of external BAT file. I don't know why I was not thinking about a function before your favor .
@Leo
Your suggestion about using dopusrt.exe in a VBScript code was the base of my solution as always
Rename scripts were not useful for my aim, because they are triggered just when a file is selected, but I want to execute a task if a file/dirs is selected and execute another task if any file/dir is not selected. After combining Zippo and Leo suggestions, I lead to the following solution:
I create a new Script function called "test" with following code. The function have a template command named strFileName:
[code] @script vbscript
Option Explicit
Dim strDOpusrt
strDOpusrt = "C:\Program Files\GPSoftware\Directory Opus\DOpusRT.exe"
Dim Shell
Set Shell = CreateObject("WScript.Shell")
[quote="searcher123"] @nofilenamequoting
test "{f!}"
[/quote]
You could simplify that to this, if you want:
test {f!}
If it's a standard function then nothing much as those aren't recognised Opus commands and aren't (usually) recognised programs in the path, either. (i.e. there is no IF.exe, ELSE.exe, THEN.exe.)
If it's an MS-DOS function then it could cause all sorts of weird behaviour, unless you are careful not to use any Opus commands. If you mix Opus and non-Opus commands in an MS-DOS function then the function is split into several batch files which can cause the IF/THEN/ELSE logic to go haywire. Best to use an actual batch (or script) file in those cases.
All I was saying is that these two commands are equivalent:
@nofilenamequoting
test "{f!}"
test {f!}
Opus will automatically add the quotes around the path which {f!} emits, if the path contains a space and needs quoting.
I suppose there is a difference. If nothing is selected then the first example will run
test ""
while the second will run
test
Whether those two produce different results is up to test. It's more common for things to check the number or arguments passed than to check for empty arguments, so I didn't consider that difference before.
By the way, if you don't want the button to do anything if nothing is selected, use {f} instead of {f!}. The former needs a selection and will prevent the button from running if there isn't one; the latter wants a selection and will pass nothing if there isn't one.