Tiny MCE editor and fill the field

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.

Moderators: Community Moderators, iMacros Moderators

Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

Re: Tiny MCE editor and fill the field

by Tom, Tech Support on Mon May 02, 2011 3:01 am

Hello green.pine,

It might have to do with the content in your !EXTRACT variable, for example, does it contain quote characters? This might be confusing the Javascript interpretation.

Can you post an example of your extracted text file?
Regards,

Tom, iMacros Support
Tom, Tech Support
 
Posts: 3298
Joined: Mon May 31, 2010 9:59 am

Re: Tiny MCE editor and fill the field

by wg@gregorigroup.com on Mon May 23, 2011 10:16 am

I'm having the same problem posting to the tiny_mce url.

It works fine for smaller html strings but large ones will not post properly. My guess is that we are over running the URL length. I'd be glad to send you my variable string if you'd like to test.

Thanks
wg@gregorigroup.com
 
Posts: 6
Joined: Mon May 23, 2011 7:15 am

Re: Tiny MCE editor and fill the field

by Tom, Tech Support on Tue May 24, 2011 12:36 pm

wg@gregorigroup.com wrote:I'm having the same problem posting to the tiny_mce url.

It works fine for smaller html strings but large ones will not post properly. My guess is that we are over running the URL length. I'd be glad to send you my variable string if you'd like to test.

Thanks
Please see my post here regarding reading the contents from a file.
Regards,

Tom, iMacros Support
Tom, Tech Support
 
Posts: 3298
Joined: Mon May 31, 2010 9:59 am

Re: Tiny MCE editor and fill the field

by Eagle on Fri Jun 03, 2011 5:44 am

To overcome the limitation of passing the text directly to JavaScript, which requires proper escaping and may be problematic with extracted texts, the following trick can be used:
  1. Create a temporary textarea with unique ID
  2. Let iMacros set the required text to this textarea
  3. Use JavaScript to read its content and send it to TinyMCE
  4. Destroy the temporary textarea

With a little JavaScript magic the necessary code can look something like this:
Code: Select all
URL GOTO=javascript:void(function(){var<SP>ta=document.createElement("textarea");ta.id="imacros2tinymce";document.body.appendChild(ta);}());
TAG POS=1 TYPE=TEXTAREA ATTR=ID:imacros2tinymce CONTENT=EDITOR_CONTENTS
URL GOTO=javascript:void(function(){var<SP>ta=document.getElementById('imacros2tinymce');tinyMCE.editors['EDITOR_NAME'].setContent(ta.value);document.body.removeChild(ta);}());

where EDITOR_NAME is name of the textarea the editor is associated with and EDITOR_CONTENTS is what you want to set the contents to.

The first line creates a temporary textarea with id "imacros2tinymce" and adds it to the page. On the second line iMacros fill this textarea with the required content. The third line takes this content, sends it to TinyMCE and destroys the temporary textarea. It's a pretty hacky solution, but it should do the trick...

Example macro:
Code: Select all
VERSION BUILD=7210419 RECORDER=FX
URL GOTO=http://tinymce.moxiecode.com/tryit/full.php
WAIT SECONDS=5
URL GOTO=javascript:void(function(){var<SP>ta=document.createElement("textarea");ta.id="imacros2tinymce";document.body.appendChild(ta);}());
TAG POS=1 TYPE=TEXTAREA ATTR=ID:imacros2tinymce CONTENT=My<SP>content<SP>filled<SP>by<SP><b>iMacros</b><SP>(now<SP>including<SP>quotes<SP>'<SP>"<SP>!)
URL GOTO=javascript:void(function(){var<SP>ta=document.getElementById('imacros2tinymce');tinyMCE.editors['content'].setContent(ta.value);document.body.removeChild(ta);}());

(should open the TinyMCE example page and after 5 seconds change the editor content to My content filled by iMacros (now including quotes ' " !))

Tested with iMacros for Firefox 7.2.1.0 in FF 3.6.17
Eagle
 
Posts: 2
Joined: Tue Feb 01, 2011 2:45 am

Re: Tiny MCE editor and fill the field

by Tom, Tech Support on Sat Jun 04, 2011 1:29 am

Brilliant! Thanks for the tip Eagle!
Regards,

Tom, iMacros Support
Tom, Tech Support
 
Posts: 3298
Joined: Mon May 31, 2010 9:59 am

Re: Tiny MCE editor and fill the field

by vicky on Wed Apr 11, 2012 7:12 pm

Can we fill this type of editor using this trick : Let me know if there is any expert, who can help on this type of text editor.

http://www.quikr.com/post-classifieds-ads
http://www.yolist.com/post-free-classified-ads


Thanks
Vicky
vicky
 
Posts: 23
Joined: Sat Apr 07, 2012 8:17 pm

Previous

Return to iMacros for Firefox

Who is online

Users browsing this forum: Bing [Bot] and 11 guests

-->