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

Commit

Permalink
+livemode pause option
Browse files Browse the repository at this point in the history
+skip updating filter if it's same as last
~better window focus consideration
  • Loading branch information
bdeshi committed Nov 20, 2015
1 parent 30887e8 commit 2c3e9b4
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 26 deletions.
63 changes: 39 additions & 24 deletions XYAHKLiveFilter.ahk
Original file line number Diff line number Diff line change
@@ -1,56 +1,70 @@
;XYAHKLiveFilter v2
;XYAHKLiveFilter v3
#SingleInstance, Off
OnExit, ExitRoutine
SetControlDelay, -1
XYhWnd = %1%
Shortcut = %2%

Main:
Gui, +HwndGUIhWnd +OwnDialogs -Resize -Border -Caption +AlwaysOnTop
Gui, Margin, 0, 0
Gui, +HwndGUIhWnd -Resize -Border -Caption +OwnDialogs +AlwaysOnTop
Gui, Margin, 1, 1
Gui, Font, s8, Segoe UI
Gui, Add, Edit, R1 vXYAHKFilter gUpdateFilter hWndGUIEdithWnd, ""
DllCall("SetParent", "UInt",GUIhWnd, "UInt",XYhWnd)
GUI, Add, Checkbox, gUpdateFilter hWndGUIPausehWnd 0x8000 0xc00, P
Gui, Add, Edit, y1 gUpdateFilter hWndGUIEdithWnd R1, ""
DllCall("SetParent","UInt", GUIhWnd, "UInt", XYhWnd)
GuiControlGet, EditPos, Pos, %GUIEdithWnd%
GuiControl, Move, %GUIEdithWnd%, % "w" EditPosW*8
GuiControl, Move, %GUIPausehWnd%, % "h" EditPosH
Gui, Show, X1 Y1 AutoSize
SendInput, {Left}
SendInput, {Right}{Left}
OnMessage(0x200, "FocusGUI")
OnMessage(0x02, "Destroyer")
Hotkey, IfWinActive, ahk_id %GUIhWnd%
Hotkey, Tab, LabelFocusXY
Hotkey, Tab, lblFocusXY
If (Shortcut) {
Hotkey, IfWinActive, ahk_id %XYhWnd%
Hotkey, %Shortcut%, LabelFocusGUI
Hotkey, %Shortcut%, lblFocusGUI
}
Return

UpdateFilter:
GuiControlGet, XYAHKLiveFilter, , %GUIEdithWnd%
XYAHKLiveFilter = ::filter %XYAHKLiveFilter%;
MsgToXY(XYAHKLiveFilter)
GuiControlGet, PauseState, , %GUIPausehWnd%
GuiControlGet, StrFilter, , %GUIEdithWnd%
If (PauseState = 1) {
Return
}
If (StrFilterLast != StrFilter) {
StrFilterLast := StrFilter
StrFilter = ::filter %StrFilter%;
MsgToXY(StrFilter)
StrFilter := ""
}
Return

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

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

FocusGUI() {
global XYhWnd
global
IfWinActive, ahk_id %XYhWnd%
{
Gui, +LastFound
WinActivate
WinActivate, ahk_id %GUIEdithWnd%
}
Return
}
FocusXY() {
global
IfWinActive, ahk_id %GUIhWnd%
{
WinActivate, ahk_id %XYhWnd%
}
Return
}
Expand All @@ -64,8 +78,8 @@ MsgToXY(arg_Msg) {
global XYhWnd
Size := StrLen(arg_Msg)
If !(A_IsUnicode) {
VarSetCapacity(Data, Size * 2, 0)
StrPut(arg_Msg, &Data, Size, "UTF-16")
VarSetCapacity(Data, Size * 2, 0)
StrPut(arg_Msg, &Data, Size, "UTF-16")
} Else {
Data := arg_Msg
}
Expand All @@ -78,8 +92,9 @@ MsgToXY(arg_Msg) {
}

ExitRoutine:
GUI, Destroy
WinActivate, ahk_id %XYhWnd%
EndMsg := "::filter;unset $p_XYAHKLiveFilter_A,$p_XYAHKLiveFilter_B;"
MsgToXY(EndMsg)
WinActivate, ahk_id %XYhWnd%
ExitApp
Return
4 changes: 2 additions & 2 deletions 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 2**
####**version 3**

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 All @@ -27,7 +27,7 @@ Live-filters the file list as you type into a textbox. Uses SC `filter`, so all
* Press <kbd>ESCAPE</kbd> while the filterbox is focused to close it. (also quits automatically when parent XY window is closed.)
* If you use the script as a UDC with a keyboard shortcut, I suggest setting the same shortcut as Focus Hotkey.
* Full content of the filterbox is passed to SC `filter` unchanged, so should be properly escaped according to XYplorer scripting rules when necessary.
* Live-filtering is not suitable for RegExp patterns. You run the risk of getting bombarded with pattern error message.
* Live-filtering is not suitable for RegExp patterns. Activate the **P** checkbox to pause livemode, enter complex/RegExp pattern, then uncheck it again to submit.


###IMPORTANT:
Expand Down

0 comments on commit 2c3e9b4

Please sign in to comment.