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
 CTRL+Wheel up impossible with LUA?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

beholder

59 Posts

Posted - 08/14/2012 :  21:31:35  Show Profile  Reply with Quote
Not sure if this can be classified as a bug. I might be really stupid but I could not find the way how to set up Ctrl+Wheel up keypress action as a result of continuous wheel-up gesture (=hold mod key, keep holding and wheel up up up). Just imagine it like you want to make a browser page scaled up like with ctrl+wheel up (but using mouse).



But how do you like "make a gesture"?



Rob

USA
2538 Posts

Posted - 08/14/2012 :  22:01:53  Show Profile  Visit Rob's Homepage  Reply with Quote
Sure you can, but you're most definitely not stupid =)

Here's what I have for Chrome; note that the Fire Recognition on Mouse Wheel Scroll would need to be checked to emulate my action pair:

Action: Zoom In
Gesture: (none)
Modifiers: Scroll Up
Lua:
local WM_MOUSEWHEEL = 0x20A
local WHEEL_POS = 0x00780000 --standard 120 tick of a mouse wheel scroll up, pre-left-shifted for simplifying usage below
local WHEEL_NEG = 0xff880000 --standard -120 tick of a mouse wheel scroll down, pre-left-shifted for simplifying usage below
local MK_CONTROL = 0x08

--Control + Scroll Up
acPostMessage(acGetWindowByPoint(gsx, gsy), WM_MOUSEWHEEL, WHEEL_POS+MK_CONTROL, bit32.lshift(gsy,16)+gsx)



Action: Zoom Out
Gesture: (none)
Modifiers: Scroll Down
Lua:
local WM_MOUSEWHEEL = 0x20A
local WHEEL_POS = 0x00780000 --standard 120 tick of a mouse wheel scroll up, pre-left-shifted for simplifying usage below
local WHEEL_NEG = 0xff880000 --standard -120 tick of a mouse wheel scroll down, pre-left-shifted for simplifying usage below
local MK_CONTROL = 0x08

--Control + Scroll Down
acPostMessage(acGetWindowByPoint(gsx, gsy), WM_MOUSEWHEEL, WHEEL_NEG+MK_CONTROL, bit32.lshift(gsy,16)+gsx)


All I do is hold down the right-mouse button (my stroke button) and scroll the mouse wheel up or down to zoom in/out.

That what you're looking for?
Go to Top of Page

Rob

USA
2538 Posts

Posted - 08/14/2012 :  22:03:15  Show Profile  Visit Rob's Homepage  Reply with Quote
I'm sure you've seen this post, right:

http://www.strokesplus.com/forum/topic.asp?whichpage=1&TOPIC_ID=416
Go to Top of Page

Rob

USA
2538 Posts

Posted - 08/14/2012 :  22:05:20  Show Profile  Visit Rob's Homepage  Reply with Quote
Of course, you could easily select the same gesture for both of my actions above, then draw the gesture, when the gesture is complete (keep holding down the stroke button) and scroll the mouse wheel (there's no timeout when the scroll up/down modifiers are used and the Fire Recognition on Mouse Wheel Scroll preference is checked).
Go to Top of Page

beholder

59 Posts

Posted - 09/02/2012 :  07:02:10  Show Profile  Reply with Quote
Hey Rob,

Hmm... the instruction here was pretty straightforward but still the thing doesn't work when I try this in Opera. I'm surprised myself. In LibreOffice it works perfectly.

In Opera I have used a workaround until now, it sends ctrl- and ctrl+ on the respective wheel gestures (CORRECTION: it sends + and - keystrokes, not ctrl+ and ctrl-). The keystrokes are then caught by AHK which does the ctrl+wheeup/wheeldown kestroke for me. But this is retarded because it doesn't work in inputs and textareas on a page, it inputs + and - characters.


Edited by - beholder on 09/02/2012 07:09:04
Go to Top of Page

beholder

59 Posts

Posted - 09/02/2012 :  07:31:22  Show Profile  Reply with Quote
aah, I finally made it work in Opera because the browser can actually use the CTRL+ and CTRL- keystrokes to zoom the page.
So I have global actions on the wheelUp/wheelDown gestures with the default scripts you wrote above. And then I have app-specific scripts for Opera sending acSendKeys("{DELAY=50}^{ADD}") or acSendKeys("{DELAY=50}^{SUBTRACT}") to the browser.

What you wrote above doesn't work in firefox either, so I guess I'd have to create a new App in S+ actions, then create the gestures and then add sending of the same keystrokes as in Opera -- and then it would work. I will not bother, since I am not using FF that often.

Interesting thing though that your scripts work from Chrome and not for Opera or FF.
Go to Top of Page

Rob

USA
2538 Posts

Posted - 09/02/2012 :  09:31:28  Show Profile  Visit Rob's Homepage  Reply with Quote
Hmm, odd indeed. But, every app maker is free to decide how to handle input as they wish. I'm just glad you got it working =)
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