I thought I had, but it turns out I hadn't. Fixed now. Thanks.

On Friday, January 11, 2019 at 7:08:43 PM UTC-8, Mark S. wrote:
>
> With javascript macros you don't need $:/tags/Macro
>
> But you do need to set the module-type field to "macro". Did you do that?
>
> It worked fine when I tested it.
>
> Good luck
> -- Mark
>
> On Friday, January 11, 2019 at 6:27:44 PM UTC-8, Tiddly Novice wrote:
>>
>> I'm trying to use the javascript macro provided here: (
>> https://groups.google.com/d/msg/tiddlywiki/E3iJ0HDtPKk/RY5jsxeakncJ)
>>
>> The code for the Javascript seems to break the code formatting button for 
>> posting here. So here's the code without the code syntax button getting 
>> used:
>>
>> /*\
>> title: $:/_my/macros/setlowercase.js
>> type: application/javascript
>> module-type: macro
>>
>> Macro to set a text string to lower case
>> \*/
>> (function(){
>>
>> /*jslint node: true, browser: true */
>> /*global $tw: false */
>> "use strict";
>>
>> /*
>> Information about this macro
>> */
>> exports.name = "setlowercase";
>>
>> exports.params = [
>>      {name: "title"}
>> ];
>>
>> /*
>> Run the macro
>> */
>> exports.run = function(title) {
>>      return title.toLowerCase();
>> };
>>
>> })();
>>
>>
>> Here's the code for the tiddler I'm using to test it:
>>
>> \define setbutton()
>> <$button set="Test1!!somefield" setTo="$(setsort)$" >Set</$button>
>> \end
>> \define newone(ttext)
>> <$set name="setsort" value=<<setlowercase "$ttext$">> >
>> <<setbutton>>
>> </$set>
>> \end
>>
>> <<newone "This IS a TeSt">>
>>
>>
>> I put the javascript into its own javascript typed tiddler and tagged it 
>> with the $:/tags/Macros tag. I saved and reloaded.
>>
>>
>> But I can't seem to get the javascript to work. When I press the button, the 
>> target field ends up empty. What's going wrong?
>>
>>

-- 
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/00898290-5769-420e-8dc1-7c5cd6804b31%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to