Jump to content

Recommended Posts

Posted

Killing 2 birds with one stone, hoping someone might check the getTextArea_onclick() function to see why the Com warnings, I,ve uploaded the full script as zip which includes the au3 script and wysiwyg editor.

Also I think its a nice example script wysiwyg.zip

--> COM Error Encountered in wysiwyg.au3

----> $IEComErrorScriptline =

----> $IEComErrorNumberHex = 00000000

----> $IEComErrorNumber =

----> $IEComErrorWinDescription =

----> $IEComErrorDescription =

----> $IEComErrorSource =

----> $IEComErrorHelpFile =

----> $IEComErrorHelpContext =

----> $IEComErrorLastDllError =

#include <GUIConstants.au3>
#include <IE.au3>
#include <Array.au3>

_IEErrorHandlerRegister ()
$oIE = _IECreateEmbedded ()
$oIE2 = _IECreateEmbedded ()
Dim $temp2
Global $Openfile
Dim $Editor=@ScriptDir & "\res\editor\demo2.html"
Dim $projectsDirectory = @ScriptDir & "\Projects"
Dim $temphtml
$gui=GUICreate("Wysiwyg", 680, 580, (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, 300, 470)
$GUIActiveX2 = GUICtrlCreateObj($oIE2, 350, 110, 300, 400)
_IENavigate ($oIE2, "about:blank")


GUISetState()       ;Show GUI

 _IENavigate ($oIE, $Editor)

$SaveButton = _IEGetObjByName ($oIE, "_yourFieldNameHere2_save")
$oEvent1 = ObjEvent( $SaveButton, "saveButton_")

$OpenButton = _IEGetObjByName ($oIE, "_yourFieldNameHere2_open");_yourFieldNameHere2_Open
$oEvent2 = ObjEvent( $OpenButton, "openButton_")

$PreviewButton = _IEGetObjByName ($oIE, "_yourFieldNameHere2_popupeditor")
$getTextareaValue=ObjEvent( $PreviewButton, "getTextArea_")
; Waiting for user to close the window
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        
    EndSelect
WEnd

GUIDelete()

Exit

Func getTextArea_onclick()
$htmlSourceButton=_IEGetObjByName ($oIE, "bButton") 

If Not IsObj($htmlSourceButton) Then 
    MsgBox(0,"","Sorry, Error")
    Return
    EndIf

_IEAction ($htmlSourceButton, "click")
_IELoadWait ($oIE)

$iHTML = _IEGetObjByName ($oIE, "tHTML") 
$temp2 = _IEPropertyGet($iHTML,"innerhtml")

if Not $temp2 > 0 then Return
$temphtml = ""  
$temphtml  = "<HTML>"  & @CR
$temphtml &= "<HEAD>"  & @CR
$temphtml &= "<TITLE></TITLE>" & @CR
$temphtml &= "</HEAD>"  & @CR
$temphtml &= "<BODY style=""border:0px;margin:0px;"" scroll=""no"">" & @CR
$temphtml &= $temp2 & @CR
$temphtml &= "</BODY>"  & @CR
$temphtml &= "</HTML>"  & @CR

_IEDocWriteHTML ($oIE2, $temphtml)
_IEAction ($oIE2, "refresh")
MsgBox(0,"","look at the console warnings, whats up here?")
EndFunc



Func saveButton_onclick()
MsgBox(0,"Save", "You clicked save")
;;to be 
Return
EndFunc

Func openButton_onclick()
    $Openfile = FileOpenDialog("Open Project",$projectsDirectory, "Projects (*.htm;*.html)")
    $file = FileOpen($Openfile, 0)
    If $file = -1 Then
        MsgBox(0, "Error", "Unable to open file.")
        Return 
    EndIf
    
    $html = FileRead($file)
    FileClose($file)
$htmlSourceButton=_IEGetObjByName ($oIE, "_yourFieldNameHere2_HtmlMode")    ;_yourFieldNameHere2_HtmlMode
_IEAction ($htmlSourceButton, "click")
_IELoadWait ($oIE)
$textarea = _IEGetObjByName ($oIE, "_yourFieldNameHere2_editor");yourFieldNameHere2

If IsObj($textarea) Then _IEFormElementSetValue ($textarea, $html) ;MsgBox(0,"",$textarea)
_IEAction ($htmlSourceButton, "click")

EndFunc
  • 2 weeks later...
Posted

Hey there, you left me a post at my WYSIWYAF thread. I really like what you have done here and it looks like something I might use down the road. You asked about the difference in my script and the main difference is that I am interested in getting the html code as the final result. I am a long way from there, but this may be something that I turn into a large project.

Sorry that I can't help you with your errors, troubleshooting is my weak point. Trial and error is where I am good....lol. :whistle:

Good luck!

Posted

You asked about the difference in my script and the main difference is that I am interested in getting the html code as the final result.

Hi, lol, still not sure what that term means WYSIWYAF (WTFISTHAT) :whistle:.But the html is written to the second IE window from basically the wysiwig textarea source code.

This happens when I made a Web Site Blocker. Basically, it thinks it has an error with IE.au3 but it doesn't affect anything. I think DaleHolm made a console error detector but it wont actually affect anything.

I maybe wrong but thats what I gather.

Thanx, I'll try ignore it,its annoying though thinking it maybe an error.

Thanx all for trying the script.

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
  • Recently Browsing   0 members

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