Sign in to follow this  
Followers 0
cramaboule

TinyMCE embedded (and standalone) into AutoIt

4 posts in this topic

#1 ·  Posted (edited)

Hello all,

Just a small example on how I managed to get TinyMCE into AutoIt.

1. Download TinyMCE and unzip it. http://tinymce.moxiecode.com/download/download.php

2. Copy the HTML code to make the 'TinyMCE.html'

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">

<head>
<script type="text/javascript" src="tinymce/jscripts/tiny_mce/tiny_mce.js" ></script >
<script type="text/javascript">
tinyMCE.init({
        mode : "textareas",
        theme : "advanced",
        plugins : "emotions,spellchecker,advhr,insertdatetime,preview",

        // Theme options - button# indicated the row# only
        theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,|,justifyleft,justifycenter,justifyright,fontselect,fontsizeselect,formatselect",
        theme_advanced_buttons2 : "cut,copy,paste,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,|,code,preview,|,forecolor,backcolor",
        theme_advanced_buttons3 : "insertdate,inserttime,|,spellchecker,advhr,,removeformat,|,sub,sup,|,charmap,emotions",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location : "bottom",
        theme_advanced_resizing : true
});

function getText()
{
var y =  tinyMCE.get('content').getContent();
window.clipboardData.setData('Text',y)
//alert(y);
}
</script>
</head>
<body>
        <form name="test" METHOD="POST">
        <textarea name="content" cols="50" rows="15" >
        This is some content that will be editable with TinyMCE.
        </textarea>
        </form>
        <input name="123" id="123" type="submit" value="123" onclick="getText()">
</body>

3. Copy the au3 code

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <IE.au3>

$oIE =_IECreateEmbedded ()
Global $infos

GUICreate("test", 500, 500)


GUICtrlCreateObj($oIE, 2, 5, 495, 450)

$button=GUICtrlCreateButton("validate", 2,460,80,30)

Global $Button_Next= GUICtrlCreateButton("Ok",500,620,100,40)
GUISetState()
_IENavigate($oIE, "C:\testau3\TinyMCE.html")

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $button
            $obutt = _IEGetObjByName($oIE, "123")
            _IEAction($obutt ,"click")
            Sleep(5)
            $clipboard=ClipGet()
            MsgBox(0,"", $clipboard)
    EndSelect
WEnd

Exit

4. Change the path in the html file according to your folder you unzipped TinyMCE.

<script type="text/javascript" src="tinymce/jscripts/tiny_mce/tiny_mce.js" ></script >

5. Change the path in the au3 file according to your folder where your 'TinyMCE.html' is.

_IENavigate($oIE, "C:\testau3\TinyMCE.html")

That's it !!!

Posted Image

Edit: add picture

Edited by cramaboule

Share this post


Link to post
Share on other sites



oh wow, got a project that was missing this little magic trick!!

Thanks for sharing!

Share this post


Link to post
Share on other sites

No Problem, hench !

I know, it is a bit wired to copy paste into the clipboard... but that's the only way to do it easily !

Cramaboule :x

Share this post


Link to post
Share on other sites

Hehe, I don't mind the copypasting, it keeps the reflexes up and running :x

Bonne année, et vive la Suisse!

hench

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0