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
 Waiting for mouse action
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

JoseConseco

3 Posts

Posted - 01/29/2017 :  05:41:20  Show Profile
Great app, I just donated. Anyway I want action to do something like this:
sendCtrlKeyDown()
while RMB is not UP do
delay(100)
end
sendCtrlKeyUp()

How do I detect that user released RMB (or in general how I detect that user did some mouse action), so that My S+ action can release ctrl key?
I could do this easily with EasyStroke on linux with 'Ignore' action type.
https://github.com/thjaeger/easystroke/wiki/Documentation#ignore
This basically helps you emulate pressing eg. ctrl, alt, shift and wait for mouse action. After that action send 'release key' event (ctrlUp, altUp etc).

Rob

USA
2615 Posts

Posted - 01/29/2017 :  10:45:22  Show Profile  Visit Rob's Homepage
You could probably leverage sp_right_mouse_up to handle this if you explicitly want right button, or sp_after_release to fire on release of whatever the stroke button is assigned to. Scroll down a little from here in the Help page: http://www.strokesplus.com/help/#GlobalLua

Note that you'll need to check the appropriate setting in Preferences to enable those scripts to fire.

Keep in mind that S+ has 2 Lua engines, so it would be best to use the acSetNumberVariable (set to 1, for example) function to set a value in S+ memory when you start the action, and acGetNumberVariable in the ending function, to check to see if the CTRL UP should be sent (then set value to 0). Since the GLobal Lua script could fire in either Lua engine, you want to use this internal variable to be sure the variable can be accessed by either engine; and you want to set something because the release script is going to fire every time, so you don't want it sending CTRL UP except when the starting script sets the flag.

So it wouldn't really be in a wait loop, your action sends the CTRL down, then whenever the release happens, it fires that script to check to see if CTRL UP should be sent (by looking at the internal variable).

Hope this helps/works for you!
Go to Top of Page

JoseConseco

3 Posts

Posted - 01/29/2017 :  15:56:45  Show Profile
Thanks, the ctrlDown is sent ok, but the ctrlUp - I can't get it to work.
My action:
acSendControlDown()
acSetNumberVariable("ctrlDown",0)

My Global:
ctrlDown = 0
function sp_left_mouse_up()
ctrlState = acGetNumberVariable("ctrlDown")
if ctrlState == 1 then
acSendControlUp()
acSetNumberVariable("ctrlDown",0)
end

end


I'm not familiar with LUA but it seems the easiest script to do, and it won't react to left mouse up evet. I have enabled: allow left click script, allow after action script, allow after release script...

edit: actually firing simple one line
acSendControlUp()
in global sp_left_mouse_up() dosen't seem to work, but I have ' Allow Left Click Script*' enabled.

Edited by - JoseConseco on 01/29/2017 16:03:17
Go to Top of Page

Rob

USA
2615 Posts

Posted - 01/29/2017 :  16:00:42  Show Profile  Visit Rob's Homepage
In your action, it looks like you're setting the variable to 0? But then checking for it to be 1 in the global. Or is that a typo?
Go to Top of Page

JoseConseco

3 Posts

Posted - 01/29/2017 :  16:10:16  Show Profile
Ah yes, my bad. But also I had to disable in S+ preferences ->'ignore key' ctrl key - I set it to none and it works great!. My action was pressing ctrl key - which disables S+ so that was also the problem.

Edited by - JoseConseco on 01/29/2017 16:14:03
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