관리 메뉴

ㄴrㅎnㅂrㄹrㄱi

SendMessage scripts for ListBox 본문

AUTOHOTKEY/스크립트

SendMessage scripts for ListBox

님투 2010. 3. 23. 18:35
;-------------------------------------------------------------------------------
; GetChildHWND.ahk
;-------------------------------------------------------------------------------
GetChildHWND(ParentHWND, ChildClassNN)
{
    WinGetPos, ParentX, ParentY,,, ahk_id %ParentHWND%
    if ParentX =
        return    ; Parent window not found (possibly due to DetectHiddenWindows).
    ControlGetPos, ChildX, ChildY,,, %ChildClassNN%, ahk_id %ParentHWND%
    if ChildX =
        return    ; Child window not found, so return a blank value.
    ; Convert child coordinates -- which are relative to its parent's upper left
    ; corner -- to absolute/screen coordinates for use with WindowFromPoint().
    ; The following INTENTIONALLY passes too many args to the function because
    ; each arg is 32-bit, which allows the function to automatically combine
    ; them into one 64-bit arg (namely the POINT struct):
    return DllCall("WindowFromPoint", "int", ChildX + ParentX, "int", ChildY + ParentY)
}


;-------------------------------------------------------------------------------
; AddString_ListBox.ahk
;-------------------------------------------------------------------------------
#Include GetChildHWND.ahk
!z::
;String for add
s=Hi World!
InputBox,s,Enter string to ,It sends the message to add a string to a list box,,,,,,,,%s%
VAR_address:= DllCall("CharNext", str, s, UInt)-1
ActiveWindow:= WinExist("A")
WinGetClass, class, A
ControlGetFocus, FocusedControl, ahk_id %ActiveWindow%
if not FocusedControl
    return
c_id:=GetChildHWND(ActiveWindow,FocusedControl)
SendMessage, 0x180, 0, VAR_address, %FocusedControl%, A
;MsgBox (Class=%class% Handle=%ActiveWindow%)(FC=%FocusedControl% Handle=%c_id%)


;-------------------------------------------------------------------------------
; DeleteString_ListBox.ahk
;-------------------------------------------------------------------------------
#Include GetChildHWND.ahk
!z::
;Index of string to delete
InputBox,N,Enter string number,Delete of N string in list box,,,,,,,,1
ActiveWindow:= WinExist("A")
WinGetClass, class, A
ControlGetFocus, FocusedControl, ahk_id %ActiveWindow%
if not FocusedControl
    return
c_id:=GetChildHWND(ActiveWindow,FocusedControl)
SendMessage, 0x182, N, 0, %FocusedControl%, A
;MsgBox (Class=%class% Handle=%ActiveWindow%)(FC=%FocusedControl% Handle=%c_id%)


;-------------------------------------------------------------------------------
; ChooseN_ListBox.ahk
;-------------------------------------------------------------------------------
#Include GetChildHWND.ahk
!z::
;sel=1 select N string
;sel=0 deselect N string
sel=1
;Number to set the selection
InputBox,N,Enter string number,selection of string in list box,,,,,,,,1
ActiveWindow:= WinExist("A")
WinGetClass, class, A
ControlGetFocus, FocusedControl, ahk_id %ActiveWindow%
if not FocusedControl
    return
c_id:=GetChildHWND(ActiveWindow,FocusedControl)
SendMessage, 0x185, sel, N, %FocusedControl%, A
;MsgBox (Class=%class% Handle=%ActiveWindow%)(FC=%FocusedControl% Handle=%c_id%)


;-------------------------------------------------------------------------------
; SelectAll_ListBox.ahk
;-------------------------------------------------------------------------------
#Include GetChildHWND.ahk
!z::
ActiveWindow:= WinExist("A")
WinGetClass, class, A
ControlGetFocus, FocusedControl, ahk_id %ActiveWindow%
if not FocusedControl
    return
c_id:=GetChildHWND(ActiveWindow,FocusedControl)
SendMessage, 0x185, 1, -1, %FocusedControl%, A
;MsgBox (Class=%class% Handle=%ActiveWindow%)(FC=%FocusedControl% Handle=%c_id%)


;-------------------------------------------------------------------------------
; DeSelectAll_ListBox.ahk
;-------------------------------------------------------------------------------
#Include GetChildHWND.ahk
!z::
ActiveWindow:= WinExist("A")
WinGetClass, class, A
ControlGetFocus, FocusedControl, ahk_id %ActiveWindow%
if not FocusedControl
    return
c_id:=GetChildHWND(ActiveWindow,FocusedControl)
SendMessage, 0x185, 0, -1, %FocusedControl%, A
MsgBox (Class=%class% Handle=%ActiveWindow%)(FC=%FocusedControl% Handle=%c_id%)


;-------------------------------------------------------------------------------
; FindString_ListBox.ahk
;-------------------------------------------------------------------------------
#Include GetChildHWND.ahk
!z::
;Find string that begins with the characters in a specified string
InputBox,s,Enter name of string, Retrieve number of string with same beginning,,,,,,,,
VAR_address:= DllCall("CharNext", str, s, UInt)-1
ActiveWindow:= WinExist("A")
WinGetClass, class, A
ControlGetFocus, FocusedControl, ahk_id %ActiveWindow%
if not FocusedControl
    return
c_id:=GetChildHWND(ActiveWindow,FocusedControl)
SendMessage, 0x18f, 0, VAR_address, %FocusedControl%, A
MsgBox (Number of first finded string=%ErrorLevel%)


;-------------------------------------------------------------------------------
; GetTextStringN_ListBox.ahk
;-------------------------------------------------------------------------------
#Include GetChildHWND.ahk
!z::
;Number of geting string
;Note: First index=0
InputBox,N,Enter number of string, Retrieve text of N string in ListBox,,,,,,,,
s=retrieval string
VAR_address:= DllCall("CharNext", str, s, UInt)-1
ActiveWindow:= WinExist("A")
WinGetClass, class, A
ControlGetFocus, FocusedControl, ahk_id %ActiveWindow%
if not FocusedControl
    return
c_id:=GetChildHWND(ActiveWindow,FocusedControl)
SendMessage, 0x189, N, VAR_address, %FocusedControl%, A
;MsgBox (Class=%class% Handle=%ActiveWindow%)(FC=%FocusedControl% Handle=%c_id%)
MsgBox (retrieval string=%s%)


;-------------------------------------------------------------------------------
; Number of Items_ListBox.ahk
;-------------------------------------------------------------------------------
#Include GetChildHWND.ahk
!z::
ActiveWindow:= WinExist("A")
WinGetClass, class, A
ControlGetFocus, FocusedControl, ahk_id %ActiveWindow%
if not FocusedControl
    return
c_id:=GetChildHWND(ActiveWindow,FocusedControl)
SendMessage, 0x18b, 0, 0, %FocusedControl%, A
MsgBox (Number of items=%ErrorLevel%)


;-------------------------------------------------------------------------------
; IsThisSelectedN.ahk
;-------------------------------------------------------------------------------
#Include GetChildHWND.ahk
!z::
;retrieve the selection state of an item.
;Number of item.
InputBox, N, Enter number of item(zero-based index), It show the true about selection
ActiveWindow:= WinExist("A")
WinGetClass, class, A
ControlGetFocus, FocusedControl, ahk_id %ActiveWindow%
if not FocusedControl
    return
c_id:=GetChildHWND(ActiveWindow,FocusedControl)
SendMessage, 0x187, N, 0, %FocusedControl%, A
;MsgBox (Class=%class% Handle=%ActiveWindow%)(FC=%FocusedControl% Handle=%c_id%)
MsgBox (Selected: NO=0 YES=1 -->=%ErrorLevel%)


;-------------------------------------------------------------------------------
; Inverse_Selection.ahk
;-------------------------------------------------------------------------------
#Include GetChildHWND.ahk
!z::
ActiveWindow:= WinExist("A")
WinGetClass, class, A
ControlGetFocus, FocusedControl, ahk_id %ActiveWindow%
if not FocusedControl
    return
c_id:=GetChildHWND(ActiveWindow,FocusedControl)
SendMessage, 0x18b, 0, 0, %FocusedControl%, A

;************Number of items
;MsgBox (Number of items=%ErrorLevel%)
n_of_it=%ErrorLevel%
Loop, %n_of_it%
{
SendMessage, 0x187, a_index-1, 0, %FocusedControl%, A
if ErrorLevel=1
     SendMessage, 0x185, 0, a_index-1, %FocusedControl%, A
     else
     SendMessage, 0x185, 1, a_index-1, %FocusedControl%, A
}


;-------------------------------------------------------------------------------
; Select_all_except_string.ahk
;-------------------------------------------------------------------------------
#Include GetChildHWND.ahk
!z::
ActiveWindow:= WinExist("A")
WinGetClass, class, A
ControlGetFocus, FocusedControl, ahk_id %ActiveWindow%
if not FocusedControl
    return
c_id:=GetChildHWND(ActiveWindow,FocusedControl)
;------------Number of items----------------------------------------------------
SendMessage, 0x18b, 0, 0, %FocusedControl%, A
n_of_it=%ErrorLevel%
;------------Part of string to create the choose--------------------------------
InputBox, s, Enter string to find and select, It will select all except this string,,,,,,,,
;------------DeSelect all-------------------------------------------------------
SendMessage, 0x185, 0, -1, %FocusedControl%, A
;------------Select_all_with_string---------------------------------------------
ret=retrieval string
VAR_address:= DllCall("CharNext", str, ret, UInt)-1

Loop, %n_of_it%
{
SendMessage, 0x189, a_index-1, VAR_address, %FocusedControl%, A
StringGetPos, pos, ret, %s%
if pos >= 0
            SendMessage, 0x185, 1, a_index-1, %FocusedControl%, A
}
;------------Inverse_Selection--------------------------------------------------
Loop, %n_of_it%
{
SendMessage, 0x187, a_index-1, 0, %FocusedControl%, A
if ErrorLevel=1
     SendMessage, 0x185, 0, a_index-1, %FocusedControl%, A
     else
     SendMessage, 0x185, 1, a_index-1, %FocusedControl%, A
}


;-------------------------------------------------------------------------------
; Select_all_with_string.ahk
;-------------------------------------------------------------------------------
#Include GetChildHWND.ahk
!z::
ActiveWindow:= WinExist("A")
WinGetClass, class, A
ControlGetFocus, FocusedControl, ahk_id %ActiveWindow%
if not FocusedControl
    return
c_id:=GetChildHWND(ActiveWindow,FocusedControl)
;------------Number of items----------------------------------------------------
SendMessage, 0x18b, 0, 0, %FocusedControl%, A
n_of_it=%ErrorLevel%
;------------Part of string to create the choose--------------------------------
InputBox, s, Enter string to find and select, Part of string to create a choose of all with it
;------------DeSelect all-------------------------------------------------------
SendMessage, 0x185, 0, -1, %FocusedControl%, A
;------------Select_all_with_string---------------------------------------------
ret=retrieval string
VAR_address:= DllCall("CharNext", str, ret, UInt)-1

Loop, %n_of_it%
{
SendMessage, 0x189, a_index-1, VAR_address, %FocusedControl%, A
StringGetPos, pos, ret, %s%
if pos >= 0
            SendMessage, 0x185, 1, a_index-1, %FocusedControl%, A
}


'AUTOHOTKEY > 스크립트' 카테고리의 다른 글

ELP Extended-length path library 1.1  (0) 2013.01.15
돋보기 기능 만들기  (0) 2011.05.12
SendMessage scripts for ListBox  (0) 2010.03.23
Custom GUI Controls & GUI related  (0) 2010.02.22
[라이브러리] PGui  (0) 2009.01.12
[라이브러리] MMenu  (0) 2009.01.12
0 Comments
댓글쓰기 폼