XYAHKLiveFilter - livefilter the filelist
XYAHKLiveFilter - livefilter the filelist
Live-filters the file list, as you type into a textbox.
An alternative (and predecessor) to XY's built-in Live-Filter Box.
>> DOWNLOADS and USAGE INSTRUCTION <<
Happy filtering!
======================
ask for improvements, send bugfixes. All help is welcome!
An alternative (and predecessor) to XY's built-in Live-Filter Box.
>> DOWNLOADS and USAGE INSTRUCTION <<
Happy filtering!
======================
ask for improvements, send bugfixes. All help is welcome!
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
Re: XYAHKLiveFilter - livefilter the filelist
Wouldn't it be better to remove the quotation marks inside the box and just add them to the ::filter line?
E.g.:
and ofc the lines
and
must be changed as well.
and to use regexp's:
Maybe check for one special character at the beginning and if it is detected, wait until it is typed in again and then send the script
":" would be a good choice because it can't be part of a file- or foldername and is has no special meaning in a regexp.
E.g the following is typed:
:(start|end):
: -> special char detected, don't send the content of the input box right now
(start|end) -> the pattern was typed
: -> end char detected, now send the script...
E.g.:
Code: Select all
XYAHKLiveFilter = ::filter "%XYAHKLiveFilter%"
Code: Select all
Gui, Add, Edit, R1 vXYAHKFilter gUpdateFilter hWndGUIEdithWnd
Code: Select all
SendInput, {Left}
and to use regexp's:
Maybe check for one special character at the beginning and if it is detected, wait until it is typed in again and then send the script
":" would be a good choice because it can't be part of a file- or foldername and is has no special meaning in a regexp.
E.g the following is typed:
:(start|end):
: -> special char detected, don't send the content of the input box right now
(start|end) -> the pattern was typed
: -> end char detected, now send the script...
One of my scripts helped you out? Please donate via Paypal
Re: XYAHKLiveFilter - livefilter the filelist
Thanks, but the quotes are there to impress upon users the fact that the strings "should be properly escaped according to XYscripting rules when necessary".
[edit] Besides, quotes aren't always necessary and may also be swapped for singlequotes, so always adding them in ahk is a no-no.
And about regexp checking, my idea was check for special char (> or |> ...) and wait for user to press ENTER...
Fortunately other types of filters seem to play nice with this livefiltering...
[edit] Besides, quotes aren't always necessary and may also be swapped for singlequotes, so always adding them in ahk is a no-no.
And about regexp checking, my idea was check for special char (> or |> ...) and wait for user to press ENTER...
Fortunately other types of filters seem to play nice with this livefiltering...
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
-
- Posts: 1416
- Joined: 04 Nov 2008 05:35
- Location: Hanoi, Vietnam
Re: XYAHKLiveFilter - livefilter the filelist
Super Great
Small thing: Enter should close the box too, not just Escape
Small thing: Enter should close the box too, not just Escape
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488
Re: XYAHKLiveFilter - livefilter the filelist
Thanks!
And thanks for XYplorerMessenger!
...I'd mentally reserved ENTER for submitting regexp filters (noted in the post above yours)
And thanks for XYplorerMessenger!
...I'd mentally reserved ENTER for submitting regexp filters (noted in the post above yours)
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
Re: XYAHKLiveFilter - livefilter the filelist
Updated.
Changes:
> OnExit correction. AHK is tolerant of exit methods other than ESCAPE
> a 'debug' status msg would come up when closing filterbox. Not any more.
> Filterbox would activate on mouseover even if parent XY window wasn't active. Fixed. (Or was it a feature?)
Changes:
> OnExit correction. AHK is tolerant of exit methods other than ESCAPE
> a 'debug' status msg would come up when closing filterbox. Not any more.
> Filterbox would activate on mouseover even if parent XY window wasn't active. Fixed. (Or was it a feature?)
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
Re: XYAHKLiveFilter - livefilter the filelist
Nice Idea and nice concept regarding the live input box!
In order for it to work for me though, I have to call it in a way like:
Otherwise it does not find the file.
In order for it to work for me though, I have to call it in a way like:
Code: Select all
if($p_XYAHKLiveFilter_A!=1)||($p_XYAHKLiveFilter_B!=<hwnd>){$p_XYAHKLiveFilter_A=1;$p_XYAHKLiveFilter_B=<hwnd>;run '"' . <xyscripts> . '\XYAHKLiveFilter.exe' . '" ' . <hwnd> . ' ^`',0;};
Last edited by autocart on 01 Oct 2014 12:22, edited 1 time in total.
[AHK] redirecting Windows Explorer to XY, [XYS] Mini Tree with open tabs (cur loc expanded, tab folders highlighted), [AHK] customInlineRenameKeys, [AHK] clipboardHelper_and_XYEscToList
Re: XYAHKLiveFilter - livefilter the filelist
Thanks!
Re path: is it because <xyscripts> expands to a path with spaces?
I'll check when back at my desk, and if so, then update the script to account for that.
(now the xyscript always quotes ahk script path)
Re path: is it because <xyscripts> expands to a path with spaces?
I'll check when back at my desk, and if so, then update the script to account for that.
(now the xyscript always quotes ahk script path)
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
Re: XYAHKLiveFilter - livefilter the filelist
I assume yes.SammaySarkar wrote:Thanks!
Re path: is it because <xyscripts> expands to a path with spaces?
Your new code:
Code: Select all
run """<xyscripts>\XYAHKLiveFilter.exe"" <hwnd> ^`",0;};
[AHK] redirecting Windows Explorer to XY, [XYS] Mini Tree with open tabs (cur loc expanded, tab folders highlighted), [AHK] customInlineRenameKeys, [AHK] clipboardHelper_and_XYEscToList
Re: XYAHKLiveFilter - livefilter the filelist
Darn it. More GREAT scripts that I have to add to my installation.
Re: XYAHKLiveFilter - livefilter the filelist
Glad to be a burden to your storage!
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
Re: XYAHKLiveFilter - livefilter the filelist
Sammay,
Nice script. I think bottom left will be a better place for the box. Mini Tree would leave atleast some space around that area.
Though the best place will be to use a very small area of the address bar - Not sure if AHK has any means to identify the box and place it there, otherwise it will be difficult to compute due to different layouts
Nice script. I think bottom left will be a better place for the box. Mini Tree would leave atleast some space around that area.
Though the best place will be to use a very small area of the address bar - Not sure if AHK has any means to identify the box and place it there, otherwise it will be difficult to compute due to different layouts
-
- Posts: 1416
- Joined: 04 Nov 2008 05:35
- Location: Hanoi, Vietnam
Re: XYAHKLiveFilter - livefilter the filelist
Here is my own version
+ Reuse current VF as default text in AHK filterbox
+ Escape/Capslock cancel the VF. Enter when AHK box is active will dismiss the app
+ Just run the app, no need to set Permanent Variable
+ Reuse current VF as default text in AHK filterbox
+ Escape/Capslock cancel the VF. Enter when AHK box is active will dismiss the app
+ Just run the app, no need to set Permanent Variable
Code: Select all
#SingleInstance force
#NoEnv
#notrayicon
SetControlDelay, -1
Settitlematchmode, 2
Ifwinnotactive, XYplorer ahk_class ThunderRT6FormDC
Exitapp
XYhWnd := Winactive("A")
;Get current Visual Filter
SenderHWND := A_ScriptHwnd + 0 ;Return this script's hidden hwdn id. +0 to convert from Hex to Dec
MessagetoXYplorer := "::CopyData " SenderHWND ", get('VisualFilter'), 2" ;resolved to sth like this: ::CopyData 7409230, get('VisualFilter'),2
Global Datareceived
OnMessage(0x4a, "Function_Receive_WM_COPYDATA") ; 0x4a is WM_COPYDATA. This onhold and wait for the WM_Copydata from XYplorer then execute Function_Receive_WM_COPYDATA(wParam, lParam) below
MsgToXY(MessagetoXYplorer)
;create GUI, hotkeys
Main:
Gui, +HwndGUIhWnd +OwnDialogs -Resize -Border -Caption +AlwaysOnTop
Gui, Margin, 0, 0 ; TODO remove background around editbox margin
Gui, Font, s12, Segoe UI ; should be DPI aware
Gui, Add, Edit, R1 vXYAHKFilter gUpdateFilter hWndGUIEdithWnd W200, %Datareceived%
DllCall("SetParent","UInt", GUIhWnd, "UInt", XYhWnd) ;child of XY
Gui, Show, X1 Y1, AHKLiveFilterForXYPlorer
OnMessage(0x200, "FocusGUI") ;activate GUI on mouse-over (and ifWinActive XY)
Return
;=== EndOf Auto-Exec Section =====================================================
;triggered when editbox content changed
UpdateFilter:
GuiControlGet, XYAHKLiveFilter, , %GUIEdithWnd%
MsgToXY("::filter " XYAHKLiveFilter)
Return
#If winactive("AHKLiveFilterForXYPlorer ahk_class AutoHotkeyGUI")
Enter:: Exitapp
#If winactive("ahk_id" . XYhWnd) OR winactive("AHKLiveFilterForXYPlorer ahk_class AutoHotkeyGUI")
Escape::
CapsLock::
MsgToXY("::filter")
WinActivate, ahk_id %XYhWnd%
Exitapp
#If
;activate the GUI (editbox)
FocusGUI() {
global XYhWnd
IfWinActive, ahk_id %XYhWnd%
{
Gui, +LastFound ;only one GUI in this thread
WinActivate
}
Return
}
GuiClose:
Exitapp
;=== MsgToXY() ===================================================================
;send `arg_Msg` to hwnd %XYhWnd% (global) via WM_COPYDATA
MsgToXY(arg_Msg) {
; function lifted from binocular222's XYplorerMessenger (thanks! :) )
global XYhWnd
Size := StrLen(arg_Msg)
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, ©DATA, , ahk_id %XYhWnd%
Return
}
;=== EndOf MsgToXY() =============================================================
Function_Receive_WM_COPYDATA(wParam, lParam)
{
StringAddress := NumGet(lParam + 2*A_PtrSize) ;lParam+8 is the address of CopyDataStruct's lpData member.
CopyOfData := StrGet(StringAddress) ;May also specify CP0 (default) or UTF-8 or UTF-16: StrGet(StringAddress, NumGet(lParam+A_PtrSize), "UTF-16")
cbData := NumGet(lParam+A_PtrSize)/2 ;cbData = String length
StringLeft, Datareceived, CopyOfData, cbData
}
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488
Re: XYAHKLiveFilter - livefilter the filelist
thank you!nerdweed wrote:Sammay,
Nice script.
yes, it's quite easy with AHK. But...Not sure if AHK has any means to identify the box and place it there
... this is the problem.it will be difficult to compute due to different layouts
(though there are workarounds, at a little possible inconvenience of users)
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
Re: XYAHKLiveFilter - livefilter the filelist
Would you not simply have to see if the address bar is turned on and in case it is not then find a different place?SammaySarkar wrote:... this is the problem.it will be difficult to compute due to different layouts
(though there are workarounds, at a little possible inconvenience of users)
[AHK] redirecting Windows Explorer to XY, [XYS] Mini Tree with open tabs (cur loc expanded, tab folders highlighted), [AHK] customInlineRenameKeys, [AHK] clipboardHelper_and_XYEscToList