Author |
Topic |
|
ivancarv.spk333
38 Posts |
Posted - 03/15/2013 : 16:02:24
|
Strokesplus the hand closes the window (Properties) to an ordinary file in Windows XP, use the following code
function sp_before_action(gnm, gsx, gsy, gex, gey, gwd, gapp, gact) --Activate the owning window where the gesture started acActivateWindow(acGetOwnerWindowByPoint(gsx, gsy),0,0) end
acSendKeys("%{F_4}") |
|
Rob
USA
2615 Posts |
Posted - 03/15/2013 : 16:07:28
|
Can you be a little more specific? First of all, this wouldn't be classified as a bug, it's really just a script issue, meaning you need the proper script logic.
If you're saying that trying to close the Properties dialog for a file using the script above, I would imagine it would close the Windows Explorer window, since you're activating the parent window (Explorer) and sending ALT+F4.
The script is doing exactly what you're asking it to do. You may need to use different logic to test the type of window and handle things differently. For example, if the active window a the Properties dialog, you may want to send Escape instead (and skip activating the parent window).
Scripts can get very complicated to do exactly what you want in a variety of scenarios, so be prepared to get better at scripting |
|
|
ivancarv.spk333
38 Posts |
Posted - 03/15/2013 : 18:23:06
|
this problem only happens when I use the code below.
function sp_before_action(gnm, gsx, gsy, gex, gey, gwd, gapp, gact) --Activate the owning window where the gesture started acActivateWindow(acGetOwnerWindowByPoint(gsx, gsy),0,0) end acSendKeys("%{F_4}")
to remove it and leave only (acSendKeys("%{F_4}") the feature works normally in any window.
want me to do a video? |
|
|
Rob
USA
2615 Posts |
Posted - 03/15/2013 : 18:28:00
|
Right, when you call acActivateWindow(acGetOwnerWindowByPoint(gsx, gsy),0,0), the parent window is activated, then ALT+F4 is sent to the other window. You're welcome to do a video so I can better understand the situation. |
|
|
ivancarv.spk333
38 Posts |
|
Rob
USA
2615 Posts |
Posted - 03/15/2013 : 22:41:47
|
First off all, this code is not meant to go into an action script:function sp_before_action(gnm, gsx, gsy, gex, gey, gwd, gapp, gact)
--Activate the owning window where the gesture started
acActivateWindow(acGetOwnerWindowByPoint(gsx, gsy),0,0)
end It's meant to be a function defined in the Global Lua tab. By defining the function in an action script, you're creating a reference to a function which is intended to be called by S+ only by it being declared once in Global Lua. When defined in Global Lua, S+ calls this function before ALL actions, so it doesn't need to be added in a script. If you only want a certain script to active a window, then you could use the script below in an action. It technically works when you put it into an action because after the first time you run the script, the sp_before_action function is defined in the Lua state and S+ will call it...but this is not the way it was intended nor should be used.
Second, RunDLL windows are difficult to identify. The problem is that, for example, Internet Properties isn't an application, it's a dialog hosted by RunDLL. RunDLL has it's own invisible window which is the parent of the Internet Properties dialog. Calling acActivateWindow(acGetOwnerWindowByPoint(gsx, gsy),0,0) activates the owner window of Internet Properties, which in this case is the RunDLL window, so S+ activates the RunDLL window and tries to send the keys to it (which RunDLL ignores).
This can be accomplished in Lua script using S+ action calls, but you'd need to have specific checks for dialogs owned by RunDLL. For example, this works for me:if acGetClassName(acGetOwnerWindowByPoint(gsx, gsy),nil,nil) == "RunDLL" then
--this is a RunDLL dialog, activate the PARENT (not owner) window
acActivateWindow(acGetParentWindowByPoint(gsx, gsy),nil,nil)
else
--activate the OWNER window
acActivateWindow(acGetOwnerWindowByPoint(gsx, gsy),nil,nil)
end
acSendKeys("%{F_4}")
|
|
|
ivancarv.spk333
38 Posts |
Posted - 03/16/2013 : 01:20:15
|
Thanks for the details .. This code will only work with internet explorer window. With other windows properties the script did not work.
|
|
|
|
Topic |
|
|
|