Jump to content

Working with FCKEditor in IE


Recommended Posts

Greetings fellow AU3 scripters!

After a long haitus of not using AutoIt that much, I finally have a project that it is of use to via AutoIt's IE.au3 library. This library makes working with the Web SOO much easier than using, say, urllib in Python if for the fact that I don't have to worry about getting any of the post data wrong. (And also how easy it is to manipulate the DOM... I am in love. LOL)

Anyway, I have hit a roadblock - I am trying to process a form and one of the elements is an FCKEditor instance in an IFrame. How would I go about submitting this form? I need to add some simple HTML to the FCKEditor instance.

You can demo FCKEditor at http://www.fckeditor.net/demo - just use firebug (you do use that don't you? Just kidding I know everybody uses IE >_<) and you will see it should be relatively simple to edit the inner HTML of the body tag inside the iFrame - am I correct with this thinking? How would I go about doing this?

Thanks!!

Link to comment
Share on other sites

Just off the top of my head you probably want to take a look at

_IEGetObjectByID()

_IEPropertyGet()

_IEPropertySet()

You can also take good look at _IEFormGetCollection() and _IEFormSubmit().

I would test these but I have other things to do right now. Dale will probably come along with a definitive answer later.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Thanks for the reply. I am already using these functions in my code, but I'm just not sure how to handle the iFrame... can I just edit the body of the iFrame just like any DOM element? I'll test that out in a bit.

Link to comment
Share on other sites

Thanks for the reply. I am already using these functions in my code, but I'm just not sure how to handle the iFrame... can I just edit the body of the iFrame just like any DOM element? I'll test that out in a bit.

Better to test it but I'm thinking that yes you can.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

It did not work at all.. I can't seem to edit the body HTML of the iframe. Any help?

Here is the code I am using to test.. the messagebox says "0" meaning there is an error (but where..?):

#include <ie.au3>
$subject = ''

$IE = _IECreate('http://community.mtv.com/profile/dandp/Messaging/Mail2.aspx?recipient=100EC20101C20E10000101C20E10')
$mailForm = _IEFormGetObjByName($IE, 'aspnetForm')
$subjectTxt = _IEFormElementGetObjByName($mailForm, 'ctl01$ctl00$ctl00$phBody$phBody$phBody$ucMessageControlsManager$ucEditMessage$tbSubject')
_IEFormElementSetValue($subjectTxt, $subject)
; For the message, we have to process it through FCK editor..
$fckFrame = _IEGetObjById($IE, 'ctl01_ctl00_ctl00_phBody_phBody_phBody_ucMessageControlsManager_ucEditMessage_cEditor___Frame')
$msgEditArea = _IEGetObjById($fckFrame, 'xEditingArea')
MsgBox(0, "", _IEBodyReadHTML($msgEditArea))
; Submit link
$submitLink = _IEGetObjById($IE, 'ctl01_ctl00_ctl00_phBody_phBody_phBody_ucMessageControlsManager_ucEditMessage_btnSend')

If anybody could simply relate some experience they have had with working with iFrames and AutoIt's IE library, I can finish this up.

Thanks again.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...