Author |
Topic |
|
Rob
USA
2615 Posts |
|
cyberalex4life
53 Posts |
Posted - 07/06/2012 : 05:47:12
|
nice, I know have what to play with :D |
|
|
cyberalex4life
53 Posts |
Posted - 07/06/2012 : 06:22:46
|
nope, still don't work or didn't try enough. But this workaround works pretty fine:
local x = acGetMouseLocationX() local y = acGetMouseLocationY() acMouseClick(gsx, gsy, 0, 1, 1) acSendKeys("{ESCAPE}%{F_4}") acMouseMove(x, y) |
|
|
Rob
USA
2615 Posts |
Posted - 07/06/2012 : 06:29:34
|
I simply don't know what to tell you, I don't have the issue at all, figured maybe some other tweaks would help. Without being able to reproduce this, there's not much I can do. |
|
|
cyberalex4life
53 Posts |
Posted - 07/06/2012 : 06:43:29
|
It closes those windows (the one with no maximize function) when I change this code function sp_before_action(gnm, gsx, gsy, gex, gey, gwd, gapp, gact) acActivateWindow(nil, gsx, gsy,0) end --acActivateWindow(nil, gsx, gsy,1) acSendKeys("%{F_4}")
in this
function sp_before_action(gnm, gsx, gsy, gex, gey, gwd, gapp, gact) acActivateWindow(nil, gsx, gsy,0) end --acActivateWindow(nil, gsx, gsy,0) acSendKeys("%{F_4}")
and viceversa (but only with mouse Configure Actions tab opened or minimized, not closed. Otherwise doesn't work at all)
The ideea is, that altghough it should activate the window, acActivateWindow does the oposite. It's the same change of transparency as when you select desktop, or another window. I'm guessing it does not manage to find the correct handle to the window.
This code works fine if you first click on the window: acSendKeys("%{F_4}")
acActivateWindow deactivates the windows with problems, although they are active at first. That's why the gesture does not succeed. |
|
|
Rob
USA
2615 Posts |
Posted - 07/06/2012 : 06:51:14
|
Ok, so it's not a matter of S+ not activating a window, but activating the wrong window.
Put this before your acActivateWindow call and see what it shows:local sMsg = "Window Title: "..acGetWindowTitle(acGetOwnerWindowByPoint(gsx, gsy),0,0)
sMsg = sMsg.."\nClass Name: "..acGetClassName(acGetOwnerWindowByPoint(gsx, gsy),0,0)
acMessageBox(sMsg,"Title/Class",nil) |
|
|
cyberalex4life
53 Posts |
Posted - 07/06/2012 : 07:19:11
|
On Mouse Control Panel Settings:
Window Title: Class Name: run.dll
Same on Audio Devices Control Panel Settings.
But on Realtek HD Audio Driver:
Window Title: HD Audio CPL for Vista Class Name: Afx:0000000140000000:0
(every zeros group has 7 zeros, not last - only one)
For Windows Explorer (Computer)
Window Title: Computer Class Name: CabinetWClass
It seems that every other window that has names in both window title and class name activate just fine..
|
|
|
Rob
USA
2615 Posts |
Posted - 07/06/2012 : 08:08:03
|
Most (if not all) Control Panel windows are owned by RunDLL, which doesn't exactly have an interface..though it does have a hidden window. By default, calling:
acActivateWindow(nil,gsx, gsy)
Is going to activate the OWNER window (most of the time that's fine). But for these windows (on my system, Windows 7 64-bit), it would have to be changed to this:
acActivateWindow(acGetWindowByPoint(gsx, gsy),0,0)
Since I want to send the activate directly to the window, NOT the owner.
There's is no perfect solution to these situations, I had to use Spy++ to find out the ownership and adjust.
Note that changing it to fix the Control Panel applet may not work for other windows as expected, which would mean you'd need to build in conditional statements to check the owner first, if it's Rundll, then call acActivateWindow using the different method above, otherwise use the default call. |
|
|
cyberalex4life
53 Posts |
Posted - 07/06/2012 : 08:23:38
|
I thought about these test conditions, sadly I don't know Lua... yet... |
|
|
cyberalex4life
53 Posts |
Posted - 07/06/2012 : 08:48:26
|
I may have found a new solution:
local handle = acGetWindowByPoint(gsx,gsy) local x = acGetWindowTop(handle, 0,0) local y = acGetWindowLeft(handle, 0,0) acActivateWindow(acGetWindowBottom(nil, x, y),0,0) acSendKeys("%{F_4}")
With your solution S+ first closes the inner window of the dialog and then the outer. But with this new one it just seems to work perfectly on any window. Thanks for the ideas.
(as you may have noticed instead of usin gsx, gsy, i used the left top corner) |
|
|
Rob
USA
2615 Posts |
Posted - 07/06/2012 : 08:50:41
|
Something like this works (on my system, probably would have to change "RunDLL" to "run.dll"..but I can't say for sure how it will work for you:local sRunDLL = "RunDLL"
local sOwnerClass = acGetClassName(acGetOwnerWindowByPoint(gsx, gsy),0,0)
if sOwnerClass == sRunDLL then
local iWindow = acGetWindowByPoint(gsx, gsy)
local iParentWindow = acGetParentWindowByPoint(gsx, gsy)
if acGetClassName(iParentWindow,0,0) == sRunDLL then --see if we're over a child control within the window
acActivateWindow(iWindow,0, 0)
else
acActivateWindow(iParentWindow,0, 0)
end
else
acActivateWindow(nil,gsx, gsy)
end I just saw your other posting, that's another way to do it |
|
|
cyberalex4life
53 Posts |
Posted - 07/06/2012 : 13:22:20
|
iParentWindow = acGetParentWindowByPoint(gsx, gsy) acActivateWindow(iParentWindow,0, 0) acSendKeys("%{F_4}")
this does not close programs like zoom player when drawing gesture on playlist or equilizer, but works for main window. Prety fine for 3 rows.. |
|
|
Rob
USA
2615 Posts |
Posted - 07/06/2012 : 13:38:04
|
Another way which seems to work well is this.
Put this in your Global Lua:alien = alien.core
user32 = alien.load("user32.dll")
-- ************ GetAncestor ************
gGetAncestor = user32.GetAncestor
gGetAncestor:types{ ret = 'long', abi = 'stdcall', 'long', 'uint'}
GA_PARENT = 1
GA_ROOT = 2
GA_ROOTOWNER = 3
function aGetAncestor(iWnd, iFlags)
return gGetAncestor(iWnd, iFlags)
end Then in your action:acActivateWindow(aGetAncestor(acGetWindowByPoint(gsx, gsy), GA_ROOT), 0, 0)
|
|
|
cyberalex4life
53 Posts |
Posted - 07/06/2012 : 14:02:05
|
Actually I have this tendency for as much as general code... This is why I like the simple one. And, to be honest, I kind of like that it only closes programs only when performed on main windows. |
|
|
cyberalex4life
53 Posts |
Posted - 07/06/2012 : 14:13:03
|
I've integrated it in almost every gesture on windows and it's incredibly fast now |
|
|
cyberalex4life
53 Posts |
Posted - 07/08/2012 : 01:58:40
|
iParentWindow = acGetParentWindowByPoint(gsx,gsy) acActivateWindow(nil, gsx, gsy) acSendKeys("%{F_4}")
iParentWindowTest = acGetParentWindowByPoint(gsx,gsy) if iParentWindow == iParentWindowTest then -- test if window is still open acActivateWindow(iParentWindow,0, 0) acSendKeys("%{F_4}") end
solved zoom player problem... |
|
|
Rob
USA
2615 Posts |
Posted - 07/08/2012 : 08:20:05
|
Good job!
There's always a way |
|
|
|
Topic |
|
|
|