specify editor variable as default value for 'url' parameter

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
Ron Van den Branden
Posts: 56
Joined: Fri Jan 18, 2008 5:54 pm

specify editor variable as default value for 'url' parameter

Post by Ron Van den Branden » Mon Oct 20, 2014 10:55 pm

Hi,

For some parameters in a transformation scenario I'm developing for a project, I'm gathering user input with the ${ask()} variable. In order to let the user select files, the ${ask()} variable of type 'url' seems quite convenient. However, I'm wondering whether it is possible to define a default value dynamically (preferably using another editor variable).

I've tried this:

Code: Select all

${ask('folder or file', url, ${cfdu})}
...in an attempt to define the current file URL as default value for this parameter. Yet, the ${cfdu} variable doesn't seem to be resolved; instead of the current file URL, just the literal text "${cfdu}" is pre-filled in the dialog window:

Image

Is there a way to define the default text for an 'url' parameter with editor variables?

Best,

Ron

Radu
Posts: 6708
Joined: Fri Jul 09, 2004 5:18 pm

Re: specify editor variable as default value for 'url' param

Post by Radu » Tue Oct 21, 2014 9:14 am

Hi Ron,

Usually the ask editor variables should be expanded after all other editor variables have been expanded. Unfortunately this does not happen for ANT or DITA parameters. We had a previous report about this and we'll work to fix the problem in Oxygen 17.0 which should be released in the Spring of 2015.
I will update this forum thread when this happens.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Ron Van den Branden
Posts: 56
Joined: Fri Jan 18, 2008 5:54 pm

Re: specify editor variable as default value for 'url' param

Post by Ron Van den Branden » Mon Jun 22, 2015 10:29 pm

Hi Radu,

I thought I had seen evaluation of ${ask()} variables mentioned in some changelogs for version 17.0, but when I tried to specify the project folder of an Oxygen Project as default folder in the ${ask()} variable (in the latest build 2015052917):

Code: Select all

${ask('folder or file', url, ${pdu})}
I noticed now that the default value is empty:

Image

Yet, when clicking the "browse" icon, the default location is not the project folder, but instead the folder of the currently opened file.

Does this mean this bug has not been fixed yet, or is this another bug related to using ${pdu} inside ${ask()}?

Best,

Ron

Ron Van den Branden
Posts: 56
Joined: Fri Jan 18, 2008 5:54 pm

Re: specify editor variable as default value for 'url' param

Post by Ron Van den Branden » Mon Jun 22, 2015 11:12 pm

Ah,

I stand corrected: it does seem to work in Oxygen 17.0. In my previous attempt I had forgotten to wrap the default value (including the ${pdu} variable) in quotation marks. This is the correct version:

Code: Select all

${ask('folder or file', url, '${pdu}')}
Now, the value of the project folder is filled in the "folder or file" dialog, and that folder is selected by default when the browse button is clicked.

For completeness, this issue seems to have been fixed in Oxygen 17.0; in Oxygen 16 the "folder or file" dialog shows the literal string "${pdu}" instead of the expanded value of that variable.

Apologies for the confusion, and thanks for the fix.

Best,

Ron

Radu
Posts: 6708
Joined: Fri Jul 09, 2004 5:18 pm

Re: specify editor variable as default value for 'url' param

Post by Radu » Tue Jun 23, 2015 8:34 am

Hi Ron,

Thanks for providing the solution for this. Sorry I did not update the forum thread after the fix was made.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply