On Friday, September 11, 2020 at 4:14:44 AM UTC-7, Bob Jansen wrote:
>
> The task is to create a tiddler storing in a field a string, for example, 
> ArtworkImages/BJ007.jpg, where the number is an incremental number and the 
> text comes from various tiddlers, eg. $:/TLS/imagefoldername,  so it can be 
> altered as required..
> The problem is passing the values of artwork_url and artwork_id into the 
> new tiddler.
>
The values stored are: artwork_id is <<idcode>><<incremental>> and 
> artwork_url is <<foldername>><<idcode>><<incremental>><<imagecode>> instead 
> of their values.
> However, displaying the values of the variables  for debugging purposes 
> gives: ...
>
> These values are as they should be but they are not carried across into 
> the action-createtiddler widget. 
>
 
Macros do ONLY two kinds of processing:
1) Replace any instances of $arg$ passed in
2) Replace any instances of $(variable)$ that are defined *outside* the 
macro

*Everything else contained inside a macro is returned exactly as defined 
within the macro.*  It is up to the "calling context" to process the 
returned macro content.

When you write:
\define artworkurl() <<foldername>><<idcode>><<incremental>><<imagecode>>
\define uniqueid() <<idcode>><<incremental>>
The results are to simply return the macro's contents as shown.  The 
variables references inside the macros are not automatically converted to 
their values.

If you then *display* the results of the macro, the "<<variablename>>" 
syntax is automatically "wikified" to render the value stored in the 
variable.
However, when you use the results of the macro as a *parameter* in a 
$widget, the macro results are passed to the $widget "as-is" without 
further processing.

The easiest way to make your code work (assuming no other problems) is to 
change these two macros, like this:
\define artworkurl() $(foldername)$$(idcode)$$(incremental)$$(imagecode)$
\define uniqueid() $(idcode)$$(incremental)$
By doing this, the content returned from those macros WILL be the *values* 
of the variables, not the references to the variables.

-e

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/23da8137-8fd3-4df6-bcd6-38040bee6544o%40googlegroups.com.

Reply via email to