Kip Posted September 2, 2008 Posted September 2, 2008 (edited) Hi,I composed this UDF while I was working on a project for James. Basicly because there were no UDF containing all functions.So I took some functions from every corner of this forum, created some myself, and... Tadaaa!Functions: (quite a view)RichText_Create(ByRef $h_Gui, $x, $y, $width, $height, $v_styles = $DEFAULT_RICHTEXT_STYLE, $v_exstyles = $WS_EX_CLIENTEDGE) RichText_SetText($hRichText, $s_Text = "") RichText_InsertText($hRichText, $s_Text = "") RichText_AppendText($hRichText, $s_Text = "") RichText_GetText($hRichText, $Method=$RICHTEXT_ALL) RichText_GetLine($hRichText) RichText_GetSel($hRichText) RichText_SetSel($hRichText, $i_start, $i_end) RichText_GetLineCount($hRichText) RichText_GetLenght($hRichText) RichText_LineIndex($hRichText, $i_line = -1) RichText_LineLength($hRichText, $i_index = -1) RichText_Limit($hRichText, $hLimitTo) RichText_BkColor($hRichText, $iColor) RichText_GetFirstVisibleLine($hRichText) RichText_PosFromChar($hRichText, $iIndex) RichText_SetBkColor($hRichText, $hColor, $iSelec = True) RichText_SetBold($hRichText, $hBold = False, $iSelec = 0x01) RichText_SetColor($hRichText, $hColor, $iSelec = True) RichText_SetFontSize($hRichText, $Size , $iSelec = True) RichText_SetStrikeOut($hRichText, $hBold = False, $iSelec = 0x01) RichText_SetEventMask($hRichText, $hFunction) RichText_SetFont($hRichText, $hFontName, $iSelec = True) RichText_SetItalic($hRichText, $hBold = False, $iSelec = 0x01) RichText_SetReadOnly($hRichText $hBool = True) RichText_SetUnderline($hRichText, $hBold = False, $iSelec = 0x01) RichText_Undo($hRichText) RichText_SetTabStops($hRichText, $aTabStops) RichText_HideSelection($hRichText, $iState=True) RichText_PauseRedraw($hRichText) RichText_ResumeRedraw($hRichText) RichText_SetFormat($hRichText, $dwMask, $yHeight = 8, $yOffset = 0, _$crTextColor = 16711680, $bCharSet = 0, $bPitchAndFamily = 0, $szFaceName = "Sans Serif", _$wWeight = 400, $crBackColor = -1, $Underline = 0, $bUnderlineType = 0)Above each function is the name of the author. If there isn't any: It's mine. Example: (Simple, but I like simple)#Include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <GuiRichEdit.au3> $GUI = GUICreate("bye",700,500) $hRichText = RichText_Create($GUI, 0, 0, 700, 500) RichText_InsertText($hRichText, "Hello everybody") GUISetState() RichText_SetSel($hRichText, 6, 11); Pos 6 to 11 is 'every' RichText_SetColor($hRichText, 0x0000FF, True); True = colorize selection, False = colorize all. !!! Color codes is BGR !!! RichText_SetSel($hRichText, 0, 0); Set the selection to 0-0 While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit WEndNow, dont let me hear anyone complain about how to create richtext controls! GuiRichEdit.au3 Edited September 2, 2008 by Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
James Posted September 2, 2008 Posted September 2, 2008 Working with not for Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Kip Posted September 2, 2008 Author Posted September 2, 2008 (edited) I composed this UDF while I was working on a project for James.I have on. Dont know if that's what you meant. Edited September 2, 2008 by Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
WeMartiansAreFriendly Posted September 2, 2008 Posted September 2, 2008 Very nice, looking forward to this one. Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()
JavaScript_Freek Posted September 2, 2008 Posted September 2, 2008 Line 32givesmeanerror. [center]Cookyx.com :: Simple LAN Chat[/center]
Zedna Posted September 2, 2008 Posted September 2, 2008 (edited) Nice collection!Look here: http://www.autoitscript.com/forum/index.php?showtopic=79431&hl= ://http://www.autoitscript.com/forum/i...=79431&hl= ://http://www.autoitscript.com/forum/i...=79431&hl= There is Win9x compatibilty code:If FileExists(@SystemDir & "\Msftedit.dll") Then $dll = DllOpen("MSFTEDIT.DLL") $sRTFClassName = "RichEdit50W" Else $dll = DllOpen("RICHED20.DLL") $sRTFClassName = "RichEdit20A" EndIfWith this little addition it works also on older Win9x systems. Edited September 2, 2008 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
Kip Posted September 3, 2008 Author Posted September 3, 2008 (edited) $sRTFClassName = "RichEdit50W"$sRTFClassName = "RichEdit20A"Don't you think it should be RichEdit50A? A is ansii and W is unicode.Thanks anyway. I'll add it. Edited September 3, 2008 by Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
Kip Posted September 3, 2008 Author Posted September 3, 2008 (edited) Zedna, your code doesnt work. I changed it to: If not FileExists(@SystemDir & "\RichEd20.dll") Thenand that works fine. From MSDN: Win 95 : Rich Edit 1.0 (Riched32.dll) Win 98 : Rich Edit 1.0 (Riched32.dll) and 2.0 (Riched20.dll) Win 2000 : Rich Edit 1.0 (Riched32.dll) and 3.0 (Riched20.dll) Win ME : Rich Edit 1.0 (Riched32.dll) and 3.0 (Riched20.dll) Win XP : Rich Edit 1.0 (Riched32.dll) and 3.0 (Riched20.dll) Win XP SP1+: Rich Edit 1.0 (Riched32.dll) and 3.0 (Riched20.dll) and 4.1 (Msftedit.dll) Win Vista : Rich Edit 1.0 (Riched32.dll) and 3.0 (Riched20.dll) and 4.1 (Msftedit.dll) All windows versions (except 95) have Riched20.dll. That means that Javascript_Freek eather has Win 95 or has deleted RichEd20.dll, right? Edited September 3, 2008 by Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
Zedna Posted September 3, 2008 Posted September 3, 2008 (edited) Here are some my older posts where I added this (similar) Win9x workaround:http://www.autoitscript.com/forum/index.ph...st&p=422230http://www.autoitscript.com/forum/index.ph...st&p=400217If @OSTYPE = "WIN32_WINDOWS" Then; 95/98/Me DllOpen("RICHED20.DLL") $RTFClassName = "RichEdit20A" Else; NT/2000/XP/2003/Vista DllOpen("MSFTEDIT.DLL") $RTFClassName = "RichEdit50W" EndIfThis was working fine on WIN98 and also on WINXP Edited September 3, 2008 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
Kip Posted September 3, 2008 Author Posted September 3, 2008 Else; NT/2000/XP/2003/Vista DllOpen("MSFTEDIT.DLL") $RTFClassName = "RichEdit50W"EndIfNT, 2000 and the first version of XP dont have Msftedit.dll MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
ptrex Posted September 3, 2008 Posted September 3, 2008 @Kip very nice !! You stealing the show lately. Regards ptrex 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
Kip Posted September 3, 2008 Author Posted September 3, 2008 (edited) Just wait for my next UDF Edited September 3, 2008 by Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
Zedna Posted September 3, 2008 Posted September 3, 2008 Maybe this one: $dll = DllOpen("MSFTEDIT.DLL") If Not @error Then $sRTFClassName = "RichEdit50W" Else $dll = DllOpen("RICHED20.DLL") $sRTFClassName = "RichEdit20A" EndIf Resources UDF ResourcesEx UDF AutoIt Forum Search
SxyfrG Posted September 8, 2008 Posted September 8, 2008 Uhh ... How do you resize the control? =\ My scripts:AppLauncherTRAY - Awesome app launcher that runs from the system tray NEW VERSION! | Run Length Encoding - VERY simple compression in pure autoit | Simple Minesweeper Game - Fun little game :)My website
Madza91 Posted September 8, 2008 Posted September 8, 2008 Use ControlMove(), GUICtrlSetPos() not work... [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)
ChromeFan Posted September 8, 2008 Posted September 8, 2008 -------------------- AutoIt Error Start -------------------- D:\Autoit\rich text.au3 (32) : ==> Missing separator character after keyword.: RichText_SetFormat($hRichText, $dwMask, $yHeight = 8, $yOffset = 0, _$crTextColor = 16711680, $bCharSet = 0, $bPitchAndFamily = 0, $szFaceName = "Sans Serif", _$wWeight = 400, $crBackColor = -1, $Underline = 0, $bUnderlineType = 0) RichText_SetFormat($hRichText, $dwMask, $yHeight = 8, $yOffset = 0, _^ ERROR >Exit code: 1 Time: 1.957 ------------------- AutoIt Error End ------------------- Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, What happened? Casey Stengel
Andreik Posted September 8, 2008 Posted September 8, 2008 --------------------AutoIt Error Start--------------------D:\Autoit\rich text.au3 (32) : ==> Missing separator character after keyword.: RichText_SetFormat($hRichText, $dwMask, $yHeight = 8, $yOffset = 0, _$crTextColor = 16711680, $bCharSet = 0, $bPitchAndFamily = 0, $szFaceName = "Sans Serif", _$wWeight = 400, $crBackColor = -1, $Underline = 0, $bUnderlineType = 0) RichText_SetFormat($hRichText, $dwMask, $yHeight = 8, $yOffset = 0, _^ ERROR>Exit code: 1 Time: 1.957-------------------AutoIt Error End-------------------Replace _$crTextColor with $crTextColor.
ChromeFan Posted September 8, 2008 Posted September 8, 2008 (edited) Replace _$crTextColor with $crTextColor.thanks for directing me to the direct code but this time it again gave me a error:>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "D:\Autoit\rich text.au3" D:\Autoit\rich text.au3 (32) : ==> Missing separator character after keyword.: RichText_SetFormat($hRichText, $dwMask, $yHeight = 8, $yOffset = 0, $crTextColor = 16711680, $bCharSet = 0, $bPitchAndFamily = 0, $szFaceName = "Sans Serif", _$wWeight = 400, $crBackColor = -1, $Underline = 0, $bUnderlineType = 0) RichText_SetFormat($hRichText, $dwMask, $yHeight = 8, $yOffset = 0, $crTextColor = 16711680, $bCharSet = 0, $bPitchAndFamily = 0, $szFaceName = "Sans Serif", _^ ERROR>Exit code: 1 Time: 1.068now how to resolve this error?> Edited September 8, 2008 by ChromeFan Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, What happened? Casey Stengel
Moderators SmOke_N Posted September 8, 2008 Moderators Posted September 8, 2008 (edited) thanks for directing me to the direct code but this time it again gave me a error:>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "D:\Autoit\rich text.au3" D:\Autoit\rich text.au3 (32) : ==> Missing separator character after keyword.: RichText_SetFormat($hRichText, $dwMask, $yHeight = 8, $yOffset = 0, $crTextColor = 16711680, $bCharSet = 0, $bPitchAndFamily = 0, $szFaceName = "Sans Serif", _$wWeight = 400, $crBackColor = -1, $Underline = 0, $bUnderlineType = 0) RichText_SetFormat($hRichText, $dwMask, $yHeight = 8, $yOffset = 0, $crTextColor = 16711680, $bCharSet = 0, $bPitchAndFamily = 0, $szFaceName = "Sans Serif", _^ ERROR>Exit code: 1 Time: 1.068now how to resolve this error?>Before posting in the forum on issues, read the output plane that you are actually posting here. It directly tells you the issue with the ^ sign. You can't have an underscore before your variable declaration $. Which is the same issue you had with the other post you made. Edited September 8, 2008 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
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