;-- TIME_STAMP   2020-10-13 01:11:02   v 0.1

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Change2CUI=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <SendMessage.au3>

Global Const $SCI_GETSTYLEAT=2010

;~ EditorPane = 1, OutputPane = 2

If $CMDLINE[0] = 4 Then ; FilePath, Position, Pane, SaveAs
	Local $hSciTE = WinGetHandle('[REGEXPTITLE:.*'&StringReplace($CMDLINE[1], '\', '\\')&'.*; CLASS:SciTEWindow]')
	If Not IsHWnd($hSciTE) Then Exit -1
	Local $hFile = FileOpen($CMDLINE[4], 2)
	Local $hEditorPane = ControlGetHandle($hScITE, '', '[CLASS:Scintilla; INSTANCE:'&$CMDLINE[3]&']')
	FileWrite($hFile, _SendMessage($hEditorPane, $SCI_GETSTYLEAT, $CMDLINE[2]))
	FileFlush($hFile)
	FileClose($hFile)
EndIf
