I have the following small piece of code, where mfcfg.exe is a config program for a mirroring application that awaits options in the following format:
mfcfg.exe -add sourcedir mirrordir backupdir
[code]@set prg="C:\Program Files\MirrorFolder\mfcfg.exe"
@set s="{filepath}"
@set dm="{destpath}{file} Mirror"
@set db="{destpath}{file} Backup"
CreateFolder {$dm}
CreateFolder {$db}
{$prg} -add {$s} {$dm} {$db}[/code]
This is applied to folder dropmenu, so when I drop "Folder1" somewhere, this script should create folder "Folder1 Mirror" and "Folder1 Backup" there, and set up a mirroring job for the application.
Now, when I drop "Folder1" into "Folder2", "Folder1 Mirror" and "Folder1 Backup" folders are created in "Folder2" but the mirroring job is not. It was very strange, so I attached this to the end of the script to see what exactly happens there:
cmd /c echo {$prg} -add {$s} {$dm} {$db} > {destpath}aha.txt
cmd /c echo {$s} >> {destpath}aha.txt
cmd /c echo {$dm} >> {destpath}aha.txt
cmd /c echo {$db} >> {destpath}aha.txt
The result was weird:
"C:\Program Files\MirrorFolder\mfcfg.exe" -add "{filepath}" "D:\[TEMP]\New Folder\Folder2\{file} Mirror" "D:\[TEMP]\New Folder\Folder2\{file} Backup"
"{filepath}"
"D:\[TEMP]\New Folder\Folder2\{file} Mirror"
"D:\[TEMP]\New Folder\Folder2\{file} Backup"
That's not what I expected. Some parts of the variables did expand while others did not and this could be the reason why the mirroring job is not set but it does not explain those folder put into {$dm} and {$dm} being where they should be. They should not be created either.
Why did Opus not fully expand the variables?
How could the folders be created from not fully expanded variables?
Did Opus further expand them for CreateFolder?
If it did, why did it not for the mfcfg.exe?

