XYplorer Messenger (using AHK language)

Discuss and share scripts and script files...
klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: XYplorer Messenger (using AHK language)

Post by klownboy »

Hi nerdweed, I don't have much time today, but to get you started or until binocular222 pipes in, I would recommend you first use AU3_Spy.exe to detect what the XY window is. I can tell you, since I checked already, that "ahk_class ThunderRT6FormDC" is the normal XYplorer window, and both the floating and full screen preview is: "ClassNN: ThunderRT6PictureBoxDC2". I'd strongly recommend looking and using the "MouseGetPos" example at the bottom of that page in the help file. It will give you a floating tooltip with valuable information of each window it's hovering over including, "ahk_class", "ahk_id", and "control". The "control" is the tricky part you need since that's what distinguishes the floating preview or full screen preview from the regular XYplorer window. Something like this determines if XYplorer is active, but it's been awhile so I'll have to research how to distinguish the control preview window "ThunderRT6PictureBoxDC2"

Code: Select all

  HWND := WinExist("ahk_class ThunderRT6FormDC")
    IfWinActive, ahk_id %HWND%
	{ bla bla bla more code }
I'll dig some more tomorrow.
Ken
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

nerdweed
Posts: 648
Joined: 25 Feb 2012 07:47

Re: XYplorer Messenger (using AHK language)

Post by nerdweed »

Thanks. I have written this which works with a small catch due to checking on mouse position - I have to focus around center of the image due to some pics being of smaller size, but that should be OK, considering it is not mission critcal :p and I get to know about that immediately since I send a space key after rating the file to move the file which doesn't happen.

Is there any way to write the MouseGetPos on the first line itself.

Code: Select all

#If WinActive("ahk_class ThunderRT6FormDC", "" , "XYplorer", "" )
1:: Rate(1, "<curitem>")
2:: Rate(2, "<curitem>")
3:: Rate(3, "<curitem>")
4:: Rate(4, "<curitem>")
5:: Rate(5, "<curitem>")
0:: Rate("", "<curitem>")

Rate(Rating,File)
{
	MouseGetPos, , , , Control
	if (Control = "ThunderRT6PictureBoxDC2")
	{
		MessagetoXYplorer  := "::tagitems(ex:Rating, '" . Rating . "', " . File . ") `;"
		Communicate(MessagetoXYplorer)
		Send {Space}
	}
	Else {
		Send %Rating% 
	}
	Return
}

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: XYplorer Messenger (using AHK language)

Post by klownboy »

Hey nerdweed, honestly I wasn't thinking of using MouseGetPos in the script but only to use it as a tool to get the window information needed. I was hoping to detect the control window via a different method like ControlGetFocus or ControlGet. This way you wouldn't have an issue with exact mouse placement. Though, I'm afraid it's a bit more difficult to determine when the ClassNN control like "ThunderRT6PictureBoxDC2 is "active"...still researching. :)
Ken
Last edited by klownboy on 13 Jul 2014 14:28, edited 1 time in total.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: XYplorer Messenger (using AHK language)

Post by highend »

No time for this today (girlfriend is here), but this wouldn't be so hard.
A loop that checks all controls in the active window and if it matches
"like "ThunderRT6PictureBoxDC2" you already have the correct one.
One of my scripts helped you out? Please donate via Paypal

nerdweed
Posts: 648
Joined: 25 Feb 2012 07:47

Re: XYplorer Messenger (using AHK language)

Post by nerdweed »

No hurry. I have something workable for now. Do give it a try when you have some free time and please let me know if you come up with something.

And, I found a better way to do this as mentioned by Highend

Code: Select all

WinGet, Control, ControlList , "ahk_class ThunderRT6FormDC", , "XYplorer"
	if (Control Like "*ThunderRT6PictureBoxDC2*")
instead of this

Code: Select all

MouseGetPos, , , , Control
   if (Control = "ThunderRT6PictureBoxDC2")
Now, is there any way to check this in the first if statement
#If WinActive("ahk_class ThunderRT6FormDC", "" , "XYplorer", "" )
Last edited by nerdweed on 13 Jul 2014 14:57, edited 1 time in total.

binocular222
Posts: 1416
Joined: 04 Nov 2008 05:35
Location: Hanoi, Vietnam

Re: XYplorer Messenger (using AHK language)

Post by binocular222 »

Code: Select all

#If Checking()
1:: Rate(1, "<curitem>")
2:: Rate(2, "<curitem>")
3:: Rate(3, "<curitem>")
4:: Rate(4, "<curitem>")
5:: Rate(5, "<curitem>")
0:: Rate("", "<curitem>")

Checking()
{
	MouseGetPos, , , , Control
	If Control in _WwG1,ThunderRT6PictureBoxDC2,ThunderRT6PictureBoxDC60,Richedit20WPT6,Richedit20WPT7,Richedit20WPT8,Richedit20WPT12 AND WinActive("ahk_class ThunderRT6FormDC")
		return 1
}

Rate(Rating,File)
{
	MessagetoXYplorer := "::tagitems(ex:Rating, '" . Rating . "', " . File . ") `;"
	Communicate(MessagetoXYplorer)
	Sendinput {Space}
	Return
}
Notice that possible values of ClassNN in a floating preview is numerous (i.e: _WwG1,ThunderRT6PictureBoxDC2,...), the above list is incomprehensive. To check on your own computer: Run this script and hover mouse over a floating preview

Code: Select all

#Persistent
settimer, checkcontrol, 200
checkcontrol:
MouseGetPos, , , , Control
tooltip %Control%
return
P.S: Seems like I return from vacation on time before this thread is flooded
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

nerdweed
Posts: 648
Joined: 25 Feb 2012 07:47

Re: XYplorer Messenger (using AHK language)

Post by nerdweed »

Sorry, but I didn't understand much of what you intended to say apart from this

1. I can't use something like the below
If ((WinGet, Control, ControlList , "ahk_class ThunderRT6FormDC", , "XYplorer") In ThunderRT6PictureBoxDC2)
2. Using Like is a bad option and hence used n

I always ThunderRT6PictureBoxDC2 for Floating Preview and Full Screen Preview (ThunderRT6PictureBoxDC1 for the filename info). I tried restarting XY as well and launched the preview later, but it still matches this.

P.S. Sorry to flood this thread. Didn't want to create another thread for AHK stuff and I wouldn't have had much luck on the AHK forum with this.

binocular222
Posts: 1416
Joined: 04 Nov 2008 05:35
Location: Hanoi, Vietnam

Re: XYplorer Messenger (using AHK language)

Post by binocular222 »

My script above should work as it. Have you tried it? Anything wrong?
The only line you should customize is

Code: Select all

If Control in _WwG1,ThunderRT6PictureBoxDC2,ThunderRT6PictureBoxDC60,Richedit20WPT6,Richedit20WPT7,Richedit20WPT8,Richedit20WPT12 AND WinActive("ahk_class ThunderRT6FormDC")
It already include ThunderRT6PictureBoxDC1. It's a special syntax, thus don't try to add round bracket to it. The syntax is

Code: Select all

If Variable in value1,value2,value3,value4
equal to

Code: Select all

if(Variable="value1" OR Variable="value2" OR Variable="value3" OR Variable="value4")
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

nerdweed
Posts: 648
Joined: 25 Feb 2012 07:47

Re: XYplorer Messenger (using AHK language)

Post by nerdweed »

It does work with ThunderRT6PictureBoxDC2 alone. I have marked this line in there as well - just in case someday it doesn't work out. I thought you meant it wouldn't work all the time since you said the list isn't all inclusive.

Thanks guys.

binocular222
Posts: 1416
Joined: 04 Nov 2008 05:35
Location: Hanoi, Vietnam

Re: XYplorer Messenger (using AHK language)

Post by binocular222 »

This bug should be fixed:
If regional and language setting is set to use dot as thousand separator and comma as decimal separator, then the following fucked up:
FunctionMessagetoXYplorer("::msg 01,2009") ;not work at all
FunctionMessagetoXYplorer("::msg 01.2009") ;XY return 01,2009

Anyone have a straightup fix? Or a neat work around?
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: XYplorer Messenger (using AHK language)

Post by highend »

Is there a way to use SendNotifyMessageW instead of SendMessageW?

The necessity to wait for XY to process the script (and therefore freezing my application that sends it) is... baaaaad. I need an asynchronous call :/ Using a command line call (/script="" + /flg=2) isn't really an option...

Both functions have the same syntax but just replacing it doesn't work...

https://msdn.microsoft.com/en-us/librar ... 85%29.aspx
https://msdn.microsoft.com/en-us/librar ... 85%29.aspx
One of my scripts helped you out? Please donate via Paypal

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: XYplorer Messenger (using AHK language)

Post by highend »

No way to get an async wm_copydata call?

I'd have a nice app in the pipeline...

*shameless bump*
One of my scripts helped you out? Please donate via Paypal

LostFirefox36
Posts: 6
Joined: 15 Aug 2019 00:21

Re: XYplorer Messenger (using AHK language)

Post by LostFirefox36 »

This is probably far fetched as the original script was posted almost 10 years ago, but it recently stopped working after the 23.40 release according to the post here: viewtopic.php?f=7&t=18062&p=202981#p202981

I'm not sure how to go about debugging why it's no longer working, if someone has any input i'd appreciate it. I use this function in a bunch of my daily scripts.

jupe
Posts: 2757
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: XYplorer Messenger (using AHK language)

Post by jupe »

Have you tried the latest XYplorer 23.60, the bug you posted about in RC script thread was fixed last month here:

viewtopic.php?p=202233#p202233

that thread has some AHK code you could compare too, else the bug you encountered is another one.

LostFirefox36
Posts: 6
Joined: 15 Aug 2019 00:21

Re: XYplorer Messenger (using AHK language)

Post by LostFirefox36 »

Ah! Didn't realize there was an update. I installed 23.60 and it solved the issue. Thanks!!

Post Reply