[tw] Re: automatic editing of tiddlers
Opa I was not aware that the return ends the scrip..now you point it out it seems so obvious !!! text.replace...I thought you were refering to a TW function and not the basic javascript guess I should go back to bed and try again tomorrowwhen my brain is fully engaged... thanks for your patience!!! Skye On 2 mar, 13:46, Eric Shulman wrote: > > var newtext=fullref+"|\n|Autor||\n|Editora||\n|Fonte|www|\n|Tipo|pdf|\n > > \n!!Comentarios\n"; > > return newtext; > > ^^^ WHY?!? (this *ends* the script *without saving the > tiddler*... *none* of the code that follows it will *ever* be invoked) > > > store.saveTiddler( tids[t].title, tids[t].title, newtext, > > tids[t].modifier, tids[t].modified,tids[t].tags, tids[t].fields); > > > > You mentioned I could use "text.replace(..)" ... I am not familiar > > with that function...how does it work...syntax... > > You are *already* using the .replace(...) function, here: > > var firstreplace=text.replace("< Link|"); > > Any decent online Javascript reference will have the full syntax and > usage. > > -e -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To post to this group, send email to tiddlywiki@googlegroups.com. To unsubscribe from this group, send email to tiddlywiki+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/tiddlywiki?hl=en.
[tw] Re: automatic editing of tiddlers
> var newtext=fullref+"|\n|Autor||\n|Editora||\n|Fonte|www|\n|Tipo|pdf|\n > \n!!Comentarios\n"; > return newtext; ^^^ WHY?!? (this *ends* the script *without saving the tiddler*... *none* of the code that follows it will *ever* be invoked) > store.saveTiddler( tids[t].title, tids[t].title, newtext, > tids[t].modifier, tids[t].modified,tids[t].tags, tids[t].fields); > > You mentioned I could use "text.replace(..)" ... I am not familiar > with that function...how does it work...syntax... You are *already* using the .replace(...) function, here: var firstreplace=text.replace("
[tw] Re: automatic editing of tiddlers
Hi Again Thanks Eric. so now I have var ref="???"; var tids=store.getMatchingTiddlers(ref); for (var t=0; t>"); var fullref=firstreplace.slice(0,endref); var newtext=fullref+"|\n|Autor||\n|Editora||\n|Fonte|www|\n|Tipo|pdf|\n \n!!Comentarios\n"; return newtext; store.saveTiddler( tids[t].title, tids[t].title, newtext, tids[t].modifier, tids[t].modified,tids[t].tags, tids[t].fields); autoSaveChanges(); story.displayTiddler(tids[t].title,null); } ..yes...in this case I am searching for tag "???" and only want to change the text..in my code I output newtext.and can see that the string manipulation of the original text is correctbut it is still not overwriting the new text.the tiddler still shows the original text...seems the store.saveTiddler part is not functioning...thats the part that I cant get right. You mentioned I could use "text.replace(..)" ... I am not familiar with that function...how does it work...syntax... Thanks Skye -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To post to this group, send email to tiddlywiki@googlegroups.com. To unsubscribe from this group, send email to tiddlywiki+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/tiddlywiki?hl=en.
[tw] Re: automatic editing of tiddlers
On Feb 29, 8:32 pm, skye riquelme wrote: > I am wanting to change the text in a large numer of tiddlersthey > follow a simple pattern and the editing of the text is quite straight > forward. But I cant get the script to make the changes to the original > tidller If you are just doing this on a one-time basis, you should be able to use http://www.TiddlyTools.com/#TiddlerTweakerPlugin which will let you select multiple tiddlers and then replace text, based on a *pattern*. However, if the purpose of your script is to generalize the process for repeated use, then we need to figure out what is wrong with the code. Let's take it a few lines at a time: >
[tw] Re: automatic editing of tiddlers
Open up the HTML file with your favorite code editor, or treat it as plaintext with your favorite regexp text-processing tools. On Thursday, March 1, 2012 11:32:17 AM UTC+7, skye riquelme wrote: > > Hi Again > > I am wanting to change the text in a large numer of tiddlersthey > follow a simple pattern and the editing of the text is quite straight > forward. But I cant get the script to make the changes to the original > tidller > > I have >