I think I must be doing something wrong here, but trying to follow examples in DOpus Help in writing a custom batch command to convert a selected PDF to PNG using MuPDF:mutool, whether or not the PDF requires a password. My code so far:
@filesonly
@nofilenamequoting
@leavedoswindowopen
@set pwd={dlgpassword|Password?\n(Press CANCEL if none)}
@if:$pwd
"C:\Portable Apps\MuPDF\mutool" draw -p $pwd -o "{file$|noext} - %%d.png" -r 300 -c rgb "{file$}"
@if:else
"C:\Portable Apps\MuPDF\mutool" draw -o "{file$|noext} - %%d.png" -r 300 -c rgb "{file$}"
I figured that:
-
If I enter a password in the dialog and select the OK button, then
$pwd
would be set and my command line immediately following@if:$pwd
would execute; -
If I select the CANCEL button in the password dialog, then
$pwd
would NOT be set, and my command line immediately following@if:else
would execute
…But neither command line executes. A command prompt window doesn’t even get opened.
If I scale back my code to just this and use it on a password-protect PDF:
@filesonly
@nofilenamequoting
@leavedoswindowopen
@set pwd={dlgpassword|Password?\n(Press CANCEL if none)}
"C:\Portable Apps\MuPDF\mutool" draw -p $pwd -o "{file$|noext} - %%d.png" -r 300 -c rgb "{file$}"
…I get error message cannot authenticate password
from mutool. Also tried quoting schemes for my @set
invocation:
@set "pwd={dlgpassword|Password?\n(Press CANCEL if none)}"
@set pwd="{dlgpassword|Password?\n(Press CANCEL if none)}"
Same error message received. But this works, on password-protected files:
@filesonly
@nofilenamequoting
@leavedoswindowopen
"C:\Portable Apps\MuPDF\mutool" draw -p {dlgpassword|Password?\n(Press CANCEL if none)} -o "{file$|noext} - %%d.png" -r 300 -c rgb "{file$}"
And this works, on NON-password-protected files:
@filesonly
@nofilenamequoting
@leavedoswindowopen
"C:\Portable Apps\MuPDF\mutool" draw -o "{file$|noext} - %%d.png" -r 300 -c rgb "{file$}"
Am I doing something wrong with @set
and @if
?