kjactive Posted July 3, 2005 Share Posted July 3, 2005 (edited) Here is a embedded activeX script to include the nice RichText component, needs RICHTX32.OCX in system32 but it's probably already there and activated else activate it in run with this command 'regsvr32 MSCOMCT2.OCX' RichText format is one of the formats that Office WinWord/Word can use but this control can also drop icons into it and save the contence as graphics - well a lot of options. A information page link is provided some information... expandcollapse popup; Author: Kåre Johansson ; AutoIt Version: 3.1.1.55 ; Description: Very Simple example: Embedding RICHTEXT object ; Needs: MSCOMCT2.OCX in system32 but it's probably already there ; Date: 3 jul 2005 #include <GUIConstants.au3> $oRP = ObjCreate("RICHTEXT.RichtextCtrl.1") GUICreate ( "Embedded RICHTEXT control Test", 320, 200, -1, -1,BitOr($WS_OVERLAPPEDWINDOW,$WS_VISIBLE,$WS_CLIPSIBLINGS)) $TagsPageC = GuiCtrlCreateLabel('Visit Tags Page', 5, 180, 100, 15, $SS_CENTER) GuiCtrlSetFont($TagsPageC,9,400,4) GuiCtrlSetColor($TagsPageC,0x0000ff) GuiCtrlSetCursor($TagsPageC,0) $AboutC = GUICtrlCreateButton('About',105,177,70,20) $PrefsC = GUICtrlCreateButton('FontSize',175,177,70,20) $StatC = GUICtrlCreateButton('Plain Style',245,177,70,20) $GUIActiveX = GUICtrlCreateObj( $oRP, 10, 10 , 400 , 260 ) GUICtrlSetPos($GUIActiveX,10,10,300,160) $LinkoRP = ObjEvent($oRP,"IEEvent_","FolderView"); this is a dummy event handle With $oRP; Object tag pool .OLEDrag() .SelBullet = True .text = "hello - Au3 supports ActiveX components like the RICHTEXT thanks to SvenP" & @CRLF & 'Try write some text and quit to reload' If FileExists("C:\RichText.rtf") Then .LoadFile("C:\RichText.rtf", 0) .Enabled = True .HideSelection = False .SaveFile("C:\RichText.rtf", 0 ) .SelStart = 0 .SelLength = StringLen(.Text) .SelFontSize = 14 .SelBold = True .SelItalic = True .SelUnderline = True EndWith GUISetState ();Show GUI While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE $oRP.SaveFile("C:\RichText.rtf", 0 ) ExitLoop Case $msg = $TagsPageC Run(@ComSpec & ' /c start http://www.officecomputertraining.com/vbtutorial/tutpages/page36.asp','', @SW_HIDE) Case $msg = $AboutC $oRP.AboutBox() Case $msg = $PrefsC $oRP.SelFontSize = 12 Case $msg = $StatC $oRP.SelBold = False $oRP.SelItalic = False $oRP.SelUnderline = False EndSelect WEnd $oRP = 0 GUIDelete () Exit I do like Autoit3 activeX support - there is that many strange controls or options to be included as one almost can't emagine... Application save contence as C:\RichText.rtf at every quit and reload at startup... kjactive Edited October 13, 2005 by kjactive Au3PP 4.1 - Autoit3 preprocessor, optimize speed, performance to scripts and do executes....[/url]Au3Calibur - Create libraries of commonly used code excerptsWords manipulate UDF, functions that is lent from the rexx language, topics and index file includedCustomDialog UDF to include custom made dialogs like a extended colorpick requester to scripts...[url="ftp://fritidshjemmet.com/Autoit3/SysColor.zip"]SysColor UDF a low level color library to manipulate RGB and Hex values...Shell32 UDF to Automate Windows® operating tasks from native dialog and Wizards browsers... Optimized the CodeWicard with options to generate browser code etc... Link to comment Share on other sites More sharing options...
SlimShady Posted October 11, 2005 Share Posted October 11, 2005 Too bad it crashes... Link to comment Share on other sites More sharing options...
layer Posted October 11, 2005 Share Posted October 11, 2005 (edited) It works... But the "font size" button didn't work for me. When I exited out, AutoIt crashed. Edited October 11, 2005 by layer FootbaG Link to comment Share on other sites More sharing options...
kjactive Posted October 12, 2005 Author Share Posted October 12, 2005 (edited) Fontsize do only change a selected text area and works alright. Regarded the Crash at exit I can see that I forgot to free the com obj at exit - Sorry, please change code... $oRP = 0 GUIDelete () Exit kjactive Edited October 12, 2005 by kjactive Au3PP 4.1 - Autoit3 preprocessor, optimize speed, performance to scripts and do executes....[/url]Au3Calibur - Create libraries of commonly used code excerptsWords manipulate UDF, functions that is lent from the rexx language, topics and index file includedCustomDialog UDF to include custom made dialogs like a extended colorpick requester to scripts...[url="ftp://fritidshjemmet.com/Autoit3/SysColor.zip"]SysColor UDF a low level color library to manipulate RGB and Hex values...Shell32 UDF to Automate Windows® operating tasks from native dialog and Wizards browsers... Optimized the CodeWicard with options to generate browser code etc... Link to comment Share on other sites More sharing options...
doucment Posted October 12, 2005 Share Posted October 12, 2005 Fontsize do only change a selected text area and works alright. Regarded the Crash at exit I can see that I forgot to free the com obj at exit - Sorry, please change code...$oRP = 0 GUIDelete () Exitkjactive crash Link to comment Share on other sites More sharing options...
SlimShady Posted October 12, 2005 Share Posted October 12, 2005 You should post a bug report, kjactive. GUICtrlDelete also does not work. Link to comment Share on other sites More sharing options...
ptrex Posted October 12, 2005 Share Posted October 12, 2005 To resolve the CRACH problem on exiting, you will have to do this change in the script. add this code instead of the GUIDelete () $oRP = "" $GUIActiveX = "" And remove the GUIDelete () Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Nuffilein805 Posted October 12, 2005 Share Posted October 12, 2005 this 1 is nice i'm just thinking about implementing it in a script i did, there just has to be some work done but i like it can you store the text as it is edited? my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
kjactive Posted October 12, 2005 Author Share Posted October 12, 2005 Well I do not get any crashes with this code, using the latest beta updates and you don't need to free the control ID $GUIActiveX... There could also be a conflick somewhere with the com object on your computer... kjactive Au3PP 4.1 - Autoit3 preprocessor, optimize speed, performance to scripts and do executes....[/url]Au3Calibur - Create libraries of commonly used code excerptsWords manipulate UDF, functions that is lent from the rexx language, topics and index file includedCustomDialog UDF to include custom made dialogs like a extended colorpick requester to scripts...[url="ftp://fritidshjemmet.com/Autoit3/SysColor.zip"]SysColor UDF a low level color library to manipulate RGB and Hex values...Shell32 UDF to Automate Windows® operating tasks from native dialog and Wizards browsers... Optimized the CodeWicard with options to generate browser code etc... Link to comment Share on other sites More sharing options...
Nuffilein805 Posted October 17, 2005 Share Posted October 17, 2005 Me again.I'm just trying to add some more options to your script but it seems as i'm having some problems.how can you add something like color or the font (e.g. times new roman)? i don't get it!1 more question: does someone see a possibility of storing the richtext in an inifile? maybe converting to something like that:original: this is my textstored in ini: this is /u/my/u/ textany ideas? i could use some help my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
Gene Posted January 16, 2006 Share Posted January 16, 2006 (edited) Me again.I'm just trying to add some more options to your script but it seems as i'm having some problems.how can you add something like color or the font (e.g. times new roman)? i don't get it!1 more question: does someone see a possibility of storing the richtext in an inifile? maybe converting to something like that:original: this is my textstored in ini: this is /u/my/u/ textany ideas? i could use some help @Nuffilein805First, create a document in WordPad using all the features you wish to have in the text you want to display using AutoIt and the mentioned .OCX file.Next, save it as an RTF file.Next, open that file in a text editor like Scite, Crimson, ore even Notepad if you are running Win2K or later.In the opened file you will see all the internal code required to display the file as you designed it. Give that example of the RTF file structure you should be able to assemble any message you wish to display in your GUI using the .OCX file and Kjactive's example. You should also view the file created by Kjactive's script and note any internal differences.@kjactive Please give a different URL for reference, the one in the original script and its base URL appear to go nowhere.GeneEdited a typos... Edited January 16, 2006 by Gene [font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right... Link to comment Share on other sites More sharing options...
randallc Posted January 16, 2006 Share Posted January 16, 2006 hi, i get no object here, even when I check the control OCX is there and registered?... any ideas? randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
Sokko Posted January 17, 2006 Share Posted January 17, 2006 I have the same problem as Randall. I have regsvr32'd both MSCOMCT2.OCX and RICHTX32.OCX, which has succeeded every time, and both are in my system32 directory. When I run the script, the ObjCreate statement fails (returns a zero), causing everything after it to crash and burn. Any ideas? Link to comment Share on other sites More sharing options...
randallc Posted January 17, 2006 Share Posted January 17, 2006 Hi, I found a "Quickbooks" forum where people were having trouble on WinXP Pro [not Home edition] and getting permissions right; , complicated registry entry solution which I won't be trying?... http://www.quickbooksgroup.com/webx/forums...@2.ppboaoo4b16@Best, Randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
SvenP Posted January 18, 2006 Share Posted January 18, 2006 kjactive,It is advisable always to place a if @error then .... after a ObjCreate() function. Objects are not always available on all computers/Operating Systems.@randallc & Sokko : To see a more descriptive error message about why ObjCreate() failed, you can add a COM ErrorHandler to the script. If you don't know how to do this, kjactive can show you. :-)I don't think the solution in that "Quickbooks" forum applies, because you did not get any error message while 'registering' the OCX with regsvr32.-Sven Link to comment Share on other sites More sharing options...
Sokko Posted January 18, 2006 Share Posted January 18, 2006 Okay, I figured out how to do the error-thing through the help file. On the line that does the ObjCreate, these values come up: $err.number = -2147221230 Hex($err.number,8) = 80040112 $err.windescription = "Class is not licensed for use" All other values are 0 except for $err.scriptline. I included the Hex'd value because that's what the help file did to it, so maybe it's more useful than the "raw" form. Otherwise I really have no idea what any of that stuff means. Help? Link to comment Share on other sites More sharing options...
Sokko Posted January 24, 2006 Share Posted January 24, 2006 Okay, I just had a thought after searching around for some time. Brief request for anyone that has actually gotten this control working: Could you look in the registry under HKCR\Licenses and see if there's a folder name that starts with 3B7C8860-D78F? If so, please post the data contained in it. This is just a guess at a solution, so any actual concrete fixes for this problem would still be appreciated. Link to comment Share on other sites More sharing options...
kjactive Posted January 25, 2006 Author Share Posted January 25, 2006 I did a search and came up with this result.. HKEY_CLASSES_ROOT\CLSID\{3B7C8860-D78F-101B-B9B5-04021C009402} standard: Microsoft Rich Textbox Control 6.0 (SP6) MiscStatus: 0 InprocServer32: Treading model: Apartment Progid: RICHTEXT.RichtextCtrl.1 typeLib: {3B7C8863-D78F-101B-B9B5-04021C009402} Version: 1.2 VersionIndependentProgID: RICHTEXT.RichtextCtrl kjactive Au3PP 4.1 - Autoit3 preprocessor, optimize speed, performance to scripts and do executes....[/url]Au3Calibur - Create libraries of commonly used code excerptsWords manipulate UDF, functions that is lent from the rexx language, topics and index file includedCustomDialog UDF to include custom made dialogs like a extended colorpick requester to scripts...[url="ftp://fritidshjemmet.com/Autoit3/SysColor.zip"]SysColor UDF a low level color library to manipulate RGB and Hex values...Shell32 UDF to Automate Windows® operating tasks from native dialog and Wizards browsers... Optimized the CodeWicard with options to generate browser code etc... Link to comment Share on other sites More sharing options...
Sokko Posted January 25, 2006 Share Posted January 25, 2006 I did a search and came up with this result..{3B7C8860-D78F-101B-B9B5-04021C009402}So when you look under HKCR\Licenses, is there a key there that matches this ID? It's the contents of that key that I would be interested in, if they exist (if not, this solution is going nowhere). Link to comment Share on other sites More sharing options...
kjactive Posted January 27, 2006 Author Share Posted January 27, 2006 (edited) No this CLSID do not exits at the licences address on my computers but elsewhere it does... kjactive Edited January 27, 2006 by kjactive Au3PP 4.1 - Autoit3 preprocessor, optimize speed, performance to scripts and do executes....[/url]Au3Calibur - Create libraries of commonly used code excerptsWords manipulate UDF, functions that is lent from the rexx language, topics and index file includedCustomDialog UDF to include custom made dialogs like a extended colorpick requester to scripts...[url="ftp://fritidshjemmet.com/Autoit3/SysColor.zip"]SysColor UDF a low level color library to manipulate RGB and Hex values...Shell32 UDF to Automate Windows® operating tasks from native dialog and Wizards browsers... Optimized the CodeWicard with options to generate browser code etc... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now