From 383032b7d2b54a9385241f0dfdad47e0bc5af1e0 Mon Sep 17 00:00:00 2001 From: yuanho Date: Thu, 14 Nov 2024 14:19:19 -0700 Subject: [PATCH] added macro to read Optional Args --- src/ucar/unidata/idv/ui/ImageGenerator.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ucar/unidata/idv/ui/ImageGenerator.java b/src/ucar/unidata/idv/ui/ImageGenerator.java index d39ee3ae1..255b7491a 100755 --- a/src/ucar/unidata/idv/ui/ImageGenerator.java +++ b/src/ucar/unidata/idv/ui/ImageGenerator.java @@ -3984,7 +3984,15 @@ private String applyMacros(String s, Hashtable props, boolean doTime) { s = StringUtil.applyMacros(s, getStateManager().getProperties(), false); if (s.indexOf("${") >= 0) { - throw new BadIslException("Undefined macro in: " + s); + Hashtable optionArgs = getIdv().getArgsManager().getOptionalArgs(); + if(optionArgs.size() > 0){ + s = StringUtil.applyMacros(s, optionArgs, + false); + if(s.indexOf("${") >= 0) { + throw new BadIslException("Undefined macro in: " + s); + } + } else + throw new BadIslException("Undefined macro in: " + s); } if (s.startsWith("jython:")) {