Jump to content
UBot Underground

Insert Text function - 'Position To Insert Text' Problem..


Recommended Posts

I'm trying to make a bot which can take a 500 word article and put html code into it at various places..

 

I basically want it to insert the HTML code after either the first, second, third, fourth or fith full stop in every article. This should be chosen at random..

 

SO far I'm using the 'insert text' function and I'm not sure what to put in the 'position to insert text' box..

 

Would appreciate any help on this one :)

Link to post
Share on other sites
  • 4 weeks later...

I've made a bot which should insert a string of text into a block of text. I want it to insert the text after a random fullstop '.'

 

So far I've got this:

 

set(#blocktext - text from file

 

 

set(#blocktext, $insert text(#blocktext, ". {#stringtoinsert}", $find index(#blocktext, ".")), "Global")

 

This inserts my string after the FIRST fullstop in every block text..

 

However I want to randomize this and make it choose a random full stop to insert the string after.

 

After some hours of working on it I think a solution could be to return the indexes of all the full stops and then instruct ubot to choose a random position from these numbers to insert the string after..

 

Any ideas?

Link to post
Share on other sites

  1. You could build a list from your text, using the ". " sequence as a separator (assuming all your periods are followed by a space as it should normally be, except the last one, probably)
     
     
  2. Then, you can rebuild the text inserting anything you want in between the list items (randomizing that, as you wish, of course)

 

HTH

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...