PutScriptName.au3

 

Put the ScriptName in Selection 

 

; https://www.autoitscript.com/forum/topic/208404-scite-plusbar/page/2/#comment-1517517
;------------------------------------------------------------------------------
; Title...........: PutScriptName.au3
; Description.....: Put the ScriptName in Selection
;------------------------------------------------------------------------------
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
#include <WindowsConstants.au3>
#include <SendMessage.au3>

Global $hScite_Editor_hWnd = ControlGetHandle("[CLASS:SciTEWindow]", '', '[CLASS:Scintilla; INSTANCE:1]')
Global $ClipBack

If Not WinExists("[CLASS:SciTEWindow]") Then
    Exit
EndIf

$ClipBack = ClipGet() ; backup clip data

SciTE_PutItInSelection()

ClipPut($ClipBack) ; Restore clip data

;----------------------------------------------------------------------------------------
Func SciTE_PutItInSelection()

    Local $sTxt = CurrentSciteFile()

    ClipPut($sTxt)
    _SendMessage($hScite_Editor_hWnd, $WM_PASTE)

EndFunc   ;==>SciTE_PutItInSelection
;--------------------------------------------------------------------------------------------
Func CurrentSciteFile($FullPath = 0) ; Return the Current Scite [0=ScriptName; 1=ScriptFullPath]

    WinMenuSelectItem("[CLASS:SciTEWindow]", "", "&File", "Copy Pat&h")

    Local $ScriptName, $ScriptFullPath = ClipGet()

    If $FullPath = 0 Then
        Local $sSplit = StringSplit($ScriptFullPath, "\")
        $ScriptName = $sSplit[$sSplit[0]]
    Else
        $ScriptName = $ScriptFullPath
    EndIf

    Return $ScriptName

EndFunc   ;==>CurrentSciteFile
;----------------------------------------------------------------------------------------
 

Comments

Popular posts from this blog

ControlGetHandle ($hWnd, "", "[REGEXPCLASS:<>; INSTANCE:<>]")

Simple Calculator