StrokesPlus Forum
                       
StrokesPlus Forum
Home | Profile | Register | Active Topics
Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Lua Scripts
 General Action Scripts
 Problem when closing the window Propiedades
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ivancarv.spk333

38 Posts

Posted - 03/15/2013 :  16:02:24  Show Profile  Reply with Quote
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
2537 Posts

Posted - 03/15/2013 :  16:07:28  Show Profile  Visit Rob's Homepage  Reply with Quote
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
Go to Top of Page

ivancarv.spk333

38 Posts

Posted - 03/15/2013 :  18:23:06  Show Profile  Reply with Quote
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?
Go to Top of Page

Rob

USA
2537 Posts

Posted - 03/15/2013 :  18:28:00  Show Profile  Visit Rob's Homepage  Reply with Quote
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.
Go to Top of Page

ivancarv.spk333

38 Posts

Posted - 03/15/2013 :  20:01:16  Show Profile  Reply with Quote
see
http://www.youtube.com/watch?v=3eXh5i3hNqQ
Go to Top of Page

Rob

USA
2537 Posts

Posted - 03/15/2013 :  22:41:47  Show Profile  Visit Rob's Homepage  Reply with Quote
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}")

Go to Top of Page

ivancarv.spk333

38 Posts

Posted - 03/16/2013 :  01:20:15  Show Profile  Reply with Quote
Thanks for the details ..
This code will only work with internet explorer window. With other windows properties the script did not work.

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
StrokesPlus Forum © 2011-2018 Rob Yapchanyk Go To Top Of Page
Snitz Forums 2000