Jump to content

RTF problem.


Zisly
 Share

Recommended Posts

I've gotten rtf includes, but when I run a the example script I always get "variable used without being declared" on numerous lines..

I really need this to work so I can start making highlighting, and if it's not to much to ask maybe someone could post an example about highlighting..

Here are the codes.

example:

[autoit]#include-once

#include <GuiConstants.au3>

#include <GuiConstantsEx.au3>

#include <Include\DllCallBack.au3>

#include <string.au3>

#Include <Misc.au3>

#Include <GuiEdit.au3>

#include <Color.au3>

#include "Include\_RichEdit_912.au3"

HotKeySet("{TAB}", "_Tab")

Global $Main_GUI, $Width = 510, $Height = 650, $RichEdit

Global $hToolbar, $iMemo

Global $iItem

Global Enum $idNew = 1000, $idOpen, $idSave, $idHelp

Global $hB_Bold, $hB_Italic, $hB_Underline, $hB_StrikeOut, $hB_FontColor, $hB_BkColor, $hB_AlignL, $hB_AlignC, $hB_AlignR, $hB_Bk, $hB_GetSel, $hB_Table

Global $hC_FontSize

$dlll = DllOpen("user32.dll")

;=================================================================================

$Main_GUI = GUICreate("Rich Edit (Exemple)", $Width, $Height, -1, -1)

$Label = GuiCtrlCreateLabel("Rich Edit (Exemple)", $Width/3, 40, 300, 30)

GUICtrlSetFont($Label, 16)

$ButtonSave = GuiCtrlCreateButton("Save", 300, $Height-70, 60, 25)

$ButtonSaveSel = GuiCtrlCreateButton("Save Sel.", 300, $Height-45, 60, 25)

$ButtonOpen = GuiCtrlCreateButton("Open", 420, $Height-70 , 60, 25)

$ButtonOpenSel = GuiCtrlCreateButton("Open Sel.", 420, $Height-45 , 60, 25)

$Label = GuiCtrlCreateLabel("", 30, $Height-60, 250, 18)

GUICtrlSetBkColor($Label, 0xFFFFFF)

$Input = GUICtrlCreateInput("", 30, $Height-120, 450, 30)

$RichEdit = _GuiCtrl_RichEdit_Create($Main_GUI, 30, 170, 450, 350)

_SetButtons()

;===================================================================================

Opt("ColorMode", 0)

_RichEdit_LimitText($RichEdit, 512000)

_GUICtrlEdit_SetMargins ($RichEdit, BitOR($EC_LEFTMARGIN, $EC_RIGHTMARGIN), 10, 10)

_RichEdit_SetFont($RichEdit, 0000, 0x000000, 0xFFFFFF, "Times New Roman", 12, 0)

_RichEdit_BkColor($RichEdit, 0xc0c0c0)

;#cs

_RichEdit_SetNumbering($RichEdit, 2, 0x200)

_RichEdit_SetAlignment($RichEdit, 3)

_RichEdit_SetFont($RichEdit, 1010, 0x0000FF, 0xc0c0c0, -1, 18)

_GUICtrlEdit_AppendText($RichEdit, "Title" & @CRLF)

_RichEdit_SetAlignment($RichEdit, 2)

_RichEdit_SetFont($RichEdit, 0001, 0x45d3b4, 0xFFa300, -1, 14)

_GUICtrlEdit_AppendText($RichEdit, "Right aligned")

_RichEdit_SetFont($RichEdit, 0000, -1, -1, -1, 14)

_GUICtrlEdit_AppendText($RichEdit, @CRLF)

_RichEdit_SetAlignment($RichEdit, 4)

_RichEdit_SetFont($RichEdit, 0100, 0x00FF00, 0x339933, -1)

_GUICtrlEdit_AppendText($RichEdit, "Left aligned" & @CRLF)

_RichEdit_SetAlignment($RichEdit, 3)

_RichEdit_SetSpaceAfter($RichEdit, 1)

_RichEdit_SetFont($RichEdit, 1000, 0xCBA900, 0xc0c0c0)

_RichEdit_SetProtected($RichEdit)

_GUICtrlEdit_AppendText($RichEdit, "Centred" & @CRLF)

_RichEdit_SetNumbering($RichEdit, 0, 0)

_RichEdit_SetNumbering($RichEdit, 3, 0, 1)

_RichEdit_SetAlignment($RichEdit, 1)

_RichEdit_SetSpaceAfter($RichEdit, 0)

_RichEdit_SetFont($RichEdit, -1, -1, 0xc0c0c0, -1, 12)

_GUICtrlEdit_AppendText($RichEdit, "Another paragraph" & @CRLF)

_RichEdit_SetLineSpacing($RichEdit, 0)

_RichEdit_SetFont($RichEdit, -1, -1, 0xc0c0c0, -1, 12)

_RichEdit_AddText($RichEdit, "*** ")

_RichEditAppendLink($RichEdit, "I'm a link")

_RichEdit_AddText($RichEdit, " *** " & @CRLF)

_RichEdit_SetNumbering($RichEdit, 0, 0)

_RichEdit_SetAlignment($RichEdit, 3)

_RichEdit_AddText($RichEdit, @CRLF & @CRLF & "Table: " & @CRLF & @CRLF)

;#ce

_RichEdit_SetEventMask($RichEdit, BitOr($ENM_LINK, $ENM_PROTECTED, $ENM_MOUSEEVENTS, $ENM_KEYEVENTS, $ENM_SELCHANGE)) ;-------------------------------------To recieve EN_LINK and $EN_PROTECTED Notifications

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

GUISetState()

While 1

$msg = GUIGetMsg()

Select

Case $msg = -3

_DllCallBack_Free($pEditStreamCallback)

DllClose($dlll)

Exit

Case $msg = $ButtonSave

$sGetRtf = ""

$File = FileSaveDialog("Guardar como:", @ScriptDir, "rtf (*.myrt;*.rtf)")

_Save($RichEdit, $File)

;ConsoleWrite("End" & @LF & @LF)

;ControlFocus ( "Rich Edit (Exemple)", "", $RichEdit)

Case $msg = $ButtonSaveSel

$File = FileSaveDialog("Guardar selecci

Link to comment
Share on other sites

You need to add this line

#include <windowsconstants.au3>;<----------------------added
#include "include\_RichEdit_912.au3";<-----------------before this line

Comment out the Opt("ColorMode",0) line

Comment out any constants that cause an error that they are already defined.

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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