Skip to content
This repository has been archived by the owner on Jan 9, 2019. It is now read-only.

Commit

Permalink
~moved onExit to auto-exec section
Browse files Browse the repository at this point in the history
~code cleanup, light refactoring
  • Loading branch information
bdeshi committed Nov 20, 2015
1 parent 04e6cee commit 30887e8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 35 deletions.
64 changes: 30 additions & 34 deletions XYAHKLiveFilter.ahk
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
;XYAHKLiveFilter v1
;XYAHKLiveFilter v2
#SingleInstance, Off
OnExit, ExitRoutine
SetControlDelay, -1
XYhWnd = %1%
Shortcut = %2%
Expand All @@ -9,7 +10,7 @@ Main:
Gui, Margin, 0, 0
Gui, Font, s8, Segoe UI
Gui, Add, Edit, R1 vXYAHKFilter gUpdateFilter hWndGUIEdithWnd, ""
DllCall("SetParent","UInt", GUIhWnd, "UInt", XYhWnd)
DllCall("SetParent", "UInt",GUIhWnd, "UInt",XYhWnd)
GuiControlGet, EditPos, Pos, %GUIEdithWnd%
GuiControl, Move, %GUIEdithWnd%, % "w" EditPosW*8
Gui, Show, X1 Y1 AutoSize
Expand All @@ -18,72 +19,67 @@ Main:
OnMessage(0x02, "Destroyer")
Hotkey, IfWinActive, ahk_id %GUIhWnd%
Hotkey, Tab, LabelFocusXY
If Shortcut
{
If (Shortcut) {
Hotkey, IfWinActive, ahk_id %XYhWnd%
Hotkey, %Shortcut%, LabelFocusGUI
}
Return

UpdateFilter:
GuiControlGet, XYAHKLiveFilter, , %GUIEdithWnd%
XYAHKLiveFilter = ::filter %XYAHKLiveFilter%
MsgToXY(XYAHKLiveFilter, XYhWnd)
FocusGUI()
GuiControlGet, XYAHKLiveFilter, , %GUIEdithWnd%
XYAHKLiveFilter = ::filter %XYAHKLiveFilter%;
MsgToXY(XYAHKLiveFilter)
Return

GuiEscape:
GoSub, ExitSub
GoSub, ExitRoutine
Return
GuiClose:
GoSub, ExitSub
GoSub, ExitRoutine
Return

OnExit, ExitSub
LabelFocusXY:
WinActivate, ahk_id %XYhWnd%
Return

LabelFocusGUI:
FocusGUI()
Return
LabelFocusXY:
WinActivate, ahk_id %XYhWnd%
Return

FocusGUI()
{
Gui, +LastFound
WinActivate
FocusGUI() {
global XYhWnd
IfWinActive, ahk_id %XYhWnd%
{
Gui, +LastFound
WinActivate
}
Return
}

Destroyer()
{
Destroyer() {
ExitApp
Return
}

MsgToXY(arg_Msg, arg_XYhWnd)
{
MsgToXY(arg_Msg) {
global XYhWnd
Size := StrLen(arg_Msg)
If !(A_IsUnicode)
{
VarSetCapacity(Data, Size * 2, 0)
StrPut(arg_Msg, &Data, Size, "UTF-16")
}
Else
{
If !(A_IsUnicode) {
VarSetCapacity(Data, Size * 2, 0)
StrPut(arg_Msg, &Data, Size, "UTF-16")
} Else {
Data := arg_Msg
}
VarSetCapacity(COPYDATA, A_PtrSize * 3, 0)
NumPut(4194305, COPYDATA, 0, "Ptr")
NumPut(Size * 2, COPYDATA, A_PtrSize, "UInt")
NumPut(&Data, COPYDATA, A_PtrSize * 2, "Ptr")
SendMessage, 0x4A, 0, &COPYDATA, , ahk_id %arg_XYhWnd%
SendMessage, 0x4A, 0, &COPYDATA, , ahk_id %XYhWnd%
Return
}

ExitSub:
EndMsg := "::filter;unset $p_XYAHKLiveFilter_A,$p_XYAHKLiveFilter_B;status 'XYAHKLF:Esc';"
MsgToXY(EndMsg, XYhWnd)
ExitRoutine:
EndMsg := "::filter;unset $p_XYAHKLiveFilter_A,$p_XYAHKLiveFilter_B;"
MsgToXY(EndMsg)
WinActivate, ahk_id %XYhWnd%
ExitApp
Return
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## [XYAHKLiveFilter](https://www.github.com/SammaySarkar/XYAHKLiveFilter)
http://www.xyplorer.com/xyfc/viewtopic.php?t=12588

####**version 1**
####**version 2**

A live-filter plugin for [XYplorer](http://www.xyplorer.com), made in [AutoHotkey](http://www.ahkscript.org)
Live-filters the file list as you type into a textbox. Uses SC `filter`, so all its syntax is available.
Expand Down

0 comments on commit 30887e8

Please sign in to comment.