#cs ==== Aufruf über SciTE Menü (SciTEUser.properties entry:) === #40 Save With Time Stamp command.40.*.au3="$(autoit3dir)\autoit3.exe" "C:\SHARE\Code_AutoIt\TEST\SaveWithTimeStamp.au3" command.name.40.*.au3=SaveWithTimeStamp command.save.before.40.*.au3=1 command.is.filter.40.*.au3=1 command.shortcut.40.*.au3=Ctrl+Shift+Alt+T #ce ============================================================== Opt("WinSearchChildren", 1) Global Const $WM_COPYDATA = 74, $IDM_SAVE = 106 Global $My_Hwnd, $Scite_hwnd, $My_Dec_Hwnd, $SciTECmd, $sReceive = '' Local $sFile, $sSelection, $iLine _StartUpSciTEInterface() SendSciTE_Command($My_Hwnd, $Scite_hwnd, "goto:1,1") SendSciTE_Command($My_Hwnd, $Scite_hwnd, "find:#Region - TimeStamp") SendSciTE_Command($My_Hwnd, $Scite_hwnd, "askproperty:CurrentSelection") $sSelection = StringRegExp($sReceive, '(?::\d+:macro:stringinfo:)(.*)', 1) If @error Then Exit If $sSelection[0] <> "#Region - TimeStamp" Then SendSciTE_Command($My_Hwnd, $Scite_hwnd, "insert:" & _ "#Region - TimeStamp\n" & _ "; " & @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & "\n" & _ "#EndRegion\n\n" & $sSelection[0]) Else SendSciTE_Command($My_Hwnd, $Scite_hwnd, "askproperty:SelectionStartLine") $iLine = StringRegExp($sReceive, '(?::\d+:macro:stringinfo:)(\d+)', 1) If @error Then Exit SendSciTE_Command($My_Hwnd, $Scite_hwnd, "goto:" & $iLine[0] +1 & ",1") SendSciTE_Command($My_Hwnd, $Scite_hwnd, "extender:dostring editor:LineDelete()") SendSciTE_Command($My_Hwnd, $Scite_hwnd, "insert:" & _ "; " & @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & '\n') EndIf SendSciTE_Command($My_Hwnd, $Scite_hwnd, "menucommand:" & $IDM_SAVE) Func _StartUpSciTEInterface() $Scite_hwnd = WinGetHandle("DirectorExtension") $My_Hwnd = GUICreate("SciTE interface", 400, 600, 10, 10) $My_Dec_Hwnd = Dec(StringTrimLeft($My_Hwnd, 2)) GUIRegisterMsg($WM_COPYDATA, "MY_WM_COPYDATA") EndFunc Func SendSciTE_Command($My_Hwnd, $Scite_hwnd, $sCmd) $sCmd = ":" & $My_Dec_Hwnd & ":" & $sCmd ConsoleWrite('-->SendSciTE_Command >' & $sCmd & @LF) Local $CmdStruct = DllStructCreate('Char[' & StringLen($sCmd) + 1 & ']') DllStructSetData($CmdStruct, 1, $sCmd) Local $COPYDATA = DllStructCreate('Ptr;DWord;Ptr') DllStructSetData($COPYDATA, 1, 1) DllStructSetData($COPYDATA, 2, StringLen($sCmd) + 1) DllStructSetData($COPYDATA, 3, DllStructGetPtr($CmdStruct)) DllCall('User32.dll', 'None', 'SendMessage', 'HWnd', $Scite_hwnd, _ 'Int', $WM_COPYDATA, 'HWnd', $My_Hwnd, _ 'Ptr', DllStructGetPtr($COPYDATA)) EndFunc ;==>SendSciTE_Command Func MY_WM_COPYDATA($hWnd, $msg, $wParam, $lParam) Local $COPYDATA = DllStructCreate('Ptr;DWord;Ptr', $lParam) $SciTECmdLen = DllStructGetData($COPYDATA, 2) Local $CmdStruct = DllStructCreate('Char[255]', DllStructGetData($COPYDATA, 3)) $SciTECmd = StringLeft(DllStructGetData($CmdStruct, 1), $SciTECmdLen) If StringInStr($SciTECmd, ":macro:stringinfo:", 1) Or _ StringInStr($SciTECmd, ":filename:", 1) Then If $sReceive <> $SciTECmd Then $sReceive = $SciTECmd EndIf ConsoleWrite('<--Receive' & $SciTECmd & @LF) EndFunc ;==>MY_WM_COPYDATA #cs askfilename: Return the name of the file being edited. askproperty: Return the value of a property. close: Close the current file. closing: Director is closing - SciTE closes if it was started by the director. currentmacro: Set the current macro to name. cwd: Change the working directory. enumproperties:dyn|local|user|base|embed Enumerate all the properties in the argument set. exportashtml: Save the document in HTML format as the indicated file. exportasrtf: Save the document in RTF format as the indicated file. exportaspdf: Save the document in PDF format as the indicated file. exportaslatex: Save the document in LaTeX format as the indicated file. exportasxml: Save the document in XML format as the indicated file. extender: Call the extension interface with the given command. find: Search for a string, select and show it. focus: On GTK+ bring this SciTE window to the front. The timeStamp is from the window manager and ensures that windows are only activated because of a user command. Has no effect on Windows as applications on Windows can only donate focus, not take focus. goto:[,] Move caret to a particular line and make it visible. If there is a column number then select the word at that column number or move the caret there if no word is present. identity: Sets the director window handle to which SciTE sends messages. The argument is in decimal. insert: Display the value in the editor pane replacing the selection. loadsession: Load a session as given by the indicated file. macrocommand: Execute a macro command. See the SciTE source code for the syntax of the command argument. macroenable: If enable, display menu commands in SciTE for recording and playing macros. macrolist: Display a list for the user to choose from. menucommand: Execute a menu command based on numeric ID. open: Open the indicated file. output: Display the value in the output pane replacing the selection. property:= Set a property to a value. quit: Shut down SciTE. reloadproperties: Reload properties from files. replaceall:\000 Replace all instances of he search string in the document with the replace string. saveas: Save the document as the indicated file. savesession: Save a session as given by the indicated file. The actions sent by SciTE are: closed: SciTE has closed the indicated file. closing: SciTE is closing. dyn|local|user|base|embed:= Set a property in a set to a value. filename: The file being edited is path. This is the reply to the askfilename: command. identity: SciTE indicates to the director the window handle to which it should send messages. The argument is in decimal. macro:getlist Retrieve the list of available macros which will be returned by the macrolist command. macro:record:
Start recording a macro. See the SciTE source code for the syntax of the details argument. macro:run: Run the named macro. macro:stoprecord Stop recording a macro. opened: SciTE has opened the indicated file. switched: SciTE has switched buffers to the indicated file. saved: SciTE has saved the indicated file. PROPERTYS: FilePath full path of the current file FileDir directory of the current file without a trailing slash FileName base name of the current file FileExt extension of the current file FileNameExt $(FileName).$(FileExt) Language name of the lexer used for the current file SessionPath full path of the current session CurrentSelection value of the currently selected text CurrentWord value of word which the caret is within or near Replacements number of replacements made by last Replace command SelectionStartColumn column where selection starts SelectionStartLine line where selection starts SelectionEndColumn column where selection ends SelectionEndLine line where selection ends CurrentMessage most recently selected output pane message SciteDefaultHome directory in which the Global Options file is found SciteUserHome directory in which the User Options file is found SciteDirectoryHome directory in which the Directory Options file is found APIPath list of full paths of API files from api.filepattern AbbrevPath full path of abbreviations file #ce