How do I enter trailing spaces with dlgstringS

Codes to display dialogs [Directory Opus Manual]

Trying to write a prepend entered text button.
which works but will not include trailing spaces. (unless explicity placed in the RENAME, which you might want sometimes but not other times, writing two separate buttons solves this)

@set text={dlgstringS|Please enter some text\nThen click OK}
@output:{$text} {=Len($text)=}

this just shows that trailing spaces are being removed.
Documentation does not mention trailing spaces.

@set will trim the output of the dialog. Add a character as protection and remove it in a second step:

@set text={dlgstringS|Please enter some text\nThen click OK}#
@output:{=">" + Left($text, Len($text) - 1) + "<"=}

Very clever - many thanks Alexander :slight_smile:

Having problems with the evaluator in RENAME

this works

@set text={dlgstringS|Please enter some text\nThen click OK}#
@output:{=Left($text, Len($text) - 1)=}

but this does not

@set text={dlgstringS|Please enter some text\nThen click OK}#
Rename PATTERN="*" TO {=Left($text, Len($text) - 1)=}* IGNOREEXT WHENEXISTS=rename

You need to set the quotes manually for Evaluator expressions.

appreciate the help but these do not work
Rename PATTERN="*" TO "{=Left($text, Len($text) - 1)=}"*
Rename PATTERN="*" TO "{=Left($text, Len($text) - 1)=}*"
Rename PATTERN="*" TO {"=Left($text, Len($text) - 1)="}*
Rename PATTERN="*" TO {="Left($text, Len($text) - 1)"=}*
Rename PATTERN="*" TO {=""" + Left($text, Len($text) - 1) + """=}*
Rename PATTERN="*" TO {="""Left($text, Len($text) - 1)"""=}*
any ideas ?

Ah, yes...

We also need to outsmart the Evaluator:

@set text={dlgstringS|Please enter some text\nThen click OK}#
Rename PATTERN="*" TO "{=Output(file); Left($text, Len($text) - 1)=}*" IGNOREEXT WHENEXISTS=rename

That works nicely, thanks again - not intuitive and the only penalty an unwanted log :thinking:

Use file instead of Output(file).

Adding @requires:f to the top of the function should work as an alternative to the Output() trick.

@requires:f doesn't work here.

Including file changes the execution order. Without it, the evaluator expression is computed before @set, resulting in an empty string.

Ah I understand now - different issue to what I assumed. We should be able to fix that.

1 Like