Mouse over the file (do not need click) to preview the contents. Support ahk,txt,ini,jpg,jpeg,png,bmp,tif format.

Post your working scripts, libraries and tools for AHK v1.1 and older
tuzi
Posts: 223
Joined: 27 Apr 2016, 23:40

Mouse over the file (do not need click) to preview the contents. Support ahk,txt,ini,jpg,jpeg,png,bmp,tif format.

30 Apr 2021, 10:07

Mouse over the file (do not need click) to preview the contents.


This is not a particularly perfect code, and there is a lot of room for improvement in terms of performance and compatibility.

The main purpose is to share it so that more people can get inspired.

I hope someone can help to improve the way to get the full file path under mouse. (I've done some research in this area, but haven't made any major breakthroughs.)



Image


Code (Recommend download the packaged zip file.)


Attention:You must enable "File name extensions" in explorer.


Download
Last edited by tuzi on 01 Oct 2023, 02:25, edited 7 times in total.
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

Re: Preview file content without click. Support ahk,txt,ini,jpg,jpeg,png,bmp,tif format.

30 Apr 2021, 21:50

可以监听鼠标移动以代替定时器。
利用acc的选定函数,应该就可以直接通过Shell.Application获得当前选定的完整路径了。
====
这样好像就干扰到正常操作了。
还有个土办法,把管理器的所有子窗口遍历出来,通过GetWindowText应该能够得到全部必须的信息。
参考这里 https://blog.csdn.net/qq_18218335/article/details/56677351
User avatar
DataLife
Posts: 445
Joined: 29 Sep 2013, 19:52

Re: Preview file content without click. Support ahk,txt,ini,jpg,jpeg,png,bmp,tif format.

01 May 2021, 02:23

This looks really cool, but it did not work for me.

I do have file name extensions turned on. Although, mine is called "Hide extensions for known file types." and I do not have mine hidden.

Windows 10.
Ahk version 1.1.33.02
Check out my scripts. (MyIpChanger) (ClipBoard Manager) (SavePictureAs)
All my scripts are tested on Windows 10, AutoHotkey 32 bit Ansi unless otherwise stated.
tuzi
Posts: 223
Joined: 27 Apr 2016, 23:40

Re: Preview file content without click. Support ahk,txt,ini,jpg,jpeg,png,bmp,tif format.

02 May 2021, 00:52

arcticir wrote:
30 Apr 2021, 21:50
可以监听鼠标移动以代替定时器。
利用acc的选定函数,应该就可以直接通过Shell.Application获得当前选定的完整路径了。
====
这样好像就干扰到正常操作了。
还有个土办法,把管理器的所有子窗口遍历出来,通过GetWindowText应该能够得到全部必须的信息。
参考这里 https://blog.csdn.net/qq_18218335/article/details/56677351
选定文件的路径好获取,鼠标下的资源管理器路径也好获取,但获取鼠标下的文件路径(不选定状态),目前没找到更好的办法。

而实现鼠标即指即预览效果,需要的也是获取鼠标下的文件路径。我在网上找了一圈,没有找到任何公开的办法。我实现的也是目前我能想到的最好办法了。
Last edited by tuzi on 02 May 2021, 01:03, edited 1 time in total.
tuzi
Posts: 223
Joined: 27 Apr 2016, 23:40

Re: Preview file content without click. Support ahk,txt,ini,jpg,jpeg,png,bmp,tif format.

02 May 2021, 00:56

DataLife wrote:
01 May 2021, 02:23
This looks really cool, but it did not work for me.

I do have file name extensions turned on. Although, mine is called "Hide extensions for known file types." and I do not have mine hidden.

Windows 10.
Ahk version 1.1.33.02
I've tested everything on 3 Win10 pcs and so far I don't know what's causing you to not be able to use it.

I guess the problem is in the GetFileUnderMouse() function.
sooyke_
Posts: 25
Joined: 18 Nov 2020, 10:27

Re: Mouse over the file (do not need click) to preview the contents. Support ahk,txt,ini,jpg,jpeg,png,bmp,tif format.

02 May 2021, 01:28

Does not work for me too , can it be a language problem ? Some function name that is not in an english version of win10 ?
I do no get any error , it just does not do anything .
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

Re: Mouse over the file (do not need click) to preview the contents. Support ahk,txt,ini,jpg,jpeg,png,bmp,tif format.

02 May 2021, 04:51

我用我说的方法尝试了下,结果困在了"CtrlNotifySink"这个特殊控件,它包含了当前文件列表,但无法用普通方法获取它的子控件。
csdn上的示例用了GetNextWindow 这个函数,找到这个函数的使用方法(我没找到),再通过坐标判断,就可以直接获取鼠标下的文件名了。
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Mouse over the file (do not need click) to preview the contents. Support ahk,txt,ini,jpg,jpeg,png,bmp,tif format.

02 May 2021, 14:26

Thanks!
Works fine for me (for files w/ text content). I welcome image display, but small pics are displayed too big while big pics are too small... Also displaying pics near right and bottom edge occur out of the screen...
Besides I miss Ctrl and Esc to stop/destroy displayed tip.
tuzi
Posts: 223
Joined: 27 Apr 2016, 23:40

Re: Mouse over the file (do not need click) to preview the contents. Support ahk,txt,ini,jpg,jpeg,png,bmp,tif format.

04 May 2021, 00:28

arcticir wrote:
02 May 2021, 04:51
我用我说的方法尝试了下,结果困在了"CtrlNotifySink"这个特殊控件,它包含了当前文件列表,但无法用普通方法获取它的子控件。
csdn上的示例用了GetNextWindow 这个函数,找到这个函数的使用方法(我没找到),再通过坐标判断,就可以直接获取鼠标下的文件名了。
我看了文章的。之前用 spy++ 和 uia spy 都看过,但是里面没有找到想要的信息,感觉行不通,就没继续下去了。后来想过读内存,但是怕不同版本的explorer各种地址不一致,也没继续下去。
tuzi
Posts: 223
Joined: 27 Apr 2016, 23:40

Re: Mouse over the file (do not need click) to preview the contents. Support ahk,txt,ini,jpg,jpeg,png,bmp,tif format.

04 May 2021, 00:31

rommmcek wrote:
02 May 2021, 14:26
Thanks!
Works fine for me (for files w/ text content). I welcome image display, but small pics are displayed too big while big pics are too small... Also displaying pics near right and bottom edge occur out of the screen...
Besides I miss Ctrl and Esc to stop/destroy displayed tip.
Yes, this is a known detail issue. Since how to get the full path from the explorer is the fundamental issue, I didn't bother to refine those details for now.
tuzi
Posts: 223
Joined: 27 Apr 2016, 23:40

Re: Mouse over the file (do not need click) to preview the contents. Support ahk,txt,ini,jpg,jpeg,png,bmp,tif format.

04 May 2021, 00:36

sooyke_ wrote:
02 May 2021, 01:28
Does not work for me too , can it be a language problem ? Some function name that is not in an english version of win10 ?
I do no get any error , it just does not do anything .
I'm guessing it's not the language problem.
If you can, you can trace the GetFileUnderMouse() with a debug to see exactly where the error is.
tuzi
Posts: 223
Joined: 27 Apr 2016, 23:40

Re: Mouse over the file (do not need click) to preview the contents. Support ahk,txt,ini,jpg,jpeg,png,bmp,tif format.

04 May 2021, 00:44

arcticir wrote:
02 May 2021, 04:51
我用我说的方法尝试了下,结果困在了"CtrlNotifySink"这个特殊控件,它包含了当前文件列表,但无法用普通方法获取它的子控件。
csdn上的示例用了GetNextWindow 这个函数,找到这个函数的使用方法(我没找到),再通过坐标判断,就可以直接获取鼠标下的文件名了。
我又用 spy++ 单独看了一遍, CtrlNotifySink 控件里没找到需要的信息。

或者我工具不对?其它什么工具能显示出来?
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

Re: Mouse over the file (do not need click) to preview the contents. Support ahk,txt,ini,jpg,jpeg,png,bmp,tif format.

04 May 2021, 02:54

@tuzi 我想这是条死路。我搜索到的资料说明真实的文件列信息位于"DirectUIHWND"控件,而这是个WIN内部控件,完全无法解析。
我在那个网页的唯一收获,大概就是不通过com接口而获得当前路径了
sooyke_
Posts: 25
Joined: 18 Nov 2020, 10:27

Re: Mouse over the file (do not need click) to preview the contents. Support ahk,txt,ini,jpg,jpeg,png,bmp,tif format.

04 May 2021, 05:58

@tuzi

try if (WinClass = "CabinetWClass" && CtrlClass = "DirectUIHWND3")

It works if i remove : CtrlClass = "DirectUIHWND3" from the condition
User avatar
DataLife
Posts: 445
Joined: 29 Sep 2013, 19:52

Re: Mouse over the file (do not need click) to preview the contents. Support ahk,txt,ini,jpg,jpeg,png,bmp,tif format.

05 May 2021, 14:55

sooyke_ wrote:
04 May 2021, 05:58
@tuzi

try if (WinClass = "CabinetWClass" && CtrlClass = "DirectUIHWND3")

It works if i remove : CtrlClass = "DirectUIHWND3" from the condition
Fantastic, now it works for me too.
btw, my File Explorer CtrlClass is DirectUIHWND2
That is why it was not working with && CtrlClass = "DirectUIHWND3"

thanks
Check out my scripts. (MyIpChanger) (ClipBoard Manager) (SavePictureAs)
All my scripts are tested on Windows 10, AutoHotkey 32 bit Ansi unless otherwise stated.
tuzi
Posts: 223
Joined: 27 Apr 2016, 23:40

Re: Mouse over the file (do not need click) to preview the contents. Support ahk,txt,ini,jpg,jpeg,png,bmp,tif format.

06 May 2021, 20:57

DataLife wrote:
05 May 2021, 14:55
sooyke_ wrote:
04 May 2021, 05:58
@tuzi

try if (WinClass = "CabinetWClass" && CtrlClass = "DirectUIHWND3")

It works if i remove : CtrlClass = "DirectUIHWND3" from the condition
Fantastic, now it works for me too.
btw, my File Explorer CtrlClass is DirectUIHWND2
That is why it was not working with && CtrlClass = "DirectUIHWND3"

thanks
Thank you.
My File Explorer CtrlClass is DirectUIHWND3
Search Bar is DirectUIHWND1
Status Bar is DirectUIHWND2
WOlfen
Posts: 61
Joined: 14 Jan 2018, 16:48

Re: Mouse over the file (do not need click) to preview the contents. Support ahk,txt,ini,jpg,jpeg,png,bmp,tif format.

08 May 2021, 07:38

This is great.
I really would love to see if there is some kind of FLAC integration which would show some ID3 Tags, Stereo or Mono, Bitrate and Length of the focused item.
tuzi
Posts: 223
Joined: 27 Apr 2016, 23:40

Re: Mouse over the file (do not need click) to preview the contents. Support ahk,txt,ini,jpg,jpeg,png,bmp,tif format.

11 May 2021, 23:55

WOlfen wrote:
08 May 2021, 07:38
This is great.
I really would love to see if there is some kind of FLAC integration which would show some ID3 Tags, Stereo or Mono, Bitrate and Length of the focused item.
maybe you need skan's exifx().
Aenfa
Posts: 13
Joined: 15 May 2016, 18:06

Re: Mouse over the file (do not need click) to preview the contents. Support ahk,txt,ini,jpg,jpeg,png,bmp,tif format.

14 May 2021, 16:25

@arcticir English only please. These are the English forums. Only post Chinese in the Chinese forums.

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 116 guests