I could give a sophisticated answer but really it's mostly because it's 
what I've seen in other people's code. Monkey see -- monkey code.

-- Mark

On Friday, August 10, 2018 at 12:39:41 PM UTC-7, Mohammad wrote:
>
> Mark one question:
> In both solution you proposed you put the filter and tiddler parameters 
> inside triple quotes when you pass them again to another macro or widget!
> Whats the reason?
>
> Mohammad
>
> On Friday, August 10, 2018 at 11:45:19 PM UTC+4:30, Mark S. wrote:
>>
>> If by "condition" you mean filter, then this works:
>>
>> \define if(filter,ifyes,ifno)
>> <$list filter="""$filter$ +[limit[1]]""" name=act emptyMessage=<<$ifno$
>> >>>
>> <<$ifyes$>>
>> </$list>
>> \end
>> \define ifyes() YES!
>> \define ifno() NO!
>>
>>
>> <<if "[title[GettingStarted]] +[has[title]]" ifyes ifno>>
>>
>> Well, it worked once ;-)  You would probably need to wrap this invocation 
>> in another macro in order to  pass the tiddler name as a parameter.
>>
>> I always prefer core-based solutions if possible over 3rd party 
>> solutions, since core-based solutions are more likely to stand the rigors 
>> of time.
>>
>> -- Mark
>>
>> On Friday, August 10, 2018 at 11:34:04 AM UTC-7, Mohammad wrote:
>>>
>>> Wow! 
>>> Thank you Mark!
>>> It works and do the job like a charm!
>>> For action command like create tiddler I call the macro using a button!
>>>
>>> Much appreciated!
>>>
>>> Mark, one more question is it possible to have a decision making 
>>> structure like below:
>>>
>>> If true-this
>>>  macro-action-if-part
>>> else
>>>   macro-action-else-part
>>> end if
>>>
>>> Then the header of macro should be something like 
>>> \define dcm(cond, ifpart-action, elsepart-action)
>>>
>>> For checking the condition parameter to see if true or false, the 
>>> setVars widget from Tobias Beer may be useful! If not we can first check 
>>> the condition outside the macro and send the result (true/false) to it.
>>>
>>>
>>> Cheers
>>> Mohammad
>>>
>>>
>>>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/e3aa3536-be91-4c32-94a8-0aefd8eba233%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to