Variable arguments in RunCommand

Hi I use VBScript and try to make a variable inside a Command. But I don't know how I tried a lot of different things... I want to change the conversion type between png and jpg with a radio button. Her is the important code:

.........
if Dlg.Control("jpg").value ="True" then
retType = "jpg"
else
retType = "png"
end if

clickData.Func.Command.RunCommand ("Image CONVERT=jpg")
.......

This works but I don't know how to make it dynamic.

I tried stuff like:
clickData.Func.Command.RunCommand ("Image CONVERT=&retType&")
clickData.Func.Command.RunCommand ("Image CONVERT="&"retType")

retType is a variable, to concatenate it to the string it needs to be outside the quotes. & is the vbscript string concatenation operator so that needs to be outside the quotes as well.

clickData.Func.Command.RunCommand ("Image CONVERT=" & retType)

1 Like

Thank you! It worked :slight_smile: