#Region #AutoIt3Wrapper_Add_Constants=y #AutoIt3Wrapper_Icon=SCEdit.ico #AutoIt3Wrapper_Res_Description=SCEdit #AutoIt3Wrapper_Res_Language=1031 #AutoIt3Wrapper_Add_Constants=n #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_UseX64=y #EndRegion Opt("TrayAutoPause",0) Opt("TrayIconHide",1) Opt("MustDeclareVars", 1) #include #include #include #include #include #include #include #include #include Global $Firma Global $hGui, $hRichEdit, $iMsg Global $e_speichern,$e_Ende,$e_Farbe1,$e_Farbe2,$e_Farbe3,$e_PDF, $e_standard,$e_Fett, $e_Kursiv, $e_Unterstrichen, $e_Links, $e_Mitte,$e_hlink,$e_aufzaehlung Global $e_Hilfe, $button_hilfe, $button_f4, $button_f5 Global $m_file,$m_hilfe,$m_pdf,$m_text Global $i_Fett=0, $i_Kursiv=0, $i_Unterstrichen=0, $i_Links=0, $i_Mitte=0 Global $icolor,$iattrib,$scolor,$sattrib ; Pfade für TEMP-Bilddateien Global $PIC_Abbruch, $PIC_f1, $PIC_f2, $PIC_f3, $PIC_Fett, $PIC_Unterstrichen, $PIC_Kursiv, $PIC_Save, $PIC_Links, $PIC_Zentriert, $PIC_Hilfe,$PIC_Hlink,$PIC_Pdf,$PIC_Aufzaehlung ; Farben für Schriften Global $colref[3] $colref[0]=0x00 $colref[1]=0x00 $colref[2]=0x00 Global $Farbe_f1=_ColorSetCOLORREF($colref) Global $Farbe_f2 Global $Farbe_f3 ; Hintergrundfarbe $colref[0]=0xff $colref[1]=0xff $colref[2]=0xff Global $Farbe_BK=_ColorSetCOLORREF($colref) Main() Exit Func Main() ; übergebene Parameteranzahl OK? Wenn keine Übergabe -> automatisch Firma 1 / Firma 0 wird gesetzt, wenn zuviele Parameter if ubound($cmdline)=2 then $Firma=number($cmdline[1]) ElseIf ubound($cmdline)<2 then $Firma=1 else $Firma=0 EndIf ; Firmenüberprüfung if $Firma<>1 and $Firma<>2 and $Firma<>3 and $Firma<>5 then if $Firma > 0 and $Firma<901 then msgbox(0,'SCEDIT','Firma '&$Firma&' gibt es nicht') _ende() elseif $Firma = 0 Then msgbox(0,'SCEDIT','Firmenzuordnung nicht eindeutig (zuviele Parameter)') _ende() EndIf EndIf _Bilddateien_extrahieren() _erstelle_fenster() _Hilfstasten() GUISetState(@SW_SHOW) ; automatisch alle 250 ms die aktuellen Markierung oder Cursorposition ermitteln AdlibRegister("_holemarkierung", 250) ; Textfarben je Firma setzen _setzefirmenfarben() ; Standard Einstellung _GUICtrlRichEdit_Deselect($hRichEdit) _GUICtrlRichEdit_SetCharBkColor($hRichEdit ,$Farbe_BK) _GUICtrlRichEdit_SetCharColor ($hRichEdit ,$Farbe_f1) _GUICtrlRichEdit_SetCharAttributes($hRichEdit, "-bo") _GUICtrlRichEdit_SetCharAttributes($hRichEdit, "-un") _GUICtrlRichEdit_SetCharAttributes($hRichEdit, "-it") While 1 sleep(50) _GUICtrlRichEdit_SetFont($hRichEdit,12) local $idHover=0,$mousex=0,$mousey=0,$wpos local $msg=GUIGetMsg() local $mouse=GUIGetCursorInfo($hGui) if not @error and $mouse[2]=0 then $wpos=WinGetPos($hGui) $mousex=$mouse[0]+$wpos[0] $mousey=$mouse[1]+$wpos[1]+30 $idHover=$mouse[4] endif switch $idHover Case $e_Farbe1 ToolTip("Farbe 1 setzen",$mousex,$mousey,"",0,3) Case $e_speichern ToolTip("Ende mit speichern",$mousex,$mousey,"",0,3) Case $e_Ende ToolTip("Ende ohne speichern",$mousex,$mousey,"",0,3) Case $e_Farbe2 ToolTip("Farbe 2 setzen",$mousex,$mousey,"",0,3) Case $e_Farbe3 ToolTip("Farbe 3 setzen",$mousex,$mousey,"",0,3) Case $e_Kursiv ToolTip("Kursiv",$mousex,$mousey,"",0,3) Case $e_Fett ToolTip("Fett",$mousex,$mousey,"",0,3) Case $e_Unterstrichen ToolTip("Unterstreichen",$mousex,$mousey,"",0,3) Case $e_Links ToolTip("Neue Textzeile Linksbündig",$mousex,$mousey,"",0,3) Case $e_Mitte ToolTip("Neue Textzeile zentriert",$mousex,$mousey,"",0,3) Case $e_hlink ToolTip("HTTP-Link setzen",$mousex,$mousey,"",0,3) Case $e_aufzaehlung ToolTip("Aufzählung",$mousex,$mousey,"",0,3) Case $e_PDF ToolTip("PDF-Datei integrieren",$mousex,$mousey,"",0,3) Case $e_Hilfe ToolTip("Hilfe (kommt bald)",$mousex,$mousey,"",0,3) Case 0 ToolTip("") EndSwitch switch $msg Case $GUI_EVENT_CLOSE,$e_Ende,$button_f4 _ende() Case $button_f5, $e_speichern _GUICtrlRichEdit_Deselect($hRichEdit) _GUICtrlRichEdit_StreamToFile($hRichEdit, "ttt.rtf") msgbox(0,"","Datei gespeichert") _ende() Case $e_Hilfe, $button_hilfe msgbox(0,"","Hilfe") Case $e_hlink msgbox(0,"","Hypertextlink") Case $e_PDF msgbox(0,"","PDF einbinden") Case $e_Links _Linksbuendig() Case $e_Mitte _Zentriert() Case $e_aufzaehlung msgbox(0,"","Aufzählung") Case $e_Farbe1 _GUICtrlRichEdit_SetCharColor ($hRichEdit ,$Farbe_f1) Case $e_Farbe2 _GUICtrlRichEdit_SetCharColor ($hRichEdit ,$Farbe_f2) Case $e_Farbe3 _GUICtrlRichEdit_SetCharColor ($hRichEdit ,$Farbe_f3) Case $e_Fett if $i_Fett=0 then $i_Fett=1 else $i_Fett=0 EndIf _setzeschrift() Case $e_Kursiv if $i_Kursiv=0 then $i_Kursiv=1 else $i_Kursiv=0 EndIf _setzeschrift() Case $e_Unterstrichen if $i_Unterstrichen=0 then $i_Unterstrichen=1 else $i_Unterstrichen=0 endif _setzeschrift() EndSwitch WEnd EndFunc func _setzeschrift() if $i_Fett=1 then _GUICtrlRichEdit_SetCharAttributes($hRichEdit, "+bo") else _GUICtrlRichEdit_SetCharAttributes($hRichEdit, "-bo") EndIf if $i_Kursiv=1 then _GUICtrlRichEdit_SetCharAttributes($hRichEdit, "+it") else _GUICtrlRichEdit_SetCharAttributes($hRichEdit, "-it") EndIf if $i_Unterstrichen=1 then _GUICtrlRichEdit_SetCharAttributes($hRichEdit, "+un") else _GUICtrlRichEdit_SetCharAttributes($hRichEdit, "-un") EndIf if $i_Fett = 0 and $i_Kursiv=0 and $i_Unterstrichen=0 then _GUICtrlRichEdit_SetCharAttributes($hRichEdit, "-bo") _GUICtrlRichEdit_SetCharAttributes($hRichEdit, "-un") _GUICtrlRichEdit_SetCharAttributes($hRichEdit, "-it") EndIf EndFunc Func _holemarkierung() ; aktuelle gesamttextlänge inkl. Leerzeichen local $laenge=_GUICtrlRichEdit_GetTextLength($hRichEdit, True, True) if $laenge=0 then return ; aktuelle markierung 1.wert: von(beginnend mit 0) 2.wert: bis local $ll=_GUICtrlRichEdit_GetSel($hRichEdit) ; Keine Markierung vorhanden if $ll[0]=$ll[1] then return $icolor=_GUICtrlRichEdit_GetCharColor($hRichEdit) $iattrib=_GUICtrlRichEdit_GetCharAttributes($hRichEdit) if StringInStr($iattrib,'bo+') then $i_Fett=1 Else $i_Fett=0 endif if StringInStr($iattrib,'un+') then $i_Unterstrichen=1 Else $i_Unterstrichen=0 endif if StringInStr($iattrib,'it+') then $i_Kursiv=1 Else $i_Kursiv=0 endif EndFunc func _erstelle_fenster() $hGui = GUICreate("SCEdit-Infomail Firma "&$Firma, 880, 530, -1, -1) local $style1=BitOR($ss_notify,$SS_SUNKEN,$ss_bitmap,$SS_Centerimage) local $style2=BitOR($ss_notify,$ss_bitmap,$SS_Centerimage) $e_speichern=GUICtrlCreatePic($PIC_Save,5,2,20,20,$style2) $e_Ende=GUICtrlCreatePic($PIC_Abbruch,30,2,20,20,$style2) $e_Farbe1=GUICtrlCreatePic($PIC_f1,65,2,20,20,$style2) $e_Farbe2=GUICtrlCreatePic($PIC_f2,90,2,20,20,$style2) $e_Farbe3=GUICtrlCreatePic($PIC_f3,115,2,20,20,$style2) $e_Fett=GUICtrlCreatePic($PIC_Fett,145,2,20,20,$style2) $e_Unterstrichen=GUICtrlCreatePic($PIC_Unterstrichen,170,2,20,20,$style2) $e_Kursiv=GUICtrlCreatePic($PIC_Kursiv,195,2,20,20,$style2) $e_Links=GUICtrlCreatePic($PIC_Links,230,2,20,20,$style2) $e_Mitte=GUICtrlCreatePic($PIC_Zentriert,255,2,20,20,$style2) $e_aufzaehlung=GUICtrlCreatePic($PIC_Aufzaehlung,280,2,20,20,$style2) $e_hlink=GUICtrlCreatePic($PIC_Hlink,325,2,20,20,$style2) $e_PDF=GUICtrlCreatePic($PIC_Pdf,360,2,20,20,$style2) $e_Hilfe=GUICtrlCreatePic($PIC_Hilfe,850,2,20,20,$style2) $hRichEdit = _GUICtrlRichEdit_Create($hGui, "", 0,26 ,880 ,502 , BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL)) EndFunc Func _Hilfstasten() local $asetkey[3][2] ; Button :F10 - Hilfe $button_hilfe=GUICtrlCreateDummy() $asetkey[0][0] = "{F10}" $asetkey[0][1] = $button_hilfe ; Button :F5 - Ende und Speichern $button_f5=GUICtrlCreateDummy() $asetkey[1][0] = "{F5}" $asetkey[1][1] = $button_f5 ; Button :F4 - Ende ohne Speichern $button_f4=GUICtrlCreateDummy() $asetkey[2][0] = "{F4}" $asetkey[2][1] = $button_f4 GUISetAccelerators($asetkey) EndFunc Func _Bilddateien_extrahieren() $PIC_Abbruch=_tempFile() $PIC_f1=_tempFile() $PIC_f2=_tempFile() $PIC_f3=_tempFile() $PIC_Fett=_tempFile() $PIC_Unterstrichen=_tempFile() $PIC_Kursiv=_tempFile() $PIC_Save=_tempFile() $PIC_Links=_tempFile() $PIC_Zentriert=_tempFile() $PIC_Aufzaehlung=_tempFile() $PIC_Hlink=_tempFile() $PIC_Pdf=_tempFile() $PIC_Hilfe=_tempFile() FileInstall('.\abbruch2.jpg',$PIC_Abbruch) FileInstall('.\f1.jpg',$PIC_f1) FileInstall('.\f2.jpg',$PIC_f2) FileInstall('.\f3.jpg',$PIC_f3) FileInstall('.\fett.jpg',$PIC_Fett) FileInstall('.\unterstrichen.jpg',$PIC_Unterstrichen) FileInstall('.\kursiv.jpg',$PIC_Kursiv) FileInstall('.\save.jpg',$PIC_Save) FileInstall('.\links.jpg',$PIC_Links) FileInstall('.\zentriert.jpg',$PIC_Zentriert) FileInstall('.\hlink.jpg',$PIC_Hlink) FileInstall('.\pdf.jpg',$PIC_Pdf) FileInstall('.\hilfe.jpg',$PIC_Hilfe) FileInstall('.\aufzaehlung.jpg',$PIC_Aufzaehlung) EndFunc Func _Bilddateien_loeschen() FileDelete($PIC_Abbruch) FileDelete($PIC_f1) FileDelete($PIC_f2) FileDelete($PIC_f3) FileDelete($PIC_Fett) FileDelete($PIC_Unterstrichen) FileDelete($PIC_Kursiv) FileDelete($PIC_Save) FileDelete($PIC_Links) FileDelete($PIC_Zentriert) FileDelete($PIC_Hlink) FileDelete($PIC_Pdf) FileDelete($PIC_Hilfe) EndFunc func _setzefirmenfarben() if $Firma=1 or $Firma=3 or $Firma=5 Then $colref[0]=0x00 $colref[1]=0x38 $colref[2]=0x9a $Farbe_f2=_ColorSetCOLORREF($colref) $colref[0]=0x00 $colref[1]=0xAE $colref[2]=0xEF $Farbe_f3=_ColorSetCOLORREF($colref) EndIf if $Firma=2 then $colref[0]=0x00 $colref[1]=0x0E $colref[2]=0xBC $Farbe_f2=_ColorSetCOLORREF($colref) $colref[0]=0xFF $colref[1]=0x5D $colref[2]=0x00 $Farbe_f3=_ColorSetCOLORREF($colref) EndIf if $Firma>900 then $colref[0]=0x00 $colref[1]=0x7E $colref[2]=0xBC $Farbe_f2=_ColorSetCOLORREF($colref) $colref[0]=0xF9 $colref[1]=0x9D $colref[2]=0x05 $Farbe_f3=_ColorSetCOLORREF($colref) EndIf EndFunc Func _ende() GUIDelete() _Bilddateien_loeschen() Exit EndFunc func _Linksbuendig() local $parpos=number(_holeaktposition()) ; msgbox(0,"parpos:",$parpos) _GUICtrlRichEdit_InsertText($hRichEdit, @CRLF&"<#Fql>") EndFunc func _Zentriert() local $parpos=number(_holeaktposition()) ; msgbox(0,"parpos:",$parpos) ; _GUICtrlRichEdit_InsertText($hRichEdit, @CR&"\qc ") _GUICtrlRichEdit_InsertText($hRichEdit, @CRLF&"<#Fqc>") local $a=_GUICtrlRichEdit_GetText($hRichEdit) local $s2=@CR for $t=0 to stringlen($a) if stringmid($a,$t,1)=$s2 then msgbox(0,"","da2:"&$t) EndIf Next EndFunc Func _holeaktposition() local $laenge=_GUICtrlRichEdit_GetTextLength($hRichEdit, True, True) if $laenge=0 then return '0' ; aktuelle markierung 1.wert: von(beginnend mit 0) 2.wert: bis local $ll=_GUICtrlRichEdit_GetSel($hRichEdit) return $ll[0] EndFunc #cs RTF CODES https://metacpan.org/dist/RTF-Writer/view/lib/RTF/Cookbook.pod Character Formatting: \plain -- turn off all formatting \ul -- underline \b -- bold \i -- italic \sub -- subscript \super -- superscript \fN -- change to font #N (where that's the number of a font declared in the fonttable in the prolog) \fsN -- set current font size to N half-points e.g., \fs30 = 15 point \scaps -- smallcaps \strike -- strikethru \v -- hidden text (For comments?) \langN -- language N US English: 1033 MX Spanish: 2058 French: 1036 Turkish: 1055 No language: 1024 \noproof -- disable spellchecking here (not known to older RTF readers) {\super\chftn}{\footnote\pard\plain\chftn. Foo!} -- set an autonumbered footnote of "Foo!" hanging off of the current point in the text {\field{\*\fldinst{HYPERLINK "http://www.suck.com/"}}{\fldrslt{\ul stuff }}} -- make "stuff" a link to http://www.suck.com/ \cfN -- select foreground color #N (from color table) \cbN -- select background color #N (from color table) ____________________ Paragraph and Block-Level Formatting: \page -- pagebreak \line -- newline (not a real paragraph break) \tab -- tab (better than using a literal tab character) \par -- End this paragraph, and start a new one, inheriting paragraph properties from the previous one. (Note that \par means END-paragraph, but if you treat it as it if means start-paragraph, you won't break too many things.) \par\pard -- End previous paragraph, and start a new one that doesn't inherit paragraph properties from the previous one. (The \par ends the previous paragraph, the \pard resets the new paragraph's formatting attributes.) \ql -- left (i.e., no) justification \qr -- right-justify (i.e., align right) \qj -- full-justify (i.e., smooth margins on both sides) \qc -- center \liN -- left-indent this whole paragraph by N twips (default: 0) \riN -- right-indent this whole paragraph by N twips (default: 0) \fiN -- first-line left-indent this paragraph by N twips (default: 0) (Note that this indenting is relative to the margin set by \liN!) (Note also that the above can have negative values. E.g., \fi-120 backdents (to the left!) the first line by 120 twips from the paragraph's left margin.) \sbN -- N twips of extra (vertical) space before this paragraph (default: 0) \saN -- N twips of extra (vertical) space after this paragraph (default: 0) \pagebb -- pagebreak before this paragraph \keep -- don't split up this paragraph (i.e., across pages) \keepn -- don't split up this paragraph from the next one \widctlpar -- widow-and-orphans control for this paragraph (antonym: \nowidctlpar) {\header\pard\qr\plain\f0\chpgn\par} -- turn on page numbering. Lasts until next \sect\sectd. \colsN -- N newspaper-columns per page. Lasts until next \sect\sectd. \linebetcol -- show lines between columns. \sect\sectd -- new section. (Resets header and columnation.) #ce #cs Start beisiel 1 {\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1031{\fonttbl{\f0\fnil\fcharset0 MS Shell Dlg;}} {\colortbl ;\red0\green0\blue0;\red255\green255\blue255;\red0\green93\blue255;\red122\green56\blue0;} {\*\generator Riched20 6.3.9600}\viewkind4\uc1 \pard\cf1\highlight2\f0\fs28 Standard\par \b Fett\par \b0\i Kursiv\i0\par \ul Unterstrichen\ulnone\par \par \b\i Fett + Kursiv\par \ul\i0 Fett + Unterstrichen\par \b0\i Kursiv + Unterstrichen\par \b Kursiv + Unterstrichen + Fett\par \ulnone\b0\i0\par \par Farbe1\par \cf3 Farbe2\cf1\par \cf4 Farbe3\cf1\par \par \cf3\ul\b\i Farbe2 + Fett + Kursiv + Unterstrichen\par \par Ende\par \par } Beispiel 2: {\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1031{\fonttbl{\f0\fnil\fcharset0 MS Shell Dlg;}} {\colortbl ;\red0\green93\blue255;\red255\green255\blue255;} {\*\generator Riched20 6.3.9600}\viewkind4\uc1 \pard\cf1\highlight2\ul\b\i\f0\fs28 sdfsdfsdfsdf\cf0\highlight0\ulnone\b0\i0\fs17\par } ########## entfernen: \highlightx \f0 \fsxx ul = Unterstreichen an ulnone = Unterstreichen aus cf1 = Farbe1 cf2 = Farbe2 cf3 = Farbe3 \b\i Fett + Kursiv\par \ul\i0 Fett + Unterstrichen\par \b0\ 'f6 = Sonderzeichen #ce