Floppy Posted December 26, 2008 Share Posted December 26, 2008 Hello, How can I save with AutoIt some RTF text into a file? Link to comment Share on other sites More sharing options...
ProgAndy Posted December 26, 2008 Share Posted December 26, 2008 Do you use a RichEdit UDF? Lokk at mine, there is an example for saving and loading rtf-files *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Floppy Posted December 26, 2008 Author Share Posted December 26, 2008 Yes, I do... In the sample script I don't understand the string: _GUICtrlRichEdit_AppendText($h_RichEdit, _RTF_GetBMPRTF(_FindFirstBMP()) & @CRLF) What are: _RTF_GetBMPRTF and _FindFirstBMP? I don't see those commands in pastebin.com/f7f2a956b... -------------------------------------------------------------------------------------- Then, to save a RTF file I must write: Case $msg = $bt2 Local $RTFFile = FileOpen(@DesktopDir & "\AutoIt_testrtf.rtf", 2) DllStructSetData($FileStreamStruct, 1, $RTFFile); -> Send handle to CallbackFunc Local $send = _GUICtrlRichEdit_StreamOut($h_RichEdit, $SF_RTF, $FileStreamStruct) FileClose($RTFFile) ConsoleWrite($send & @CRLF) Right? --------------------------------------------------------------------------------------- Istead, is there an option to export the RTF text as HTML? --------------------------------------------------------------------------------------- Sorry for bother and for my bad english...Thanks in advance! Link to comment Share on other sites More sharing options...
ProgAndy Posted December 26, 2008 Share Posted December 26, 2008 (edited) Your first question:Those functions are declared in the example. ..._FindFisrtBMP gets the first BMP in a folder. default Windows dir ..._RTF_GetBMPRTF creates RTF code for a .bmp-file -> this line inserts the first found bitmap inzo the RichEdit. 2nd question: You have to create a stream structure: Global $FileStreamCallBack = DllCallbackRegister("_EditStreamCallbackFile", "dword", "long_ptr;ptr;long;ptr") Global $FileStreamStruct = DllStructCreate($tagEDITSTREAM) DllStructSetData($FileStreamStruct, 3, DllCallbackGetPtr($FileStreamCallBack)) then you need a function to write to the file: Func _EditStreamCallbackFile($dwCookie, $pbBuff, $cb, $pcb) Local $pcb_Struct = DllStructCreate("long", $pcb) Local $FileHandle = $dwCookie Local $buufs = DllStructCreate("char[" & $cb & "]", $pbBuff) ; Write To File smile.gif, could also append to a variable .... FileWrite($FileHandle, DllStructGetData($buufs, 1)) DllStructSetData($pcb_Struct, 1, $cb) Return 0 EndFunc ;==>_EditStreamCallbackFile at last you have to call streamout: Local $RTFFile = FileOpen(@DesktopDir & "\AutoIt_testrtf.rtf", 2) DllStructSetData($FileStreamStruct, 1, $RTFFile); -> Send handle to CallbackFunc Local $send = _GUICtrlRichEdit_StreamOut($h_RichEdit, $SF_RTF, $FileStreamStruct) FileClose($RTFFile) ConsoleWrite($send & @CRLF) Edited December 26, 2008 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Floppy Posted December 26, 2008 Author Share Posted December 26, 2008 Thanks for explaination...but you didn't reply me to third question...However...THANK YOU VERY MUCH!!! Link to comment Share on other sites More sharing options...
ProgAndy Posted December 26, 2008 Share Posted December 26, 2008 well, you need an extra dll to convert RTF to html: http://www.autoitscript.com/forum/index.php?showtopic=86530 *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Floppy Posted December 27, 2008 Author Share Posted December 27, 2008 Yes...I already saw that post...but that script converts only the RTF text to HTML. I want a COMPLETE HTML converter, wich converts ALL (including images)... 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