External program run #1003 does not work

Discuss and share scripts and script files...
Post Reply
Norn
Posts: 416
Joined: 24 Oct 2021 16:10

External program run #1003 does not work

Post by Norn »

Executing this AHK script does not execute the #1003 command:

Code: Select all

Ctrl & R::
randFile := "E:\Test.png"
Run, "D:\Tools\XYplorer\XYplorer.exe" /feed="::tab('new'`, gpc('%randFile%'`, 'path'))`; selectitems '%randFile%'`; wait 500`; `#1003"
It's the same with cmd:

Code: Select all

"D:\Tools\XYplorer\XYplorer.exe" /feed="::tab('new', 'E:\'); selectitems 'E:\Test.png'; wait 500; #1003"
If using #178 command will work. Is it possible to make the #1003 command work?
Win10, Win11 @100% 2560x1440 22H2

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: External program run #1003 does not work

Post by admin »

Moved the topic. Leave it here.

Norn
Posts: 416
Joined: 24 Oct 2021 16:10

Re: External program run #1003 does not work

Post by Norn »

Well, I thought I just posted wrong. :oops:
Win10, Win11 @100% 2560x1440 22H2

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: External program run #1003 does not work

Post by admin »

I figured :)

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

Re: External program run #1003 does not work

Post by highend »

It seems the command doesn't like a file that was selected via selectitems, even with focus set to the list view. Click on the file once XY has started up and then execute #1003; from the address bar.
Don?
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: External program run #1003 does not work

Post by admin »

The file should be focused and selected.

SC selectitems() does this, but not fully. Next beta will work better.

Norn
Posts: 416
Joined: 24 Oct 2021 16:10

Re: External program run #1003 does not work

Post by Norn »

admin wrote: 25 Jan 2023 19:32I figured :)
Works fine with v24.00.0005 :tup:
Win10, Win11 @100% 2560x1440 22H2

Norn
Posts: 416
Joined: 24 Oct 2021 16:10

Re: External program run #1003 does not work

Post by Norn »

This AHK script works fine.

Code: Select all

#Requires AutoHotkey v2.0.2

^r::
{

 lst:= "D:\Pics\220502.png`nD:\Pics\220625.png"
 lstArray := StrSplit(lst, "`n")
 randFile := lstArray[Random(1, lstArray.Length)]
 Run '"D:\XYplorer\XYplorer.exe" /feed=|::tab("close"); tab("new", gpc("' randFile '", "path")); if(get("view") != 6) {#308}; goto "' randFile '"; if(get("#178") == 0) {#1003}|'

}
But it only works the first time with SendMessage, it would be nice to have it work with SendMessage every time, because it seems faster.

Code: Select all

#Requires AutoHotkey v2.0.2

^r::
{

 lst:= "D:\Pics\220502.png`nD:\Pics\220625.png"
 lstArray := StrSplit(lst, "`n")
 randFile := lstArray[Random(1, lstArray.Length)]
 if(xyHwnd:=GetXYHWND())
    Send_WM_COPYDATA(xyHwnd, '::tab("close"); tab("new", gpc("' randFile '", "path")); if(get("view") != 6) {#308}; goto "' randFile '"; if(get("#178") == 0) {#1003}')

}



GetXYHWND() {
	static xyClass := 'ahk_class ThunderRT6FormDC'

	if hwnd := WinActive(xyClass)
		return hwnd
	else if WinExist(xyClass)
		return WinGetList(xyClass)[1]
}


Send_WM_COPYDATA(xyHwnd, message) {

   size := StrLen(message)
   if !(StrLen(Chr(0xFFFF))) {
      data := Buffer(size * 2, 0)
      StrPut(message, &data, size, "UTF-16")
   } else {
      data := message
   }

   COPYDATA := Buffer(A_PtrSize * 3)
   NumPut("Ptr", 4194305, COPYDATA, 0)
   NumPut("UInt", size * 2, COPYDATA, A_PtrSize)
   NumPut("Ptr", StrPtr(data), COPYDATA, A_PtrSize * 2)

   return DllCall("User32.dll\SendMessageW", "Ptr", xyHwnd, "UInt", 74, "Ptr", 0, "Ptr", COPYDATA, "Ptr")
}
Win10, Win11 @100% 2560x1440 22H2

Post Reply