DHMH wrote:
i could translate it to english

Greets,
DHMH
HI, if you would like to proofread what I've done so far that would be nice. I can't understand Deutsche but I can go to Google, and I did last night with all the comments and all the text in message boxes, menus etc.
But there were a few words that would not translate. If you can tell me what these are I would appreciate. If there is anything else you can translate it might be nice but there is no need to translate variable or function names to English words.
Here is what I have so far:
Code:
#NoEnv
;#SingleInstance, Off
SetBatchLines, -1
SetControlDelay, -1
SetWinDelay, -1
StringCaseSense, Locale
; ------------------------------------------------------------------------------
; AHK Template
; ------------------------------------------------------------------------------
VORLAGE =
(Join`r`n
; ------------------------------------------------------------------------------
; Skript Name :
; AHK Version :
; OS Version :
; Sprache :
; Funktion :
; Autor :
; Historie :
; ------------------------------------------------------------------------------
#NoEnv
SendMode, Input
)
; ------------------------------------------------------------------------------
; System Preferences
; ------------------------------------------------------------------------------
SysGet, HSB, 3 ; Height of a horizontal scroll bar
; ------------------------------------------------------------------------------
; Windows Constants
; http://msdn.microsoft.com/en-us/library/bb773173(VS.85).aspx
; http://msdn.microsoft.com/en-us/library/ms632586(VS.85).aspx
; ------------------------------------------------------------------------------
; Edit Messages
EM_GETSEL := 0xB0
EM_SETSEL := 0xB1
EM_GETRECT := 0xB2
EM_SETRECT := 0xB4
EM_SCROLL := 0xB5
EM_CHARFROMPOS := 0xD7
EM_LINESCROLL := 0xB6
EM_SCROLLCARET := 0xB7
EM_GETMODIFY := 0xB8
EM_SETMODIFY := 0xB9
EM_GETLINECOUNT := 0xBA
EM_LINEINDEX := 0xBB
EM_LINELENGTH := 0xC1
EM_REPLACESEL := 0xC2
EM_GETLINE := 0xC4
EM_CANUNDO := 0xC6
EM_UNDO := 0xC7
EM_LINEFROMCHAR := 0xC9
EM_GETFIRSTVISIBLELINE := 0xCE
EM_POSFROMCHAR := 0xD6
EM_CHARFROMPOS := 0xD7
; Edit Styles ------------------------------------------------------------------
ES_AUTOVSCROLL := 0x40
ES_NOHIDESEL := 0x100
; Window Messages --------------------------------------------------------------
WM_SETREDRAW := 0x0B
WM_SETTEXT := 0x0C
WM_GETTEXT := 0x0D
WM_GETTEXTLENGTH := 0x0E
WM_SETCURSOR := 0x20
WM_NCHITTEST := 0x84
WM_COMMAND := 0x111
WM_VSCROLL := 0x115
WM_CTLCOLORLISTBOX := 0x134
WM_MOUSEMOVE := 0x200
WM_LBUTTONDOWN := 0x201
WM_LBUTTONUP := 0x202
WM_LBUTTONDBLCLK := 0x203
WM_RBUTTONUP := 0x205
WM_CUT := 0x300
WM_COPY := 0x301
WM_PASTE := 0x302
WM_CLEAR := 0x303
WM_UNDO := 0x304
WM_CTLCOLORLISTBOX := 0x134
; Window Styles ----------------------------------------------------------------
WS_TABSTOP := 0x10000
WS_DLGFRAME := 0x400000
WS_BORDER := 0x800000
WS_CAPTION := 0xC00000
WS_VISIBLE := 0x10000000
; Window Extended Styles -------------------------------------------------------
WS_EX_DLGMODALFRAME := 0x01
WS_EX_CLIENTEDGE := 0x200
WS_EX_RIGHT := 0x1000
; GetSysColor ------------------------------------------------------------------
COLOR_WINDOW := 5 ; Normal window background
COLOR_3DFACE := 15 ; Background for dialog boxes (AHK)
; Maus -------------------------------------------------------------------------
MK_LBUTTON := 0x1
; ------------------------------------------------------------------------------
; Konstanten
; ------------------------------------------------------------------------------
WinTitel := "AHK Edit"
VarName := "^[\w#@\?\$\[\]]+$"
IconDLL := A_WinDir "\System32\User32.dll"
IconHallo := "2"
IconFrage := "3"
IconStop := "4"
IconInfo := "5"
HistorienDatei := A_ScriptDir "\Historie.txt"
; ------------------------------------------------------------------------------
; Variables
; ------------------------------------------------------------------------------
; Font attributes
SchriftAttr := "s10"
; Font Name
SchriftName := "Courier New"
; Imported file
GewählteDatei := ""
; Maximum number of rows
MaxZeilen := 32767
; Current last line number
MaxZeile := 1
; Prior last line number
MaxZeileAlt := 1
; Nummer der ersten sichbaren Zeile im Edit
ObersteZeile := 0
; Number of the first visible row in the Edit
EditHatFokus := False
; The edit has been changed
EditGeändert := False
; Suchbegriff ???
SucheNach := ""
; Replacement
ErsetzeDurch := ""
; Was chosen to replace
Replace := False
; Find Next is activated
WeiterSuchen := False
; Number of the line with cursor (caret) in the Edit
AktZeile := 1
; Number of the line from "Go"
GeheZuZeile := ""
; Current number of characters in the Edit
ZeichenZahl := 0
; Current number of rows in the Edit
ZeilenZahl := 1
; Line after a gap / Trips
ZeilenDiff := 0
; Beginning of the current selection
StartPos := 0
; End of the current selection
EndePos := 0
; Delay for the invocation of EDITAKTIONEN in ms,
; on slow computers, a higher value will be required if
; Reading the files are not properly positioned.
Verzögerung := 2
; Messages treatment on / off
NachrichtenAuswerten := False
; Action was canceled
Abbruch := False
; File from the history should be read
LetzteDatei := ""
; Display line numbers?
ZeilenNummern := True
; ------------------------------------------------------------------------------
; Color Gui Controls and determine
; ------------------------------------------------------------------------------
;* COLOR_3DFACE is (also) the background color for dialog boxes. AHK used
;* this color for the background Guihintergrund and some field types
;* e.g. Text boxes.
;* The color comes as BGR value and must be converted to RGB.BGR := DLLCall("GetSysColor", "Int", COLOR_3DFACE)
SetFormat, Integer, H
GuiColor := ((BGR & 0xFF) << 16) + (BGR & 0xFF00) + ((BGR & 0xFF0000) >> 16)
SetFormat, Integer, D
; ------------------------------------------------------------------------------
; Recently opened files read
; ------------------------------------------------------------------------------
DateiListe := ""
Fileread, DateiHistorie, %HistorienDatei%
Sort, DateiHistorie, R
Loop, Parse, DateiHistorie, `n, `r
{
If FileExist(SubStr(A_LoopField,15)) {
DateiListe .= A_LoopField "`n"
}
}
VarSetCapacity(DateiHistorie, 0)
; ------------------------------------------------------------------------------
; Gui
; ------------------------------------------------------------------------------
GuiW := 0
GuiH := 0
; Menu last opened files
Historie := False
ZMMENU := "Historie"
Loop, Parse, DateiListe, `n
{
If (A_LoopField) {
MenüEintrag := SubStr(A_LoopField, 15)
Menu, %ZMMENU%, Add, %MenüEintrag%, LETZTEDATEIEN
Historie := True
}
}
If (!Historie) {
Menu, %ZMMENU%, Add, Dummy, LETZTEDATEIEN
Menu, %ZMMENU%, DeleteAll
}
Menu, %ZMMENU%, Color, %GuiColor%
; Menü Datei -------------------------------------------------------------------
FMMENU := "File"
FMNAME := "&File"
FMNEW := "&Neu`tCtrl+N"
FMOPEN := "Ö&pen...`tCtrl+O"
FMSAVE := "&Save`tCtrl+S"
FMSAVA := "Save &As...`tCtrl+Shift+S"
FMHIST := "&Updated"
FMEXIT := "&Quit`tCtrl+Q"
Menu, %FMMENU%, Add, %FMNEW%, NEUEDATEI
Menu, %FMMENU%, Add, %FMOPEN%, DATEILESEN
Menu, %FMMENU%, Add, %FMSAVE%, DATEISPEICHERN
Menu, %FMMENU%, Disable, %FMSAVE%
Menu, %FMMENU%, Add, %FMSAVA%, DATEISPEICHERNUNTER
Menu, %FMMENU%, Disable, %FMSAVA%
Menu, %FMMENU%, Add
Menu, %FMMENU%, Add, %FMHIST%, :%ZMMENU%
If (!Historie) {
Menu, %FMMENU%, Disable, %FMHIST%
}
Menu, %FMMENU%, Add
Menu, %FMMENU%, Add, %FMEXIT%, GuiClose
Menu, %FMMENU%, Color, %GuiColor%
; Menü Bearbeiten --------------------------------------------------------------
BMMENU := "Edit"
BMNAME := "&Edit"
BMUNDO := "Undo`tCtrl+Z"
BMCUT := "Cut`tCtrl+X"
BMCOPY := "Copy`tCtrl+C"
BMPASTE := "Paste`tCtrl+V"
BMCLEAR := "Delete`tEntf"
BMALL := "Select All`tCtrl+A"
Menu, %BMMENU%, Add, %BMUNDO%, MENÜBEARBEITEN
Menu, %BMMENU%, Add
Menu, %BMMENU%, Add, %BMCUT%, MENÜBEARBEITEN
Menu, %BMMENU%, Add, %BMCOPY%, MENÜBEARBEITEN
Menu, %BMMENU%, Add, %BMPASTE%, MENÜBEARBEITEN
Menu, %BMMENU%, Add, %BMCLEAR%, MENÜBEARBEITEN
Menu, %BMMENU%, Add
Menu, %BMMENU%, Add, %BMALL%, MENÜBEARBEITEN
Menu, %BMMENU%, Color, %GuiColor%
; Menü Search ------------------------------------------------------------------
SMMENU := "Search"
SMNAME := "&Search"
SMFIND := "Search`tCtrl+F"
SMREPL := "Replace`tCtrl+R"
SMNEXT := "Find Next`tF3"
SMGOTO := "Go to line`tCtrl+G"
Menu, %SMMENU%, Add, %SMFIND%, MENÜSUCHEN
Menu, %SMMENU%, Add, %SMREPL%, MENÜSUCHEN
Menu, %SMMENU%, Add, %SMNEXT%, WEITERSUCHEN
Menu, %SMMENU%, Add, %SMGOTO%, MENÜGEHEZU
Menu, %SMMENU%, Color, %GuiColor%
; Menü Textmarken --------------------------------------------------------------
TMMENU := "Bookmarks"
TMNAME := "B&ookmarks"
TMNEWMENU := "Create"
TMNEWNAME := "Create`tCtrl+Microsoft"
TMGOMENU := "Toto"
TMGONAME := "Go to`tAlt+Microsoft"
TMLOMENU := "Delete"
TMLONAME := "Delete`tCtrl+Shift+Microsoft"
TMALLNAME := "Delete all"
MaxTextmarken := 8
Loop, %MaxTextmarken% {
TMITEM%A_Index% := "Textmarke " A_Index
Menu, %TMNEWMENU%, Add, % TMITEM%A_Index%, MENU_TEXTMARKEN
Menu, %TMGOMENU%, Add, % TMITEM%A_Index%, MENU_TEXTMARKEN
Menu, %TMGOMENU%, Disable, % TMITEM%A_Index%
Menu, %TMLOMENU%, Add, % TMITEM%A_Index%, MENU_TEXTMARKEN
Menu, %TMLOMENU%, Disable, % TMITEM%A_Index%
TM%A_Index% := 0
}
Menu, %TMMENU%, Add, %TMNEWNAME%, :%TMNEWMENU%
Menu, %TMMENU%, Add, %TMGONAME%, :%TMGOMENU%
Menu, %TMMENU%, Add, %TMLONAME%, :%TMLOMENU%
Menu, %TMMENU%, Add, %TMALLNAME%, TEXTMARKENLÖSCHEN
Menu, %TMMENU%, Color, %GuiColor%
; Menü Ansicht -----------------------------------------------------------------
VMMENU := "View"
VMNAME := "&View"
VMZNR := "&Line Numbers"
Menu, %VMMENU%, Add, %VMZNR%, MENÜ_ANSICHT
Menu, %VMMENU%, Check, %VMZNR%
; Menü Tools -------------------------------------------------------------------
; Here, the favorite tools are installed, the menu must routines
; But even be created.
XMMENU := "Tools"
XMNAME := "&Tools"
XMENTRY := "Put External tools here!"
Menu, %XMMENU%, Add, %XMENTRY%, TOOLMENÜ
Menu, %XMMENU%, Color, %GuiColor%
; Guimenü ----------------------------------------------------------------------
Menu, GuiMenu, Add, %FMNAME%, :%FMMENU%
Menu, GuiMenu, Add, %BMNAME%, :%BMMENU%
Menu, GuiMenu, Add, %SMNAME%, :%SMMENU%
Menu, GuiMenu, Add, %TMNAME%, :%TMMENU%
Menu, GuiMenu, Add, %VMNAME%, :%VMMENU%
Menu, GuiMenu, Add, %XMNAME%, :%XMMENU%
Menu, GuiMenu, Color, %GuiColor%
Gui, +Resize +MinSize
Gui, Color, %GuiColor%, %GuiColor%
Gui, Margin, 0, 0
Gui, Menu, GuiMenu
Gui, Font, %SchriftAttr%, %SchriftName%
; Width of the font set for Zeilennummernedits identify
FeldDimensionen(MaxZeile, W, H, SchriftAttr, SchriftName)
; The Edit is created with the following properties:
; y3 The Edit is to TextEdit by 3 pixels moved downwards
; r25 Height 25 lines
; c202020 Text color (black light)
; -VScroll No vertical scroll bar
; -Tabstop When you scroll with the Edit tab will be ignored
; Right Right-justified text alignment (WS_EX_RIGHT)
; Readonly Unwriteable
; ES_NOHIDESEL The current selection is lost when focus is not lost
; -E0x200 No framework (WS_EX_CLIENTEDGE)
CtrlOptions := "y3 w" W " r25 c202020 -VSCroll -HScroll -TABSTOP Right"
. " Readonly " ES_NOHIDESEL " -E0x200 vEDLN HwndEDLNID"
Gui, Add, Edit, %CtrlOptions%, %MaxZeile%
GuiControlGet, EDLN, POS
; Height of TextEdit = Amount of Nummernedits pixel offset + 3 +
; Height of the horizontal scroll bar
EDTXH := EDLNH + 1 + HSB
; For the initial width of the edits will be a line of 90 characters created
EDTX := ""
Loop, 90 {
EDTX .= "+"
}
; The Edit is created with the following properties:
; x+0 The Edit closes seamlessly to the ListBox
; ym The Edit is Nummernedit by 3 pixels shifted up
; c202020 Text color (black light)
; -BackGround The default background color is not used
; ES_NOHIDESEL The current selection is lost when focus is not lost
; T12 Tablatures every 12 units of dialogue, which brings to the top
; Font set at a distance of 3 characters. For other fonts
; or font sizes must be trial & error.
; WantTab The Edit evaluates the Tab key
; +HScroll The horizontal scroll bar is always visible
CtrlOptions := "x+2 ym h" EDTXH " c202020 -BackGround " ES_NOHIDESEL
. " T12 WantTab +HScroll vEDTX HwndEDTXID"
Gui, Add, Edit, %CtrlOptions%, %EDTX%
GuiControl, , EDTX
EDTX := ""
GuiControlGet, EDTX, Pos
Gui, Font
; Navigationsbuttons
Gui, Add, Button, x%EDTXX% y+1 h%H% vAZEILE gAZEILE HwndAZEILEID, >A
GuiControlGet, AZEILE, Pos
Gui, Add, Button, x+0 yp hp vEZEILE gGEHEZU HwndEZEILEID, | <
GuiControlGet, EZEILE, Pos
Gui, Add, Button, x+0 yp hp vLZEILE gGEHEZU HwndLZEILEID, > |
GuiControlGet, LZEILE, Pos
Loop, %MaxTextmarken% {
Gui, Add, Button
, x+0 yp hp vBTM%A_Index% gGOTM Disabled HwndBTM%A_Index%ID
, &%A_Index%
GuiControlGet, BTM%A_Index%, Pos
}
; Statusbar
Gui, Add, StatusBar
Gui, +LastFound
GuiID := WinExist()
GroupAdd, GUI, ahk_id %GuiID%
Gui, Show, , Unbenannt - %WinTitel%
; Hotkeys für to set Bookmarks ------------------------------------------------
Hotkey, IfWinActive, ahk_group GUI
Loop, %MaxTextmarken% {
Hotkey, ^%A_Index%, TEXTMARKEN
Hotkey, ^+%A_Index%, TEXTMARKEN
}
Hotkey, IfWinActive
; ------------------------------------------------------------------------------
; Treatment News
; ------------------------------------------------------------------------------
; First, the window procedure of edits take to get to the news
; specific issues that directly go to the Edit
HEDTXMSG := DllCall("SetWindowLong"
, "UInt", EDTXID
, "Int", -4
, "Unt", RegisterCallback("EDTXNachrichten", "", 4)
, "Uint")
HEDLNMSG := DllCall("SetWindowLong"
, "UInt", EDLNID
, "Int", -4
, "Unt", RegisterCallback("EDLNNachrichten", "", 4)
, "Uint")
; Then the intercept Notifications ----------------------------------------------
OnMessage(WM_COMMAND, "Benachrichtigungen")
; And finally, check where the mouse is ---------------------
OnMessage(WM_MOUSEMOVE, "Mauskontrolle")
GuiControl, Focus, EDTX
EditHatFokus := True
GoSub, EDITAKTIONEN
EditGeändert := False
NachrichtenAuswerten := True
Return
; ------------------------------------------------------------------------------
; Controls for resizing new position
; ------------------------------------------------------------------------------
GuiSize:
If (A_EventInfo = 1) {
Return
}
If (GuiW = 0) {
GuiW := A_GuiWidth
GuiH := A_GuiHeight
Return
}
DW := A_GuiWidth - GuiW
DH := A_GuiHeight - GuiH
GuiControl, Move, EDLN, % "h" (EDLNH += DH)
GuiControl, Move, EDTX, % "w" (EDTXW += DW) " h" (EDTXH += DH)
GuiControl, MoveDraw, AZEILE, % "y" (AZEILEY += DH)
GuiControl, MoveDraw, EZEILE, % "y" (EZEILEY += DH)
GuiControl, MoveDraw, LZEILE, % "y" (LZEILEY += DH)
Loop, %MaxTextmarken% {
GuiControl, MoveDraw, BTM%A_Index%, % "y" (BTM%A_Index%Y += DH)
}
GuiW := A_GuiWidth
GuiH := A_GuiHeight
Return
; ------------------------------------------------------------------------------
; Exit program
; ------------------------------------------------------------------------------
GuiClose:
GuiEscape:
SendMessage, EM_GETMODIFY, 0, 0, , ahk_id %EDTXID%
If (ErrorLevel) {
MsgBox, 8227, %WinTitel%
, % "Not all changes are saved!`n`n"
. "Save changes now?"
IfMsgBox, Cancel
Return
IfMsgBox, Yes
GoSub, DATEISPEICHERNUNTER
}
ExitApp
; ------------------------------------------------------------------------------
; Hilfsguis close
; ------------------------------------------------------------------------------
GuiXClose:
GuiXEscape:
Gui, 1:-Disabled
Gui, %A_Gui%:Destroy
Abbruch := True
Return
; ------------------------------------------------------------------------------
; New script template
; ------------------------------------------------------------------------------
NEUEDATEI:
If (EditGeändert) {
MsgBox, 8227, %WinTitel%
, % "They have not all changes are saved!`n`n"
. "If the changes are now saved?"
IfMsgBox, Cancel
Return
IfMsgBox, Yes
GoSub, DATEISPEICHERNUNTER
}
DateiInhalt := VORLAGE
GewählteDatei := ""
FensterTitel := "Neu - " WinTitel
GoSub, NEUERINHALT
Return
; ------------------------------------------------------------------------------
; Skript einlesen
; ------------------------------------------------------------------------------
DATEILESEN:
If (EditGeändert) {
MsgBox, 8227, %WinTitel%
, % "Not all changes are saved!`n`n"
. "Save changes now?"
IfMsgBox, Cancel
Return
IfMsgBox, Yes
GoSub, DATEISPEICHERNUNTER
}
If (LetzteDatei) {
DateiPfad := LetzteDatei
LetzteDatei := ""
} Else {
DateiPfad := ""
FileSelectFile, DateiPfad, 35
, %A_ScriptDir%\*.ahk, Datei öffnen:, Skripte (*.ahk)
If (!DateiPfad) {
Return
}
}
GewählteDatei := DateiPfad
FileRead, DateiInhalt, %GewählteDatei%
FensterTitel := GewählteDatei " - " WinTitel
GoSub, HISTORIEAKTUALISIEREN
GoSub, NEUERINHALT
Return
; ------------------------------------------------------------------------------
; Edit has new content
; ------------------------------------------------------------------------------
NEUERINHALT:
; News analysis off
NachrichtenAuswerten := False
Sleep, %Verzögerung%
GuiControl, , EDTX, %DateiInhalt%
; Length of text in the Edit Query
SendMessage, WM_GETTEXTLENGTH, 0, 0, , ahk_id %EDTXID%
ZeichenZahl := ErrorLevel
; Cursor to the end
SendMessage, EM_SETSEL, ZeichenZahl, ZeichenZahl, , ahk_id %EDTXID%
; To row with the cursor scroll
SendMessage, EM_SCROLLCARET, 0, 0, , ahk_id %EDTXID%
; Edit as unchanged mark
SendMessage, EM_SETMODIFY, 0, 0, , ahk_id %EDTXID%
EditGeändert := False
Menu, %FMMENU%, Disable, %FMSAVE%
Menu, %FMMENU%, Enable, %FMSAVA%
GoSub, TEXTMARKENLÖSCHEN
Gui, +LastFound
WinSetTitle, %FensterTitel%
GuiControl, Focus, EDTX
EditHatFokus := True
GoSub, EDITAKTIONEN
NachrichtenAuswerten := True
Return
; ------------------------------------------------------------------------------
; Save File
; ------------------------------------------------------------------------------
DATEISPEICHERN:
Gui, +OwnDialogs
Gui, Submit, NoHide
If (!EDTX) {
Return
}
If (A_ThisHotkey = "^s" And !EditGeändert) {
Return
}
FileDelete, %GewählteDatei%_Neu
FileAppend, %EDTX%, %GewählteDatei%_Neu
FileMove, %GewählteDatei%_Neu, %GewählteDatei%, 1
If (ErrorLevel) {
MsgBox, 8208, %WinTitel%,Error saving file`n%GewählteDatei%
Return
}
GoSub, EDITGESPEICHERT
Return
; ------------------------------------------------------------------------------
; Save file as
; ------------------------------------------------------------------------------
DATEISPEICHERNUNTER:
Gui, +OwnDialogs
Gui, Submit, NoHide
If (!EDTX) {
Return
}
If (GewählteDatei) {
SplitPath, GewählteDatei, , Verzeichnis
} Else {
Verzeichnis := A_ScriptDir
}
FileSelectFile, DateiPfad, S24, %Verzeichnis%, Save file as ...
, Skripte (*.ahk)
If (ErrorLevel) {
Return
}
FileDelete, %DateiPfad%_Neu
FileAppend, %EDTX%, %DateiPfad%_Neu
FileMove, %DateiPfad%_Neu, %DateiPfad%, 1
If (ErrorLevel) {
MsgBox, 8208, %WinTitel%, Error saving file`n%DateiPfad%
Return
}
GewählteDatei := DateiPfad
GoSub, HISTORIEAKTUALISIEREN
GoSub, EDITGESPEICHERT
Return
; ------------------------------------------------------------------------------
; Edit saved
; ------------------------------------------------------------------------------
EDITGESPEICHERT:
NachrichtenAuswerten := False
Sleep, %Verzögerung%
SB_SetText("File " GewählteDatei " has been saved!")
Sleep, 1000
SendMessage, EM_SETMODIFY, 0, 0, , ahk_id %EDTXID%
EditGeändert := False
Menu, %FMMENU%, Disable, %FMSAVE%
Menu, %FMMENU%, Disable, %FMSAVA%
Gui, +LastFound
WinSetTitle, %GewählteDatei% - %WinTitel%
GuiControl, Focus, EDTX
EditHatFokus := True
Sleep, %Verzögerung%
GoSub, EDITAKTIONEN
NachrichtenAuswerten := True
Return
; ------------------------------------------------------------------------------
; Possibly. History update
; ------------------------------------------------------------------------------
HISTORIEAKTUALISIEREN:
StringReplace, RegEx, GewählteDatei, \, \\, All
StringReplace, RegEx, RegEx, ., \., All
Jetzt := A_Now
If RegExMatch(DateiListe, "i)\d{14}" RegEx) {
Dateiliste := RegExReplace(DateiListe, "\d{14}" RegEx, Jetzt GewählteDatei)
FileDelete, %HistorienDatei%
FileAppend, %DateiListe%, %HistorienDatei%
} Else {
FileAppend, %Jetzt%%GewählteDatei%`n, %HistorienDatei%
DateiListe .= Jetzt GewählteDatei "`n"
Menu, %ZMMENU%, Add, %GewählteDatei%, LETZTEDATEIEN
If (!Historie) {
Menu, %FMMENU%, Enable, %FMHIST%
Historie := True
}
}
Return
; ------------------------------------------------------------------------------
; Last edited files
; ------------------------------------------------------------------------------
LETZTEDATEIEN:
LetzteDatei := A_ThisMenuItem
GoSub, DATEILESEN
Return
; ------------------------------------------------------------------------------
; Edit menu
; ------------------------------------------------------------------------------
MENÜBEARBEITEN:
If (A_ThisMenuItem = BMUNDO)
SendMessage, WM_UNDO, 0, 0, , ahk_id %EDTXID%
Else If (A_ThisMenuItem = BMCUT)
SendMessage, WM_CUT, 0, 0, , ahk_id %EDTXID%
Else If (A_ThisMenuItem = BMCOPY)
SendMessage, WM_COPY, 0, 0, , ahk_id %EDTXID%
Else If (A_ThisMenuItem = BMPASTE)
SendMessage, WM_PASTE, 0, 0, , ahk_id %EDTXID%
Else If (A_ThisMenuItem = BMCLEAR)
SendMessage, WM_CLEAR, 0, 0, , ahk_id %EDTXID%
Else If (A_ThisMenuItem = BMALL)
SendMessage, EM_SETSEL, 0, -1, , ahk_id %EDTXID%
Return
; ------------------------------------------------------------------------------
; Search | Replace on Hotkey
; ------------------------------------------------------------------------------
SUCHENPERHOTKEY:
If (A_ThisHotkey = "^f")
Replace := False
If (A_ThisHotkey = "^r")
Replace := True
GoSub, SUCHENGUI
Return
; ------------------------------------------------------------------------------
; Menu Search: Search | Replace
; ------------------------------------------------------------------------------
MENÜSUCHEN:
If (A_ThisMenuItem = SMFIND)
Replace := False
If (A_ThisMenuItem = SMREPL)
Replace := True
GoSub, SUCHENGUI
Return
; ------------------------------------------------------------------------------
; Search | Replace: GUI
; ------------------------------------------------------------------------------
SUCHENGUI:
FeldDimensionen("Text", W, H)
SendMessage, EM_GETSEL, &StartPos, &EndePos, , ahk_id %EDTXID%
StartPos := NumGet(StartPos)
EndePos := NumGet(EndePos)
Gui, 10:Default
Gui, +Ownwer1 +LabelGuiX +ToolWindow +AlwaysOnTop
Gui, Margin, 10, 10
Gui, Add, Text, h%H% 0x200 vSUTX, Suchbegriff:
GuiControlGet, SUTX, Pos
If (Replace)
GuiControl, , SUTX, Search:
L := StrLen(MaxZeile)
Gui, Add, Edit, ym w250 hp vSUEDSE, %SucheNach%
GuiControlGet, SUEDSE, Pos
If (Replace) {
Gui, Add, Text, xm y+5 w%SUTXW% hp 0x200, Replace:
Gui, Add, Edit, x%SUEDSEX% yp w250 hp vSUEDRP, %ErsetzeDurch%
GuiControlGet, SUEDRP, Pos
}
Gui, Add, GroupBox, xm r3 Section vSUGBO, Options
GuiControlGet, SUGBO, Pos
Gui, Add, Checkbox, xp+10 yp+25 vSUCBK, C&ase-Sensitive
GuiControlGet, SUCBK, Pos
GuiControl, , SUCBK, % (SUCBK = 1)
Gui, Add, Checkbox, xp y+5 vSUCBW, Only w&hole word
GuiControlGet, SUCBW, Pos
GuiControl, , SUCBW, % (SUCBW = 1)
If (Replace) {
Gui, Add, Checkbox, xp y+5 vSUCBB, Replace &confirm
GuiControlGet, SUCBB, Pos
GuiControl, , SUCBB, % (SUCBB = 1)
}
SUGBOW := (SUCBKW > SUCBWW ? SUCBKW : SUCBWW)
If (Replace) {
If (SUCBB > SUGBOW) {
SUGBOW := SUCBB
}
}
SUGBOW += 20
GuiControl, Move, SUGBO, w%SUGBOW%
X := SUGBOX + SUGBOW + 10
Gui, Add, GroupBox, x%X% ys r3 vSUGBR, Direction
GuiControlGet, SUGBR, Pos
Gui, Add, Radio, xp+10 yp+25 vSURBV, &Forward
GuiControlGet, SURBV, Pos
If (SURBV = "") {
SURBV := 1
}
GuiControl, , SURBV, % (SURBV = 1)
Gui, Add, Radio, xp y+5 vSURBR, &Reverse
GuiControlGet, SURBR, Pos
GuiControl, , SURBR, % (SURBR = 1)
Gui, Add, Radio, xp y+5 vSURBG, &Total
GuiControlGet, SURBG, Pos
GuiControl, , SURBG, % (SURBG = 1)
SUGBRW := SURBVW
If (SURBRW > SUGBRW) {
SUGBRW := SURBRW
}
If (SURBGW > SUGBRW) {
SUGBRW := SURBGW
}
SUGBRW += 20
GuiControl, Move, SUGBR, w%SUGBRW%
X := SUGBRX + SUGBRW + 10
Gui, Add, GroupBox, x%X% ys r3 vSUGBB, Range
GuiControlGet, SUGBB, Pos
Gui, Add, Radio, xp+10 yp+25 vSURBD gSUGRBB Checked Disabled, Whole &file
GuiControlGet, SURBD, Pos
Gui, Add, Radio, xp y+5 vSURBA gSUGRBB Disabled, In &Selection
GuiControlGet, SURBA, Pos
If (StartPos != EndePos) {
GuiControl, Enable, SURBD
GuiControl, Enable, SURBA
GuiControl, , SURBA, 1
GuiControl, , SURBV, 1
GuiControl, Disable, SURBG
}
SUGBBW := SURBDW
If (SURBAW > SUGBBW) {
SUGBBW := SURBAW
}
SUGBBW += 20
GuiControl, Move, SUGBB, w%SUGBBW%
SUEDSEW := SUGBBX + SUGBBW - SUEDSEX
GuiControl, Move, SUEDSE, w%SUEDSEW%
GuiControl, Move, SUEDRP, w%SUEDSEW%
W := SUEDSEW // 3
Gui, Add, Button, xm w%W% h%H% gSUCHENERSETZEN Default
, % (Replace ? "Replace" : "Search")
X := (SUEDSEW + SUEDSEX - W)
Gui, Add, Button, x%X% yp wp hp gGuiXClose, &Cancel
Gui, Show, AutoSize, % (Replace ? " Replace" : " Search")
Return
; Control of radio for the area selection
SUGRBB:
Gui, Submit, NoHide
If (SURBA) {
GuiControl, , SURBV, 1
GuiControl, Disable, SURBG
} Else {
GuiControl, Enable, SURBG
}
Return
; ------------------------------------------------------------------------------
; Find / Replace
; ------------------------------------------------------------------------------
SUCHENERSETZEN:
Aktion := A_GuiControl
Gui, Submit
SucheNach := SUEDSE
ErsetzeDurch := SUEDRP
Position := 0
If (SURBG)
Direction := 0
If (SURBV)
Direction := 1
If (SURBR)
Direction := 2
Gui, Destroy
If (!SucheNach) {
Return
}
Gui, 1:Default
ControlGetText, EDTX, , ahk_id %EDTXID%
If (Aktion = "Search") {
GoSub SUCHESTARTEN
} Else If (Aktion = "Replace") {
GoSub ERSETZEN
}
Return
; ------------------------------------------------------------------------------
; Start Search
; ------------------------------------------------------------------------------
SUCHESTARTEN:
NachrichtenAuswerten := False
Sleep, %Verzögerung%
If StrInStr(EDTX, SUEDSE, Position, Direction, SUCBK, SUCBW
, SURBA, StartPos, EndePos) {
; Treffer auswählen
SendMessage, EM_SETSEL, Position - 1, Position - 1 + StrLen(SUEDSE)
, , ahk_id %EDTXID%
; Weitersuchen freigeben
WeiterSuchen := True
; Zur aktuellen Zeile scrollen
GoSub, AZEILE
} Else {
Gui, +OwnDialogs
MsgBox, 8256, % " Search"
, No occurrences of "%SUEDSE% found!
SendMessage, EM_SETSEL, StartPos, EndePos, , ahk_id %EDTXID%
WeiterSuchen := False
GuiControl, Focus, EDTX
}
NachrichtenAuswerten := True
Return
; ------------------------------------------------------------------------------
; Looking for next hit
; ------------------------------------------------------------------------------
WEITERSUCHEN:
If (!WeiterSuchen) {
Return
}
NachrichtenAuswerten := False
Sleep, %Verzögerung%
If StrInStr(EDTX, SUEDSE, Position, Direction, SUCBK, SUCBW
, SURBA, StartPos, EndePos) {
SendMessage, EM_SETSEL, Position -1, Position - 1 + StrLen(SUEDSE)
, , ahk_id %EDTXID%
GoSub, AZEILE
} Else {
Gui, +OwnDialogs
MsgBox, 8256, % " Search"
, No further occurrences of "%SUEDSE% found!
WeiterSuchen := False
SendMessage, EM_SETSEL, StartPos, EndePos, , ahk_id %EDTXID%
GuiControl, Focus, EDTX
}
NachrichtenAuswerten := True
Return
; ------------------------------------------------------------------------------
; Replace
; ------------------------------------------------------------------------------
ERSETZEN:
LänDiff := StrLen(SUEDRP) - StrLen(SUEDSE)
Bestätigen := SUCBB
PosDiff := Ersetzt := W1 := W2 := 0
If (Bestätigen) {
IconDLL := A_WinDir "\System32\User32.dll"
Gui, 10:Default
Gui, +Owner1 +AlwaysOnTop +ToolWindow +LabelGuiX
Gui, Margin, 10, 10
Gui, Add, Pic, Section Icon%IconFrage%, %IconDLL%
Gui, Add, Text, ys, Should this occurrence be replaced?
StringUpper, T1, SUEDSE
StringUpper, T2, SUEDRP
FeldDimensionen("""" T1 """ --> """ T2 """", W, H)
Gui, Add, Text, xp y+5 w%W% vTXRP
FeldDimensionen("Ja, für Alle", W1, H)
FeldDimensionen("Abbrechen", W2, H)
W := (W1 > W2 ? W1 : W2)
W += 10
Gui, Add, Button, xs w%W% Section Default vBESTJ gBESTÄTIGEN, &Ja
Gui, Add, Button, ys wp vBESTN gBESTÄTIGEN, &Nein
Gui, Add, Button, ys wp vBESTA gBESTÄTIGEN, Ja, &für Alle
Gui, Add, Button, ys wp vBESTX gBESTÄTIGEN, &Abbrechen
Gui, Show, Hide, % " Confirm"
} Else {
; GuiControl, -Redraw, EDTX
; GuiControl, -Redraw, EDLN
SendMessage, WM_SETREDRAW, False, 0, , ahk_id %EDTXID%
SendMessage, WM_SETREDRAW, False, 0, , ahk_id %EDLNID%
}
NachrichtenAuswerten := False
Sleep, %Verzögerung%
Loop {
If StrInStr(EDTX, SUEDSE, Position, Direction, SUCBK, SUCBW
, SURBA, StartPos, EndePos) {
SendMessage, EM_SETSEL
, Position + PosDiff - 1
, Position + PosDiff - 1 + StrLen(SUEDSE)
, , ahk_id %EDTXID%
If (Bestätigen) {
GoSub, AZEILE
Gui, 10:Default
Gui, +LastFound
ControlGet, Auswahl, Selected, , , ahk_id %EDTXID%
GuiControl, , TXRP, "%Auswahl%" --> "%SUEDRP%"
Gui, 1:+Disabled
Gui, Show
WinWaitActive
Loop {
Sleep, 100
IfWinNotExist
Break
WinGet, Style, Style
If !(Style & WS_VISIBLE) {
Break
}
}
If (Abbruch) {
MsgBox, 8208, % " Replace"
, Replace wurde abgebrochen!
Abbruch := False
Break
}
If (!Bestätigt) {
Continue
}
}
SendMessage, EM_REPLACESEL, True, &SUEDRP, , ahk_id %EDTXID%
Ersetzt++
EndePos += LänDiff
If (!SURBA) {
StartPos := EndePos
}
If (Direction != 2) {
PosDiff += LänDiff
}
} Else {
SendMessage, WM_SETREDRAW, True, 0, , ahk_id %EDTXID%
SendMessage, WM_SETREDRAW, True, 0, , ahk_id %EDLNID%
Gui, +OwnDialogs
If (Ersetzt) {
MsgBox, 8256, % " Replace"
, "%SUEDSE%" wurde %Ersetzt% Mal ersetzt!
} Else {
MsgBox, 8240, % " Replace"
, No (further) occurrence of "%SUEDSE%" found!
}
WeiterSuchen := False
SendMessage, EM_SETSEL, StartPos, EndePos, , ahk_id %EDTXID%
GuiControl, Focus, EDTX
Break
}
}
If (Bestätigen) {
Gui, 10:Destroy
}
NachrichtenAuswerten := True
; GoSub, AZEILE
Return
; ------------------------------------------------------------------------------
BESTÄTIGEN:
Gui, 1:-Disabled
Gui, Submit
If (A_GuiControl = "BESTJ") {
Bestätigt := True
} Else If (A_GuiControl = "BESTN") {
Bestätigt := False
} Else If (A_GuiControl = "BESTA") {
Bestätigt := True
Bestätigen := False
Gui, Destroy
} Else {
Abbruch := True
}
Return
; ------------------------------------------------------------------------------
; Menu Search: Go to line
; ------------------------------------------------------------------------------
MENÜGEHEZU:
FeldDimensionen("Text", W, H)
Gui, 10:Default
Gui, +Ownwer1 +LabelGuiX +ToolWindow
Gui, Margin, 10, 10
Gui, Add, Text, h%H% 0x200 cBlue, Zeilennummer:
L := StrLen(MaxZeile)
Gui, Add, Edit, ym w100 Number Limit%L% Right vEDGO, %GeheZuZeile%
GuiControlGet, EDGO, Pos
W := (EDGOW + EDGOX - 10 - 20) // 2
Gui, Add, Button, xm w%W% gGEHEZUZEILE Default, OK
X := (EDGOW + EDGOX - W)
Gui, Add, Button, x%X% yp wp gGuiXClose, &Abbrechen
Gui, Show, , % " Gehe zu Zeile"
Return
; ------------------------------------------------------------------------------
; Go to line
; ------------------------------------------------------------------------------
GEHEZUZEILE:
Gui, Submit
Gui, Destroy
If (!EDGO) {
GuiControl, Focus, EDTX
Return
}
GeheZuZeile := EDGO
GoSub, GEHEZU
Return
; ------------------------------------------------------------------------------
; Bookmarks on Hotkey create | delete
; ------------------------------------------------------------------------------
TEXTMARKEN:
If (SubStr(A_ThisHotkey, 1, 2) = "^+") {
Index := SubStr(A_ThisHotkey, 3)
TM%Index% := 0
Menu, %TMNEWMENU%, UnCheck, % TMITEM%Index%
Menu, %TMGOMENU%, UnCheck, % TMITEM%Index%
Menu, %TMGOMENU%, Disable, % TMITEM%Index%
Menu, %TMLOMENU%, UnCheck, % TMITEM%Index%
Menu, %TMLOMENU%, Disable, % TMITEM%Index%
GuiControl, Disable, BTM%Index%
} Else {
Index := SubStr(A_ThisHotkey, 2)
TM%Index% := AktZeile
Menu, %TMNEWMENU%, Check, % TMITEM%Index%
Menu, %TMGOMENU%, Enable, % TMITEM%Index%
Menu, %TMGOMENU%, Check, % TMITEM%Index%
Menu, %TMLOMENU%, Enable, % TMITEM%Index%
Menu, %TMLOMENU%, Check, % TMITEM%Index%
GuiControl, Enable, BTM%Index%
}
Return
; ------------------------------------------------------------------------------
; All bookmarks delete
; ------------------------------------------------------------------------------
TEXTMARKENLÖSCHEN:
Loop, %MaxTextmarken% {
TM%A_Index% := 0
ThisMenuItem := TMITEM%A_Index%
TMITEM%A_Index% := "Textmarke " A_Index
Menu, %TMNEWMENU%, UnCheck, %ThisMenuItem%
Menu, %TMGOMENU%, UnCheck, %ThisMenuItem%
Menu, %TMGOMENU%, Disable, %ThisMenuItem%
Menu, %TMLOMENU%, UnCheck, %ThisMenuItem%
Menu, %TMLOMENU%, Disable, %ThisMenuItem%
If (ThisMenuItem != TMITEM%A_Index%) {
Menu, %TMNEWMENU%, Rename, %ThisMenuItem%, % TMITEM%A_Index%
Menu, %TMGOMENU%, Rename, %ThisMenuItem%, % TMITEM%A_Index%
Menu, %TMLOMENU%, Rename, %ThisMenuItem%, % TMITEM%A_Index%
}
GuiControl, Disable, BTM%A_Index%
}
Return
; ------------------------------------------------------------------------------
; Menu text marks show
; ------------------------------------------------------------------------------
MENU_TEXTMARKEN:
ThisMenuItem := A_ThisMenuItem
ThisMenuItemPos := A_ThisMenuItemPos
If (A_ThisMenu = TMNEWMENU) {
TM%ThisMenuItemPos% := AktZeile
TMITEM%ThisMenuItemPos% := "Zeile " AktZeile
Menu, %TMNEWMENU%, Check, %ThisMenuItem%
Menu, %TMGOMENU%, Enable, %ThisMenuItem%
Menu, %TMGOMENU%, Check, %ThisMenuItem%
Menu, %TMLOMENU%, Enable, %ThisMenuItem%
Menu, %TMLOMENU%, Check, %ThisMenuItem%
Menu, %TMNEWMENU%, Rename, %ThisMenuItem%, % TMITEM%ThisMenuItemPos%
Menu, %TMGOMENU%, Rename, %ThisMenuItem%, % TMITEM%ThisMenuItemPos%
Menu, %TMLOMENU%, Rename, %ThisMenuItem%, % TMITEM%ThisMenuItemPos%
GuiControl, Enable, BTM%ThisMenuItemPos%
}
Else If (A_ThisMenu = TMGOMENU) {
If (TM%ThisMenuItemPos%) {
EDGO := TM%ThisMenuItemPos%
GoSub, GEHEZU
GoSub, EDITAKTIONEN
}
}
Else If (A_ThisMenu = TMLOMENU) {
TM%ThisMenuItemPos% := 0
TMITEM%ThisMenuItemPos% := "Textmarke " A_ThisMenuItemPos
Menu, %TMNEWMENU%, UnCheck, %ThisMenuItem%
Menu, %TMGOMENU%, UnCheck, %ThisMenuItem%
Menu, %TMGOMENU%, Disable, %ThisMenuItem%
Menu, %TMLOMENU%, UnCheck, %ThisMenuItem%
Menu, %TMLOMENU%, Disable, %ThisMenuItem%
Menu, %TMNEWMENU%, Rename, %ThisMenuItem%, % TMITEM%ThisMenuItemPos%
Menu, %TMGOMENU%, Rename, %ThisMenuItem%, % TMITEM%ThisMenuItemPos%
Menu, %TMLOMENU%, Rename, %ThisMenuItem%, % TMITEM%ThisMenuItemPos%
GuiControl, Disable, BTM%ThisMenuItemPos%
}
Return
; ------------------------------------------------------------------------------
; Go to bookmark
; ------------------------------------------------------------------------------
GOTM:
TMIndex := SubStr(A_GuiControl, 4)
If (EDGO := TM%TMIndex%) {
GoSub, GEHEZU
}
Return
; ------------------------------------------------------------------------------
; View menu show
; ------------------------------------------------------------------------------
MENÜ_ANSICHT:
If (A_ThisMenuItem = VMZNR) {
ZeilenNummern := !ZeilenNummern
Menu, %VMMENU%, ToggleCheck, %A_ThisMenuItem%
GoSub, FELDERPOSITIONIEREN
}
Return
; ------------------------------------------------------------------------------
; Evaluating the Tools menu
; ------------------------------------------------------------------------------
TOOLMENÜ:
Return
; ------------------------------------------------------------------------------
; Go to line
; ------------------------------------------------------------------------------
GEHEZU:
If (A_GuiControl = "GEHEZU") {
GuiControlGet, EDGO
} Else If (A_GuiControl = "EZEILE") {
EDGO := 1
} Else IF (A_GuiControl = "LZEILE") {
SendMessage, EM_GETLINECOUNT, 0, 0, , ahk_id %EDTXID%
EDGO := ErrorLevel
}
If (!EDGO) {
GuiControl, Focus, EDTX
Return
}
SendMessage, EM_LINEINDEX, EDGO - 1, 0, , ahk_id %EDTXID%
If (ErrorLevel > 0x7FFFFFFF) { ; -1
MsgBox, 8240, %WinTitel%, %EDGO% line does not exist!
GuiControl, Focus, EDTX
Return
}
GeheZuPos := ErrorLevel
; SendMessage, EM_LINELENGTH, GeheZuPos, 0, , ahk_id %EDTXID%
; StartPos += ErrorLevel
SendMessage, EM_SETSEL, GeheZuPos, GeheZuPos, , ahk_id %EDTXID%
GoSub, AZEILE
Return
; ------------------------------------------------------------------------------
; For the current line scrolling
; ------------------------------------------------------------------------------
AZEILE:
SendMessage, EM_SCROLLCARET, 0, 0, , ahk_id %EDTXID%
SendMessage, EM_LINEFROMCHAR, -1, 0, , ahk_id %EDTXID%
ZeilenDiff := ErrorLevel
SendMessage, EM_GETFIRSTVISIBLELINE, 0, 0, , ahk_id %EDTXID%
ZeilenDiff -= (ErrorLevel + 4)
SendMessage, EM_LINESCROLL, 0, ZeilenDiff, , ahk_id %EDTXID%
GuiControl, Focus, EDTX
GoSub, EDITAKTIONEN
Return
; ------------------------------------------------------------------------------
; Determining the aktellen row and column, possibly marks update
; and show the line numbers synchronize
; ------------------------------------------------------------------------------
EDITAKTIONEN:
NachrichtenAuswerten := False
Sleep, %Verzögerung%
SendMessage, EM_GETLINECOUNT, 0, 0, , ahk_id %EDTXID%
If (ZeilenZahl != ErrorLevel) {
ZeilenDiff := ErrorLevel - ZeilenZahl
ZeilenZahl := ErrorLevel
ZN := ""
If (ZeilenDiff > 0) {
Loop, %ZeilenDiff% {
MaxZeile++
ZN .= "`r`n" MaxZeile
}
SendMessage, EM_SETSEL, -2, -1, , ahk_id %EDLNID%
SendMessage, EM_REPLACESEL, False, &ZN, , ahk_id %EDLNID%
}Else {
MaxZeile += ZeilenDiff
ZN := ""
SendMessage, EM_LINEINDEX, MaxZeile, 0, , ahk_id %EDLNID%
SendMessage, EM_SETSEL, ErrorLevel - 2, -1, , ahk_id %EDLNID%
SendMessage, EM_REPLACESEL, False, &ZN, , ahk_id %EDLNID%
}
If (StrLen(MaxZeile) != StrLen(MaxZeileAlt)) {
GoSub, FELDERPOSITIONIEREN
MaxZeileAlt := MaxZeile
}
SendMessage, EM_LINEFROMCHAR, -1, 0, , ahk_id %EDTXID%
ErrorLevel++
Loop, %MaxTextmarken% {
If (ErrorLevel < (TM%A_Index% + ZeilenDiff)) {
TM%A_Index% += ZeilenDiff
}
}
}
VarSetCapacity(Caret, 8, 0)
DllCall("GetCaretPos", "UInt", &Caret)
MPos := NumGet(Caret) + (NumGet(Caret, 4) << 16)
SendMessage, EM_CHARFROMPOS, 0, MPOS, , ahk_id %EDTXID%
CaretPos := (ErrorLevel & 0xFFFF) + 1
CaretZeile := ErrorLevel >> 16
SendMessage, EM_LINEINDEX, CaretZeile, 0, , ahk_id %EDTXID%
CaretPos -= ErrorLevel
If (AktZeile <> (CaretZeile + 1)) {
AktZeile := CaretZeile + 1
SendMessage, EM_LINEINDEX, CaretZeile, 0, , ahk_id %EDLNID%
SendMessage, EM_SETSEL, ErrorLevel, ErrorLevel + StrLen(AktZeile)
, , ahk_id %EDLNID%
}
SendMessage, WM_GETTEXTLENGTH, 0, 0, , ahk_id %EDTXID%
SB_SetText(AktZeile "/" CaretPos " [" ZeilenZahl "/" ErrorLevel "]")
SendMessage, EM_GETFIRSTVISIBLELINE, 0, 0, , ahk_id %EDTXID%
If (ErrorLevel != ObersteZeile) {
ObersteZeile := ErrorLevel
SendMessage, EM_GETFIRSTVISIBLELINE, 0, 0, , ahk_id %EDLNID%
SendMessage, EM_LINESCROLL, 0, ObersteZeile - ErrorLevel, , ahk_id %EDLNID%
}
NachrichtenAuswerten := True
Return
; ------------------------------------------------------------------------------
; Monitor mouse clicks Zeilennummernedit, corresponding lines in
; Select TextEdit
; ------------------------------------------------------------------------------
EDLNKLICKS:
If (MausAktion = "DBL") {
VarSetCapacity(ZeilenInhalt, 1024, 0)
NumPut(1024, ZeilenInhalt)
SendMessage, EM_CHARFROMPOS, 0, MausPos, , ahk_id %EDLNID%
ZeilenIndex := ErrorLevel >> 16
SendMessage, EM_GETLINE, ZeilenIndex, &ZeilenInhalt, , ahk_id %EDTXID%
VarSetCapacity(ZeilenInhalt, -1)
SendMessage, EM_LINEINDEX, ZeilenIndex, 0, , ahk_id %EDTXID%
SendMessage, EM_SETSEL, ErrorLevel, ErrorLevel + StrLen(ZeilenInhalt)
, , ahk_id %EDTXID%
GoSub, EDITAKTIONEN
} Else If (MausAktion = "DOWN") {
SendMessage, EM_CHARFROMPOS, 0, MausPos, , ahk_id %EDLNID%
StartIndex := ErrorLevel >> 16
SendMessage, EM_LINEINDEX, StartIndex, 0, , ahk_id %EDTXID%
SendMessage, EM_POSFROMCHAR, ErrorLevel, 0, , ahk_id %EDTXID%
SendMessage, WM_LBUTTONDOWN, MK_LBUTTON, ErrorLevel, , ahk_id %EDTXID%
}
Return
; ------------------------------------------------------------------------------
; Width of the ListBox for correct line numbers and position of übbrigen
; Customize Fields
; ------------------------------------------------------------------------------
FELDERPOSITIONIEREN:
If (Zeilennummern) {
FeldDimensionen(MaxZeile, W, H, SchriftAttr, SchriftName)
} Else {
W := 0
}
DW := W - EDLNW
GuiControl, MoveDraw, EDLN, % "w" (EDLNW += DW)
GuiControl, MoveDraw, EDTX, % "x" (EDTXX += DW) " w" (EDTXW -= DW)
GuiControl, MoveDraw, AZEILE, % "x" (AZEILEX += DW)
GuiControl, MoveDraw, EZEILE, % "x" (EZEILEX += DW)
GuiControl, MoveDraw, LZEILE, % "x" (LZEILEX += DW)
Loop, %MaxTextmarken% {
GuiControl, MoveDraw, BTM%A_Index%, % "x" (BTM%A_Index%X += DW)
}
Return
; ------------------------------------------------------------------------------
; Hotkeys
; ------------------------------------------------------------------------------
#IfWinActive ahk_group GUI
; HotKeys for Edit
*~BS::
*~Up::
*~Right::
*~Down::
*~Left::
If (EditHatFokus) {
GoSub, EDITAKTIONEN
}
Return
; Hotkeys für die GUI
^n::GoSub, NEUEDATEI
^o::GoSub, DATEILESEN
^q::Gosub, GuiClose
^s::GoSub, DATEISPEICHERN
^+s::GoSub, DATEISPEICHERNUNTER
^f::GoSub, SUCHENPERHOTKEY
^r::GoSub, SUCHENPERHOTKEY
^g::GoSub, MENÜGEHEZU
F3::GoSub, WEITERSUCHEN
!0::GoSub, AZEILE
#IfWinActive
; ------------------------------------------------------------------------------
; Funktionen
; ------------------------------------------------------------------------------
EDTXNachrichten(H, M, W, L) {
; News show, which go directly to EDTX
Global
If (NachrichtenAuswerten) {
If (M = WM_VSCROLL Or M = EM_SCROLL Or M = WM_LBUTTONDOWN
Or M = WM_LBUTTONUP Or M = WM_LBUTTONDBLCLK) {
SetTimer, EDITAKTIONEN, -%Verzögerung%
}
}
Return DllCall("CallWindowProcA"
, UInt, HEDTXMSG
, UInt, H
, UInt, M
, UInt, W
, UInt, L)
}
; ------------------------------------------------------------------------------
EDLNNachrichten(H, M, W, L) {
; News show, which go directly to EDLN
Global
If (M = WM_SETCURSOR Or M = WM_RBUTTONUP )
Return 0
If (M = WM_LBUTTONDBLCLK) {
MausAktion := "DBL"
MausPos := L
SetTimer, EDLNKLICKS, -%Verzögerung%
Return 0
}
If (M = WM_LBUTTONDOWN) {
MausAktion := "DOWN"
MausPos := L
SetTimer, EDLNKLICKS, -%Verzögerung%
Return 0
}
Return DllCall("CallWindowProcA"
, UInt, HEDLNMSG
, UInt, H
, UInt, M
, UInt, W
, UInt, L)
}
; ------------------------------------------------------------------------------
Benachrichtigungen(W, L) {
; Notifications of the boxes show
Global
Static EN_SETFOCUS := 0x100
Static EN_KILLFOCUS := 0x200
Static EN_CHANGE := 0x300
Static EN_UPDATE := 0x400
Static EN_HSCROLL := 0x601
Static EN_VSCROLL := 0x602
Local Msg
If (NachrichtenAuswerten) {
Msg := W >> 16
If (L = EDTXID) {
If (Msg = EN_CHANGE) {
SendMessage, WM_GETTEXTLENGTH, 0, 0, , ahk_id %EDTXID%
If (!ErrorLevel) {
Menu, %FMMENU%, Disable, %FMSAVE%
Menu, %FMMENU%, Disable, %FMSAVA%
SendMessage, EM_SETMODIFY, 0, 0, , ahk_id %EDTXID%
EditGeändert := False
} Else {
If (GewählteDatei) {
Menu, %FMMENU%, Enable, %FMSAVE%
}
Menu, %FMMENU%, Enable, %FMSAVA%
EditGeändert := True
}
EditHatFokus := True
SetTimer, EDITAKTIONEN, -%Verzögerung%
} Else If (Msg = EN_UPDATE) {
SendMessage, EM_GETLINECOUNT, 0, 0, , ahk_id %EDTXID%
If (ErrorLevel > MaxZeilen) {
ControlSend, , {BS}, ahk_id %EDTXID%
}
EditHatFokus := True
} Else If (Msg = EN_SETFOCUS) {
EditHatFokus := True
SetTimer, EDITAKTIONEN, -%Verzögerung%
} Else If (Msg = EN_KILLFOCUS) {
EditHatFokus := False
} Else If (Msg = EN_VSCROLL) {
SetTimer, EDITAKTIONEN, -%Verzögerung%
}
}
}
}
; ------------------------------------------------------------------------------
Mauskontrolle(W, L, M, H) {
; Mouse position on the GUI control
Global
Static HAlt := ""
Local HAkt := 0
Local Txt := ""
Local Point
If (NachrichtenAuswerten) {
If (H = GuiID) {
; Das Folgende ist ein Ersatz für
; MouseGetPos, , , , HAkt, 2
VarSetCapacity(Point, 8, 0)
NumPut(L & 0xFFFF, Point, 0, "Int")
NumPut(L >> 16, Point, 4, "Int")
HAkt := DllCall("ChildWindowFromPoint"
, "Int", H
, "Int64", NumGet(Point, 0, "Int64"))
; Den NumGet(Point, 0, "Int64") habe ich hier ->
; http://www.autohotkey.com/forum/topic37160.html
; geklaut. Wäre ich nie drauf gekommen!
} Else {
HAkt := H
}
If (HAkt != HAlt) {
If (HAkt = EDLNID) {
DllCall("ReleaseCapture")
} Else If (HAkt = EDTXID) {
SendMessage, WM_GETTEXTLENGTH, 0, 0, , ahk_id %EDTXID%
Txt := AktZeile "/" CaretPos " [" ZeilenZahl "/" ErrorLevel "]"
} Else If (HAkt = AZEILEID) {
Txt := "Sprung zur aktuellen Zeile (Zeile " AktZeile ")"
} Else If (HAkt = EZEILEID) {
Txt := "Jump to the first line"
} Else If (HAkt = LZEILEID) {
Txt := "Skip to the last line"
} Else {
Loop, %MaxTextmarken% {
If (HAkt = BTM%A_Index%ID) {
If (TM%A_Index%) {
Txt := "Jump to Bookmark 1 (Zeile " TM%A_Index% ")"
} Else {
Txt := "Bookmark " A_Index " does not exist"
}
Break
}
}
}
SB_SetText(Txt)
HAlt := HAkt
}
}
}
; ------------------------------------------------------------------------------
FeldDimensionen(Text, ByRef W, ByRef H, SAttr = "", SName = "") {
; Height and width of a single-edits for a given text and
; and possibly font and font attributes
; Font and font attributes take
Gui, 55:Font, %SAttr%, %SName%
; Edit fill
Gui, 55:Add, Edit, hwndHWND, %Text%
; Width and height holen
ControlGetPos, , , W, H, , ahk_id %HWND%
; And from this!
Gui, 55:Destroy
}
; ------------------------------------------------------------------------------
; StrInStr()
; Funktion:
; Looking for a needle in a haystack (string in string)
; Parameter:
; Haystack ByRef to search string
; Nadel ByRef Suchbegriff
; Position ByRef Match position
; Character position with 1-based
; 0 = New Search
; Suchrichtung Optional Search / range
; 0 = Total
; 1 = forward
; 2 = backward
; Standard: 0
; MatchCase Optional Case Sensitive
; 0|1 = nein|ja
; Standard: 0
; GanzesWort Optional Only "whole word" search
; 0|1 = nein|ja
; Standard: 0
; Auswahl Optional Only in select Search
; 0|1 = nein|ja
; Standard: 0
; StartPos Optional Beginning of the current selection
; Character position with base 0
; Standard: 0
; EndePos Optional End of the current selection
; Character position with base 0
; Standard: 0
; Rückgabewerte:
; Returncode 1 (True) : Match
; 0 (False) : No matches
; Position Position of the first mark and hit 1-based
; ------------------------------------------------------------------------------
StrInStr(ByRef HeuHaufen ; What search
, ByRef Nadel ; What are
, ByRef Position ; 0 = first hit search
, Suchrichtung = 1 ; How to search
, GroßKlein = 0 ; Large-\ sensitive
, GanzesWort = 0 ; Only whole word search
, Auswahl = 0 ; In selecting search
, StartPos = 0 ; In Auswahl suchen: Startposition
, EndePos = 0) ; Selection: A position -
{
Static Distanz ; Distance to start / end
Static Länge ; Length of"Haystacks"
Static Richtung ; Search (L|R)
; ---------------------------------------------------------------------------
; Offset Calculate
If (Position = 0) {
; Erste Suche
Pos := Position
Länge := StrLen(HeuHaufen)
Richtung := (Suchrichtung = 2 ? "R" : "L")
If (Suchrichtung = 1) {
Distanz := StartPos
} Else If (Suchrichtung = 2) {
Distanz := Länge - EndePos - 1
} Else {
Distanz := 0
}
} Else {
; Find Next
Pos := Position - 1
If (Suchrichtung = 2) {
Distanz := Länge - Pos - 1
} Else {
Distanz := Pos + StrLen(Nadel)
}
}
; ---------------------------------------------------------------------------
; For the first time in my career AHK I used StringGetPos,
; because they enable both forward and backward with a predetermined
; Distance to the beginning or the end to find
Loop {
StringGetPos, Pos, HeuHaufen, %Nadel%, %Richtung%, %Distanz%
If (ErrorLevel) {
Return False
}
; ------------------------------------------------------------------------
; Verify that the result of the search with all the StringGetPos
; Conditions
; If the hit if necessary, within the range?
If (Auswahl) {
If (Pos < StartPos Or Pos > (EndePos - StrLen(Nadel))) {
Return False
}
}
; If necessary, he met the conditions "whole word" / "letters"
If (GroßKlein Or GanzesWort) {
RX1 := (GroßKlein ? "" : "i)") (GanzesWort ? "\b" : "") "\Q"
RX2 := "\E" (GanzesWort ? "\b" : "")
RXStart:= Pos + 1 - (GanzesWort And Pos > 0)
RXLänge := StrLen(Nadel) + (GanzesWort * 2)
If RegExMatch(SubStr(HeuHaufen, RXStart, RXLänge), RX1 Nadel RX2) {
Position := Pos + 1
Return True
}
} Else {
Position := Pos + 1
Return True
}
; ------------------------------------------------------------------------
; Distance for the next run
If (Richtung = "R") {
Distanz := StrLen(HeuHaufen) - Pos - 1
} Else {
Distanz := Pos + StrLen(Nadel)
}
}
Return False
}
Cheers, ribbet.1