Jump to content



Photo

Text Editor


  • Please log in to reply
8 replies to this topic

#1 joshiieeii

joshiieeii

    Adventurer

  • Active Members
  • PipPip
  • 137 posts

Posted 25 July 2006 - 01:37 AM

Outlook Signature Editor:

*Added features: Added LDAP properties for insertion

AutoIt         
#include <GUIConstants.au3> #include <File.au3> #include <GuiEdit.au3> #include <IE.au3> Dim $state Dim $current Dim $Edit Dim $ret Global _         $null, _         $file, _         $current         $s_html = "" $s_html &= "<HTML>" & @CRLF $s_html &= "<HEAD>" & @CRLF $s_html &= "<TITLE>_IE_Introduction ('basic')</TITLE>" & @CRLF $s_html &= "</HEAD>" & @CRLF $s_html &= "<BODY>" & @CRLF $s_html &= "<font face='Arial'>" & @CRLF $s_html &= "<table border=1 width=600 id='table1' cellspacing=6 cellpadding=6>" & @CRLF $s_html &= "<tr>" & @CRLF $s_html &= "<td>" & @CRLF $s_html &= "<h1>Welcome to IE.au3</font></h1>" & @CRLF $s_html &= "IE.au3 is a UDF (User Defined Function) library for the " & @CRLF $s_html &= "<a href='http://www.autoitscript.com'>AutoIt</a> scripting language." & @CRLF $s_html &= "<p>  " & @CRLF $s_html &= "IE.au3 allows you to either create or attach to an Internet Explorer browser and do " & @CRLF $s_html &= "just about anything you could do with it interactively with the mouse and " & @CRLF $s_html &= "keyboard, but do it through script." & @CRLF $s_html &= "<p>" & @CRLF $s_html &= "You can navigate to pages, click links, fill and submit forms etc. You can " & @CRLF $s_html &= "also do things you cannot do interactively like change or rewrite page " & @CRLF $s_html &= "content and Javascripts, read, parse and save page content and monitor and act " & @CRLF $s_html &= "upon browser 'events'.<p>" & @CRLF $s_html &= "IE.au3 uses the COM interface in AutoIt to interact with the Internet Explorer " & @CRLF $s_html &= "object model and the DOM (Document Object Model) supported by the browser." & @CRLF $s_html &= "<p>" & @CRLF $s_html &= "You can find much more information at the <a href='http://msdn1.microsoft.com/'>MSDN (Microsoft Developer Network)</a> " & @CRLF $s_html &= "website and more specifically for the " & @CRLF $s_html &= "<a href='http://search.msdn.microsoft.com/search/Redirect.aspx?title=InternetExplorer+Object+(Internet+Explorer+-+WebBrowser)" $s_html &= "&url=http://msdn.microsoft.com/workshop/browser/webbrowser/reference/objects/internetexplorer.asp'>Internet Explorer Object Model</a> and the " & @CRLF $s_html &= "<a href='http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/obj_document.asp'>Document Object Model</a>." & @CRLF $s_html &= "</td>" & @CRLF $s_html &= "</tr>" & @CRLF $s_html &= "</table>" & @CRLF $s_html &= "</font>" & @CRLF $s_html &= "</BODY>" & @CRLF $s_html &= "</HTML>" _IEErrorHandlerRegister() $oIE = _IECreateEmbedded() $state = _GUICtrlEditGetModify ($Edit) $GUItg = GUICreate("HTML Editor", 1230, 768, 190, 114) GUICtrlCreateObj($oIE, 605, 10, 630, 600) $Edit = GUICtrlCreateEdit("", 5, 10, 600, 600) $MenuItem1 = GUICtrlCreateMenu("&File") $menunew = GUICtrlCreateMenuitem("New", $MenuItem1) $menuopen = GUICtrlCreateMenuitem("Open", $MenuItem1) $menusave = GUICtrlCreateMenuitem("Save", $MenuItem1) $menusaveas = GUICtrlCreateMenuitem("Save As", $MenuItem1) $menuexit = GUICtrlCreateMenuitem("Exit", $MenuItem1) $MenuItem2 = GUICtrlCreateMenu("&Edit") $menuundo = GUICtrlCreateMenuitem("Undo", $MenuItem2) $menucopy = GUICtrlCreateMenuitem("Copy", $MenuItem2) $menucut = GUICtrlCreateMenuitem("Cut", $MenuItem2) $menupaste = GUICtrlCreateMenuitem("Paste", $MenuItem2) $menudelete = GUICtrlCreateMenuitem("Delete", $MenuItem2) $menuoptions = GUICtrlCreateMenu("&Options") $MenuItem3 = GUICtrlCreateMenu("&Insert") $menusalutation = GUICtrlCreateMenuitem("Salutation", $MenuItem3) $menufullname = GUICtrlCreateMenuitem("Full Name", $MenuItem3) $menudepartment = GUICtrlCreateMenuitem("Department", $MenuItem3) $menuofficenumber = GUICtrlCreateMenuitem("Office Number", $MenuItem3) $menumobilenumber = GUICtrlCreateMenuitem("Mobile Number", $MenuItem3) $menuemailaddress = GUICtrlCreateMenuitem("Email Address", $MenuItem3) $menustreetaddress = GUICtrlCreateMenuitem("Street Address", $MenuItem3) $menucity = GUICtrlCreateMenuitem("City", $MenuItem3) $menustate = GUICtrlCreateMenuitem("State", $MenuItem3) $menuzipcode = GUICtrlCreateMenuitem("Zipcode", $MenuItem3) $menucountry = GUICtrlCreateMenuitem("Country", $MenuItem3) $menudisclaimer = GUICtrlCreateMenuitem("Disclaimer", $MenuItem3) $menufirstname = GUICtrlCreateMenuitem("First Name", $MenuItem3) $menulastname = GUICtrlCreateMenuitem("Last Name", $MenuItem3) $menufaxnumber = GUICtrlCreateMenuitem("Fax Number", $MenuItem3) $MenuItem4 = GUICtrlCreateMenu("&About") $menuabout = GUICtrlCreateMenuitem("About", $MenuItem4) GUISetState() _IENavigate($oIE, "about:blank") GUICtrlSetData($Edit, $s_html) _Update() While 1 $msg = GUIGetMsg()        $state = _GUICtrlEditGetModify ($Edit)    If ($state <> $current) Then       If ($state == 0) Then             Else             _Update()       EndIf   EndIf     $ret = _GUICtrlEditCanUndo($Edit)     Select         Case $msg = $menuexit             Exit         Case $msg = $menusaveas             $file = FileSaveDialog("Choose a file to save", "", "All Files (*.*)", 16)             $path = _PathSplit($file, $null, $null, $null, $null)             If $path[4] = "" Then                 $file = $file & ".txt"                 _FileCreate($file)                 FileWrite($file, GUICtrlRead($Edit))                 _Update()             Else                 _FileCreate($file)                 FileWrite($file, GUICtrlRead($Edit))                 _Update()             EndIf         Case $msg = $menusave             If $file = "" Then                 $file = FileSaveDialog("Choose a file to save", "", "All Files (*.*)", 16)                 $path = _PathSplit($file, $null, $null, $null, $null)                 If $path[4] = "" Then                     $file = $file & ".txt"                     FileOpen($file, 2)                     _FileCreate($file)                     FileWrite($file, GUICtrlRead($Edit))                     _Update()                 Else                     _FileCreate($file)                     FileWrite($file, GUICtrlRead($Edit))                     _Update()                 EndIf             Else                 FileOpen($file, 2)                 FileWrite($file, GUICtrlRead($Edit))                 _Update()             EndIf         Case $msg = $menunew             GUICtrlSetData($Edit, "")             $file = ""         Case $msg = $menuopen             $file = FileOpenDialog("Open a file", "", "All Files (*.*)")             GUICtrlSetData($Edit, FileRead($file))             _Update()         Case $msg = $menusalutation             _GUICtrlEditReplaceSel ( $Edit, 1, "&lt;salutation&gt;")             _Update()         Case $msg = $menufullname             _GUICtrlEditReplaceSel ( $Edit, 1, "&lt;fullname&gt;")             _Update()         Case $msg = $menudepartment             _GUICtrlEditReplaceSel ( $Edit, 1, "&lt;department&gt;")             _Update()         Case $msg = $menuemailaddress             _GUICtrlEditReplaceSel ( $Edit, 1, "&lt;emailaddress&gt;")             _Update()         Case $msg = $menuofficenumber             _GUICtrlEditReplaceSel ( $Edit, 1, "&lt;officenumber&gt;")             _Update()         Case $msg = $menumobilenumber             _GUICtrlEditReplaceSel ( $Edit, 1, "&lt;mobilenumber&gt;")             _Update()         Case $msg = $menustreetaddress             _GUICtrlEditReplaceSel ( $Edit, 1, "&lt;streetaddress&gt;")             _Update()         Case $msg = $menucity             _GUICtrlEditReplaceSel ( $Edit, 1, "&lt;city&gt;")             _Update()         Case $msg = $menustate             _GUICtrlEditReplaceSel ( $Edit, 1, "&lt;state&gt;")             _Update()         Case $msg = $menuzipcode             _GUICtrlEditReplaceSel ( $Edit, 1, "&lt;zipcode&gt;")             _Update()         Case $msg = $menucountry             _GUICtrlEditReplaceSel ( $Edit, 1, "&lt;country&gt;")             _Update()         Case $msg = $menudisclaimer             _GUICtrlEditReplaceSel ( $Edit, 1, "&lt;disclaimer&gt;")             _Update()         Case $msg = $menufirstname             _GUICtrlEditReplaceSel ( $Edit, 1, "&lt;firstname&gt;")             _Update()         Case $msg = $menulastname             _GUICtrlEditReplaceSel ( $Edit, 1, "&lt;lastname&gt;")             _Update()         Case $msg = $menufaxnumber             _GUICtrlEditReplaceSel ( $Edit, 1, "&lt;faxnumber&gt;")             _Update()         Case $msg = $menuundo             If ($ret <> $current) Then                 If $ret == 0 Then                     MsgBox(0, "Error", "Nothing to Undo")                 Else                     _GUICtrlEditUndo($Edit)                     $ret = $current                 EndIf             EndIf         Case $msg = $GUI_EVENT_CLOSE             Exit     EndSelect WEnd Func Gui()     Select         Case $msg = $GUI_EVENT_CLOSE             Exit     EndSelect EndFunc   ;==>Gui Func _Update()         _IEBodyWriteHTML($oIE, GUICtrlRead($Edit)) EndFunc   ;==>_Update

Edited by joshiieeii, 25 July 2006 - 03:35 PM.








#2 big_daddy

big_daddy

  • Moderators
  • 2,499 posts

Posted 25 July 2006 - 05:35 AM

The code is horrible, but it does what you are wanting.

AutoIt         
#include <GUIConstants.au3> #include <File.au3> #include <GuiEdit.au3> #include <IE.au3> Global _         $null, _         $file, _         $current         $s_html = "" $s_html &= "<HTML>" & @CRLF $s_html &= "<HEAD>" & @CRLF $s_html &= "<TITLE>_IE_Introduction ('basic')</TITLE>" & @CRLF $s_html &= "</HEAD>" & @CRLF $s_html &= "<BODY>" & @CRLF $s_html &= "<font face='Arial'>" & @CRLF $s_html &= "<table border=1 width=600 id='table1' cellspacing=6 cellpadding=6>" & @CRLF $s_html &= "<tr>" & @CRLF $s_html &= "<td>" & @CRLF $s_html &= "<h1>Welcome to IE.au3</font></h1>" & @CRLF $s_html &= "IE.au3 is a UDF (User Defined Function) library for the " & @CRLF $s_html &= "<a href='http://www.autoitscript.com'>AutoIt</a> scripting language." & @CRLF $s_html &= "<p>  " & @CRLF $s_html &= "IE.au3 allows you to either create or attach to an Internet Explorer browser and do " & @CRLF $s_html &= "just about anything you could do with it interactively with the mouse and " & @CRLF $s_html &= "keyboard, but do it through script." & @CRLF $s_html &= "<p>" & @CRLF $s_html &= "You can navigate to pages, click links, fill and submit forms etc. You can " & @CRLF $s_html &= "also do things you cannot do interactively like change or rewrite page " & @CRLF $s_html &= "content and Javascripts, read, parse and save page content and monitor and act " & @CRLF $s_html &= "upon browser 'events'.<p>" & @CRLF $s_html &= "IE.au3 uses the COM interface in AutoIt to interact with the Internet Explorer " & @CRLF $s_html &= "object model and the DOM (Document Object Model) supported by the browser." & @CRLF $s_html &= "<p>" & @CRLF $s_html &= "You can find much more information at the <a href='http://msdn1.microsoft.com/'>MSDN (Microsoft Developer Network)</a> " & @CRLF $s_html &= "website and more specifically for the " & @CRLF $s_html &= "<a href='http://search.msdn.microsoft.com/search/Redirect.aspx?title=InternetExplorer+Object+(Internet+Explorer+-+WebBrowser)" $s_html &= "&url=http://msdn.microsoft.com/workshop/browser/webbrowser/reference/objects/internetexplorer.asp'>Internet Explorer Object Model</a> and the " & @CRLF $s_html &= "<a href='http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/obj_document.asp'>Document Object Model</a>." & @CRLF $s_html &= "</td>" & @CRLF $s_html &= "</tr>" & @CRLF $s_html &= "</table>" & @CRLF $s_html &= "</font>" & @CRLF $s_html &= "</BODY>" & @CRLF $s_html &= "</HTML>" _IEErrorHandlerRegister() $oIE = _IECreateEmbedded() $GUItg = GUICreate("HTML Editor", 800, 600, 190, 114) GUICtrlCreateObj($oIE, 10, 10, 780, 370) $Edit = GUICtrlCreateEdit("", 10, 390, 780, 180) $MenuItem1 = GUICtrlCreateMenu("&File") $menunew = GUICtrlCreateMenuitem("New", $MenuItem1) $menuopen = GUICtrlCreateMenuitem("Open", $MenuItem1) $menusave = GUICtrlCreateMenuitem("Save", $MenuItem1) $menusaveas = GUICtrlCreateMenuitem("Save As", $MenuItem1) $menuexit = GUICtrlCreateMenuitem("Exit", $MenuItem1) $MenuItem2 = GUICtrlCreateMenu("&Edit") $menuundo = GUICtrlCreateMenuitem("Undo", $MenuItem2) $menucopy = GUICtrlCreateMenuitem("Copy", $MenuItem2) $menucut = GUICtrlCreateMenuitem("Cut", $MenuItem2) $menupaste = GUICtrlCreateMenuitem("Paste", $MenuItem2) $menudelete = GUICtrlCreateMenuitem("Delete", $MenuItem2) $menuoptions = GUICtrlCreateMenu("&Options") $MenuItem3 = GUICtrlCreateMenu("&About") $menuabout = GUICtrlCreateMenuitem("About", $MenuItem3) GUISetState() _IENavigate($oIE, "about:blank") GUICtrlSetData($Edit, $s_html) While 1     $msg = GUIGetMsg()     Menu()     Gui()     _Update()     Sleep(10) WEnd Func Menu()     $ret = _GUICtrlEditCanUndo($Edit)     Select         Case $msg = $menuexit             Exit         Case $msg = $menusaveas             $file = FileSaveDialog("Choose a file to save", "", "All Files (*.*)", 16)             $path = _PathSplit($file, $null, $null, $null, $null)             If $path[4] = "" Then                 $file = $file & ".txt"                 _FileCreate($file)                 FileWrite($file, GUICtrlRead($Edit))             Else                 _FileCreate($file)                 FileWrite($file, GUICtrlRead($Edit))             EndIf         Case $msg = $menusave             If $file = "" Then                 $file = FileSaveDialog("Choose a file to save", "", "All Files (*.*)", 16)                 $path = _PathSplit($file, $null, $null, $null, $null)                 If $path[4] = "" Then                     $file = $file & ".txt"                     FileOpen($file, 2)                     _FileCreate($file)                     FileWrite($file, GUICtrlRead($Edit))                 Else                     _FileCreate($file)                     FileWrite($file, GUICtrlRead($Edit))                 EndIf             Else                 FileOpen($file, 2)                 FileWrite($file, GUICtrlRead($Edit))             EndIf         Case $msg = $menunew             GUICtrlSetData($Edit, "")             $file = ""         Case $msg = $menuopen             $file = FileOpenDialog("Open a file", "", "All Files (*.*)")             GUICtrlSetData($Edit, FileRead($file))         Case $msg = $menuabout             MsgBox(0, "About", "Testing")         Case $msg = $menuundo             If ($ret <> $current) Then                 If $ret == 0 Then                     MsgBox(0, "Error", "Nothing to Undo")                 Else                     _GUICtrlEditUndo($Edit)                     $ret = $current                 EndIf             EndIf     EndSelect EndFunc   ;==>Menu Func Gui()     Select         Case $msg = $GUI_EVENT_CLOSE             Exit     EndSelect EndFunc   ;==>Gui Func _Update()     _IEBodyWriteHTML($oIE, GUICtrlRead($Edit)) EndFunc   ;==>_Update

BD Scripting - My scripting repository.AutoIt Menu - Firefox extension with several links and tools for the AutoIt Forums!AutoIt Snippets Database - Store and share all your favorite snippets here! Welcome to AutoIt 1-2-3 - Great starting place for newcomers.Learning to Script with AutoIt - Another good starting place for newcomers.SciTE - The best AutoIt Script Editor. Posted Image

#3 joshiieeii

joshiieeii

    Adventurer

  • Active Members
  • PipPip
  • 137 posts

Posted 25 July 2006 - 01:29 PM

Awesome, Thanks Big Daddy!! **wait...that sounds kinda weird...lol :whistle:

*Edit: It's really cool that it's a real time HTML editor BTW..

Edited by joshiieeii, 25 July 2006 - 01:49 PM.


#4 big_daddy

big_daddy

  • Moderators
  • 2,499 posts

Posted 25 July 2006 - 01:58 PM

Awesome, Thanks Big Daddy!! **wait...that sounds kinda weird...lol :whistle:

*Edit: It's really cool that it's a real time HTML editor BTW..

Yeah I know, you had a good idea there. If and when I get some free time (our Exchange Server is down) I might try to add something like that to Vals IE Builder.
BD Scripting - My scripting repository.AutoIt Menu - Firefox extension with several links and tools for the AutoIt Forums!AutoIt Snippets Database - Store and share all your favorite snippets here! Welcome to AutoIt 1-2-3 - Great starting place for newcomers.Learning to Script with AutoIt - Another good starting place for newcomers.SciTE - The best AutoIt Script Editor. Posted Image

#5 joshiieeii

joshiieeii

    Adventurer

  • Active Members
  • PipPip
  • 137 posts

Posted 25 July 2006 - 02:10 PM

Well, I have another reason....I am trying to make a signature creator for my Outlook Project below....I have to be make an interface so that it is a bit easier to create the signature code. For instance, I have to relplace all the <,>,& with their rich text code for so that OWA can use it. I am attempting to automate this so I don't have to edit so much manually.

#6 joshiieeii

joshiieeii

    Adventurer

  • Active Members
  • PipPip
  • 137 posts

Posted 25 July 2006 - 03:34 PM

Updated first post

Code is kinda flaky, trying to get the Gui Event Close and Exitmenu to work correctly after you start editing something.

Edited by joshiieeii, 25 July 2006 - 03:36 PM.


#7 DaleHohm

DaleHohm

    Think of IE as an API...

  • MVPs
  • 5,889 posts

Posted 25 July 2006 - 03:44 PM

There are a large group of WYSIWYG editors listed here

Many are free Javascript, client side implementations that I have wanted to test out in integration with IE.au3 for some time but have not had the time to devote.

Take a look and see if any of them inspire you...

Dale
IE.au3 issues with Vista - Workarounds, Automate input type=file (Related)SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=YFree Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curlMSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model,Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbeddedFind and harvest Enum constants for COM codeAutoIt Snippets Database - you too can contribute!Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your troubleDoesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

#8 joshiieeii

joshiieeii

    Adventurer

  • Active Members
  • PipPip
  • 137 posts

Posted 25 July 2006 - 03:58 PM

There are a large group of WYSIWYG editors listed here

Many are free Javascript, client side implementations that I have wanted to test out in integration with IE.au3 for some time but have not had the time to devote.

Take a look and see if any of them inspire you...

Dale



Hmm... I am checking it out now, I will see what I can come up with. :whistle:

#9 joshiieeii

joshiieeii

    Adventurer

  • Active Members
  • PipPip
  • 137 posts

Posted 25 July 2006 - 04:25 PM

Ok, I found this ONE

Only thing is, I know squat about java script. Looking at possible integration with IE.au3 to resemble this editor

Edited by joshiieeii, 25 July 2006 - 04:43 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users