Auch diese Thema muss ich mal wieder aus Archiv-Kiste ziehen um ein paar Updates zu geben.
Hier mal eine aktuelle Version eines meiner wichtigsten Werkzeuge:
Schlüsselwort schließen oder Zwischen-Schlüsselwort einfügen
Typische Werkzeugeinstellungen für Schlüsselwort schließen (z.B. EndIf zum If):
Argumente: "%TEMPFILE" 0
Tastenkürzel: ALT + EINGABE
[x] Warte bis zum Beenden des Werkzeugs
Typische Werkzeugeinstellungen für Zwischen-Schlüsselwort einfügen (z.B. Case zum Select):
Argumente: "%TEMPFILE" 1
Tastenkürzel: UMSCHALT + EINGABE
[x] Warte bis zum Beenden des Werkzeugs
Quellcode: (! Benötigt außerdem die SyntaxHilighting.lib und SyntaxHilighting.dll aus PureBasic\SDK\Syntax Highlighting !)
Code: Alles auswählen
Enumeration
	#SYNTAX_Text
	#SYNTAX_Keyword  
	#SYNTAX_Comment
	#SYNTAX_Constant
	#SYNTAX_String
	#SYNTAX_Function
	#SYNTAX_Asm
	#SYNTAX_Operator
	#SYNTAX_Structure
	#SYNTAX_Number
	#SYNTAX_Pointer
	#SYNTAX_Separator
	#SYNTAX_Label  
EndEnumeration
Prototype SyntaxHighlightCallback(*Position, Length.i, Color.i)
Import "SyntaxHilighting.lib"
	SyntaxHighlight(*Buffer, Length.i, Callback.SyntaxHighlightCallback, ASM.i)
EndImport
Global NewList *Keyword.String()
Global NewMap Keyword.String()
Global NewMap CloseKeyword.i()
Global NewMap BetweenKeyword.String()
Procedure GetProcessFromWindow(WindowID.i)
	Protected ProcessID.i
	If GetWindowThreadProcessId_(WindowID, @ProcessID)
		ProcedureReturn OpenProcess_(#PROCESS_ALL_ACCESS, #False, ProcessID)
	EndIf
EndProcedure
Procedure SendText(Text.s)
	Protected ScintillaID.i = Val(GetEnvironmentVariable("PB_TOOL_Scintilla"))
	Protected ProcessID.i = GetProcessFromWindow(ScintillaID)
	Protected Length.i, *MemoryID, *Buffer, Format.i
	If ProcessID
		Select SendMessage_(ScintillaID, #SCI_GETCODEPAGE, #Null, #Null)
			Case 0     : Format = #PB_Ascii
			Case 65001 : Format = #PB_UTF8
		EndSelect
		Length.i = StringByteLength(Text, Format)
		*Buffer = AllocateMemory(Length+SizeOf(Character))
		If *Buffer
			PokeS(*Buffer, Text, #PB_Default, Format)
			*MemoryID = VirtualAllocEx_(ProcessID, #Null, Length, #MEM_RESERVE|#MEM_COMMIT, #PAGE_EXECUTE_READWRITE)
			If *MemoryID
				WriteProcessMemory_(ProcessID, *MemoryID, *Buffer, Length, #Null)
				SendMessage_(ScintillaID, #SCI_ADDTEXT, Length, *MemoryID)
				VirtualFreeEx_(ProcessID, *MemoryID, Length, #MEM_RELEASE)
			EndIf
			FreeMemory(*Buffer)
		EndIf
		CloseHandle_(ProcessID)
	EndIf
EndProcedure
Procedure Callback(*Position, Length.i, Color.i)
	Protected Name.s
	Select Color
		Case #SYNTAX_Keyword
			Name = RemoveString(RemoveString(PeekS(*Position, Length, #PB_UTF8|#PB_ByteLength), " "), #TAB$)
			If FindMapElement(Keyword(), Name)
				AddElement(*Keyword())
				*Keyword() = @Keyword()
			ElseIf FindMapElement(CloseKeyword(), Name)
				If LastElement(*Keyword())
					DeleteElement(*Keyword())
				EndIf
			EndIf
	EndSelect
EndProcedure
; Definition of corresponding close-keywords
Keyword("CompilerIf")\s        = "CompilerEndIf"
Keyword("CompilerSelect")\s    = "CompilerEndSelect"
Keyword("DataSection")\s       = "EndDataSection"
Keyword("DeclareModule")\s     = "EndDeclareModule"
Keyword("EnableASM")\s         = "DisableASM"
Keyword("EnableDebugger")\s    = "DisableDebugger"
Keyword("EnableExplicit")\s    = "DisableExplicit"
Keyword("Enumeration")\s       = "EndEnumeration"
Keyword("EnumerationBinary")\s = "EndEnumeration"
Keyword("For")\s               = "Next"
Keyword("ForEach")\s           = "Next"
Keyword("If")\s                = "EndIf"
Keyword("Import")\s            = "EndImport"
Keyword("ImportC")\s           = "EndImport"
Keyword("Interface")\s         = "EndInterface"
Keyword("Macro")\s             = "EndMacro"
Keyword("Module")\s            = "EndModule"
Keyword("Procedure")\s         = "EndProcedure"
Keyword("ProcedureC")\s        = "EndProcedure"
Keyword("ProcedureDLL")\s      = "EndProcedure"
Keyword("ProcedureCDLL")\s     = "EndProcedure"
Keyword("Repeat")\s            = "ForEver"
Keyword("Select")\s            = "EndSelect"
Keyword("Structure")\s         = "EndStructure"
Keyword("StructureUnion")\s    = "EndStructureUnion"
Keyword("With")\s              = "EndWith"
Keyword("While")\s             = "Wend"
; Definition of corresponding in-between-keywords
BetweenKeyword("CompilerEndIf")\s     = "CompilerElse"
BetweenKeyword("CompilerEndSelect")\s = "CompilerCase"
BetweenKeyword("EndIf")\s             = "Else"
BetweenKeyword("EndSelect")\s         = "Case"
BetweenKeyword("EndProcedure")\s      = "ProcedureReturn"
BetweenKeyword("ForEver")\s           = "Until"
BetweenKeyword("Next")\s              = "Break"
BetweenKeyword("Wend")\s              = "Break"
; Definition of close-keywords
CloseKeyword("CompilerEndIf")     = #True
CloseKeyword("CompilerEndSelect") = #True
CloseKeyword("DisableASM")        = #True
CloseKeyword("DisableDebugger")   = #True
CloseKeyword("DisableExplicit")   = #True
CloseKeyword("EndDataSection")    = #True
CloseKeyword("EndEnumeration")    = #True
CloseKeyword("Next")              = #True
CloseKeyword("EndIf")             = #True
CloseKeyword("EndImport")         = #True
CloseKeyword("EndInterface")      = #True
CloseKeyword("EndMacro")          = #True
CloseKeyword("EndProcedure")      = #True
CloseKeyword("Until")             = #True
CloseKeyword("ForEver")           = #True
CloseKeyword("EndDeclareModule")  = #True
CloseKeyword("EndModule")         = #True
CloseKeyword("EndSelect")         = #True
CloseKeyword("EndStructure")      = #True
CloseKeyword("EndStructureUnion") = #True
CloseKeyword("EndWith")           = #True
CloseKeyword("Wend")              = #True
Enumeration
	#File
EndEnumeration
Define String.s
Define FileName.s = ProgramParameter(0)
Define Flag.i = Val(ProgramParameter(1))
Define Selection.s = GetEnvironmentVariable("PB_TOOL_Selection")
Define Row.i = Val(StringField(Selection, 1, "x"))
Define Column.i = Val(StringField(Selection, 2, "x"))
Define Line.i = 1
Define Format.i
If ReadFile(#File, FileName)
	Select ReadStringFormat(#File)
		Case #PB_Ascii   : Format = #PB_Ascii
		Case #PB_UTF8    : Format = #PB_UTF8
		Case #PB_Unicode : Format = #PB_Unicode
	EndSelect
	While Line < Row
		String = ReadString(#File, Format)
		*Buffer = UTF8(String)
		SyntaxHighlight(*Buffer, StringByteLength(String, #PB_UTF8), @Callback(), #False)
		FreeMemory(*Buffer)
		Line + 1 
	Wend
	String = ReadString(#File, Format)
	*Buffer = UTF8(String)
	SyntaxHighlight(*Buffer, StringByteLength(Left(String, Column-1), #PB_UTF8), @Callback(), #False)
	FreeMemory(*Buffer)
	If LastElement(*Keyword())
		If Flag
			SendText(BetweenKeyword(*Keyword()\s)\s)
		Else
			SendText(*Keyword()\s)
		EndIf
	EndIf
	CloseFile(#File)
EndIf