StrokesPlus Forum
                       
StrokesPlus Forum
Home | Profile | Register | Active Topics
Members | Search | FAQ
 All Forums
 General Discussion
 General Discussion
 Waiting for mouse action

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
JoseConseco Posted - 01/29/2017 : 05:41:20
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).
4   L A T E S T    R E P L I E S    (Newest First)
JoseConseco Posted - 01/29/2017 : 16:10:16
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.
Rob Posted - 01/29/2017 : 16:00:42
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?
JoseConseco Posted - 01/29/2017 : 15:56:45
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.
Rob Posted - 01/29/2017 : 10:45:22
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!

StrokesPlus Forum © 2011-2017 Rob Yapchanyk Go To Top Of Page
Snitz Forums 2000