XYAHKLiveFilter - livefilter the filelist

Discuss and share scripts and script files...
klownboy
Posts: 4376
Joined: 28 Feb 2012 19:27
Location: Windows 11, 24H2 Build 26100.4770 at 100% 2560x1440

Re: XYAHKLiveFilter - livefilter the filelist

Post by klownboy »

AHK and XY do play nicely together don't they? Thanks to you Sammay and also to you binocular222. Very nice scripts indeed!

Sammay could you provide the uncompiled version for those of us who are AHK users and don't need or necessarily want to compile. And that way I can place the input box wherever I'd like. Thanks.

Sammy and binocular222, could you have provided within the same AHK script a launching key capability based on XY being "active"? Though I suppose I could provide that in my AHK script that I run at boot-up. I'd rather it wasn't resident all the time in any case, which it isn't as it is now.

Code: Select all

 IfWinActive, ahk_class ThunderRT6FormDC
{ bla bla bla}

binocular222
Posts: 1418
Joined: 04 Nov 2008 05:35
Location: Win11, Win10, 100% Scaling

Re: XYAHKLiveFilter - livefilter the filelist

Post by binocular222 »

add this kind of line to the top of script:

Code: Select all

Settitlematchmode, 2
#Ifwinactive, XYplorer ahk_class ThunderRT6FormDC
^+v::
Means Ctrl+Shift+V will trigger.
Sammay already post the AHK source code in his first post
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: XYAHKLiveFilter - livefilter the filelist

Post by bdeshi »

autocart wrote: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?
Yes, I'm thinking using setlayout() to ensure the addressbar is visible, then anchor the filterbox over the right side of the AB. But users could always disable the addressbar, or move it... so I should make the filterbox movable.

Ken, my version of the script is designed to be launched from within a running XY instance (no need to check for XY being active) and closes when the parent XY is closed (it's not resident). Running it independently is rather useless...
And as I suggested in the first post, a UDC keybrd shortcut can be used as a launching key.
Binocular's version can run independently though
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

klownboy
Posts: 4376
Joined: 28 Feb 2012 19:27
Location: Windows 11, 24H2 Build 26100.4770 at 100% 2560x1440

Re: XYAHKLiveFilter - livefilter the filelist

Post by klownboy »

Thanks Sammay and binocular222. I was only thinking of setting up the hotkey for XY being active since my key assignment might be the same key used in my startup AHK script that performed a number of different actions depending on what program is active. Not a problem either way is fine. Thanks again.

I don't typically have the AB displayed until needed, but I can tweak the code to place it. Isn't it too bad the BC and the AB aren't stackable side-by-side like the Toolbar and AB are presently since there is much more horizontal real estate free. I don't need the whole width of the screen to do the BC, but the Toolbar takes up the full width and I would imagine that's the case with most people.

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: XYAHKLiveFilter - livefilter the filelist

Post by bdeshi »

Updated.
> Added option to toggle live mode.
Mainly to allow entering regexp patterns without XY throwing errors everytime.
Check the P (p for pause), enter a (complex/regexp) filter pattern, then uncheck it.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: XYAHKLiveFilter - livefilter the filelist

Post by bdeshi »

I can't obtain the correct x/y position for any XY GUI element (ab, toolbar, bc, nav panels, status, panes)?
Confirmation? Ideas?
AHK to obtain position of control under cursor: http://ahkscript.org/docs/commands/Cont ... tm#Example
It seems to me XY creates it's gui elements on a central heap (so to say), then moves them around to current positions.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

binocular222
Posts: 1418
Joined: 04 Nov 2008 05:35
Location: Win11, Win10, 100% Scaling

Re: XYAHKLiveFilter - livefilter the filelist

Post by binocular222 »

I found the result from Controlget is misleading too.
The only workaround I can think of is using sysget to get the size of titlebar/border/... then do some math to calculate the size position of elements. XY uses a lot of OS system elements though.
i.e:
SysGet, xborder, 32
SysGet, yborder, 33
SysGet, caption, 4
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: XYAHKLiveFilter - livefilter the filelist

Post by bdeshi »

Thanks for the hints. Will check it out.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

autocart
Posts: 1331
Joined: 26 Sep 2013 15:22

Re: XYAHKLiveFilter - livefilter the filelist

Post by autocart »

Guys, what is the problem? Does the following code not work for you? Am I missing some important point?

Code: Select all

ControlGet, addressBarVisible, Visible, , Edit16, ahk_class ThunderRT6FormDC
if (addressBarVisible)
{
	ControlGetPos, X, Y, W, H, Edit16, ahk_class ThunderRT6FormDC
	MsgBox The address bar is visible.`nThe position of its input field (upper left corner) is X:%X% Y:%Y% pixels from XY's window's upper left corner.`nIts input field's width is %W% and its height is %H% pixels.
}
else
{
	MsgBox The address bar is hidden.
}

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: XYAHKLiveFilter - livefilter the filelist

Post by bdeshi »

And the X and Y values match the *visual/actual* position of the addressbar?
(Btw, same problem in Au3. Window info tools in both AHK and Au3 install package show the correct positions though)
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

autocart
Posts: 1331
Joined: 26 Sep 2013 15:22

Re: XYAHKLiveFilter - livefilter the filelist

Post by autocart »

SammaySarkar wrote:And the X and Y values match the *visual/actual* position of the addressbar?
As I wrote in the code, those are the coords of the upper left corner of the input field (or edit field or text field) of the address bar. Relative to the upper left corner of the XY window. Thats at least what the ahk help file says and it seems to correspond with my own experience of testing this command in ahk.

autocart
Posts: 1331
Joined: 26 Sep 2013 15:22

Re: XYAHKLiveFilter - livefilter the filelist

Post by autocart »

SammaySarkar wrote:(Btw, same problem in Au3. Window info tools in both AHK and Au3 install package show the correct positions though)
My experience is: In ahk it seems it can handle only standard fields like EditNN and maybe the ThunderRT6Frame18 - frame for toolbar - right. Also, the window info tool in ahk does not show any position or size for the controls here.

In au3 I can retrieve the positions and sizes of as it seems all XY controls (although the retrieved coords in au3 seem to be relative to the upper left corner of the client area (inner content area) of the XY window, not as in ahk where it seems to be relative to the upper left of the outside edge of the XY window).
e.g. au3 code for BC:

Code: Select all

Local $aPos = ControlGetPos("[CLASS:ThunderRT6FormDC]", "", "ThunderRT6PictureBoxDC34")
MsgBox(0, "", "Position: " & $aPos[0] & ", " & $aPos[1] & @CRLF & "Size: " & $aPos[2] & ", " & $aPos[3])

autocart
Posts: 1331
Joined: 26 Sep 2013 15:22

Re: XYAHKLiveFilter - livefilter the filelist

Post by autocart »

I took the freedom to alter part of the Main of your code from the 1st post, Sammay. It still needs fine-tuning regarding the height of the filterbox, if you want to. Other than that it pops up nicely over the address bar, at least here with me. If AB is turned off it seems to at the moment pop up where the AB appeared last.

Code: Select all

Main:
     ;MsgToXY("::setlayout(showaddressbar=1);")
     ControlGetPos, ABX, ABY, ABW, ABH, Edit16, ahk_id %XYhWnd%
     SysGet, xborder, 32
     SysGet, yborder, 33
     SysGet, heightOfCaption, 4
     SysGet, heightOfMenu, 15
     guiX := "X" . (ABX - xborder)
     guiY := "Y" . ((((ABY - yborder) - heightOfCaption) - heightOfMenu) - 3)
     ;ToolTip, X %ABX%  Y %ABY%  W %ABW%  H %ABH% ;reported addressbar X/Y is confusing
     Gui, +HwndGUIhWnd  -Resize -Border -Caption +OwnDialogs +AlwaysOnTop
       Gui, Margin, 0, 0       ; TODO   remove background around editbox margin
       Gui, Font, s8, Segoe UI ; should be DPI aware
       GUI, Add, Checkbox, gUpdateFilter hWndGUIPausehWnd 0x8000 0xc00, P    ;pause livemode for RegExp
       Gui, Add, Edit, y1 gUpdateFilter hWndGUIEdithWnd R1, ""             ;the all-important filterbox
       DllCall("SetParent","UInt", GUIhWnd, "UInt", XYhWnd)              ;child of XY
       GuiControlGet, EditPos, Pos, %GUIEdithWnd%
       GuiControl, Move, %GUIEdithWnd%, % "w" EditPosW*8
       GuiControl, Move, %GUIPausehWnd%, % "h" EditPosH ;set same height as filterbox (to center-align)
     Gui, Show, %guiX% %guiY% AutoSize
     SendInput, {Right}{Left}
     ;^ place cursor inside default quotes (Edit is created last and focused)

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: XYAHKLiveFilter - livefilter the filelist

Post by bdeshi »

Thanks, that works. (though I had to change the 3 to 5 in guiY. That value appears to be the padding between ThunderRT6PictureBoxDC57 and Edit16)

UPDATE: Well, it's usable only if the AB is at the left edge of XY window. If it's positioned after the toolbar, our filterbox might get hidden when XY window is resized.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: XYAHKLiveFilter - livefilter the filelist

Post by SkyFrontier »

First: having no time even to read the forums, this morning I had the opportunity to make an install that has the LiveFilter4List (finding a free shortcut in my main install is something I just can't for the time being) attached to SHIFT+F as it'll be VERY USEFUL in the days to come.

2nd: no one else other than me having problems with antivirii? http://www.xyplorer.com/xyfc/viewtopic.php?f=3&t=12342
Had no time yet to check about this on AHK forums, but one of you guys may have a word to say on this matter too!

3rd: when the window loses focus and I go back to it, ESC only works if I directly click the filter box. Can this be fixed, ie, ESC being able to dismiss the filter box without the need to click it after alt-tabbing?

4th: I'd like to have a built-in function that, when the Filter is active, it could intercept CTRL+SHIFT+P or CTRL+P (copy name/full name) in a manner that when clicking the combo on a file named "Document title (12).ext", the " (x).ext" {yes, [space](x).ext"} would be ignored, auto-applying "Document title" as a filter.

Awesome job, guys! (I see it's a collective work after Sammay's v1 - congrats again, man!)
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

Post Reply