This App is No Longer Maintained. Visit the Replacement at StrokesPlus.net

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

 All Forums
 General Discussion
 General Discussion
 Consume Input
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

XilE

10 Posts

Posted - 09/14/2013 :  15:45:38  Show Profile
If there any way to set a key to ignore the block? I know with AHK I can do it with $Key I don't really like to ask questions, but I've been searching for 5 hours now.
I'm guessing I'll need an override function set in the global set on a loop but I'm not sure.

Also this is not urgent I'm just curious.

Thanks

Rob

USA
2615 Posts

Posted - 09/14/2013 :  17:06:53  Show Profile  Visit Rob's Homepage
Would you mind explaining "any way to set a key to ignore the block"?

Ignore what and when?
Go to Top of Page

XilE

10 Posts

Posted - 09/15/2013 :  03:47:43  Show Profile
I mean lets say I am setting up a new macro that uses consume and I decide I want to break out of it before it's over.

Like on my autohotkey I can do

SetTimer, Var, 10000
Return

Var:
BlockInput, Off

A & S::
SetTimer, Var, On
BlockInput, On
Actions,
Sleep,
More Actions,
BlockInput, Off
SetTimer, Var, Off
Return

$End::ExitApp or Reload as a global override that cannot be blocked so I can exit without waiting for the timeout delay. I'm still not sure on how to set a timeout delay with SP.

Still with AHK control, alt, del will break the script no matter what without an override like $End::ExitApp, but this is not the case with SP. I had log off to kill it when I F'd up >.<

I know the answer I'm looking for is probably simple lol but I'm still very noobish with lua.


Almost forgot.

Gesture
Timeout or global override key turn off acConsumePhysicalInput
acConsumePhysicalInput(1)
acSendKeys()
acDelay()
acSendKeys()
Messed something up "now I'm stuck" so I can never make it down to turn the input back on or I decide I want to kill end the gesture prematurely.
acConsumePhysicalInput(0)

Edited by - XilE on 09/15/2013 03:54:44
Go to Top of Page

Rob

USA
2615 Posts

Posted - 09/15/2013 :  16:38:10  Show Profile  Visit Rob's Homepage
It sounds like you want to use leverage Lua coroutines:

http://lua-users.org/wiki/CoroutinesTutorial

I don't have the time right now to build out the script, but I would imagine the SetTimer type functionality going into sp_before_action in Global Lua, then clearing the timer in sp_after_action. Within any action that's calling acConsumePhysicalInput, you would likely leverage the coroutine functions to yield, etc. (just thinking really quickly off the top of my head). Probably use a global variable which the timed thread checks..or something, you get the idea. Though, you may only want to create the coroutine in a specific action so it's not being fired on all actions.

Also, you can use the undocumented action acSetKeyboardHook(0) to disable the keyboard hook. As you can imagine, this disables all monitoring (and thus interception) of keyboard input; S+ won't see any keyboard messages at all...and will not be able to consume any keyboard activity, allowing you to at least kill the process or something else using the keyboard. Note that it doesn't prevent S+ from sending keystrokes. You could even make a hotkey in S+ that simply calls acConsumePhysicalInput(0) to theoretically regain mouse control (in conjuction with disabling the keyboard hook) while testing out potentially risky scripts.

Note that hotkeys are registered within Windows and delivered via a message posted to S+, so hotkeys would still work. I call that action at the top of Global Lua when I'm testing things that may cause S+ to crash or potentially become unresponsive. You have to restart S+ for the keyboard to be hooked again (after commenting the line out of Global Lua, of course, if you put it there!).

It might make sense for me to add an extra option like acConsumePhysicalInput(2) to only consume the mouse as 90% of the time that's all people want to stop so mouse movement doesn't mess up an action or something.
Go to Top of Page

XilE

10 Posts

Posted - 09/16/2013 :  09:26:58  Show Profile
Thanks! and no worries I can figure it out now just needed a pointer in the direction. :) I'll post my results once I finish xD

Actually the acSetKeyboardHook() worked perfect :)

Edited by - XilE on 09/16/2013 10:07:24
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
StrokesPlus Forum © 2011-2018 Rob Yapchanyk Go To Top Of Page
Snitz Forums 2000