Author |
Topic |
|
Doktrjones
7 Posts |
Posted - 05/05/2013 : 12:33:27
|
Hi, many thanks for this amazing software! I wanted a way to use windows 8 gestures with a regular mouse on my desktop pc. S+ is exactly what I need!
I would like to be able to use the windows 8 charm bar in the same way as a touch device: on swipe left the charm bar appears and while still holding the mouse down, move up or down to select search, share, start, etc. Instead of moving mouse up or down using the scroll wheel could also be an option.
So far the gestures I have are:
-Taskbar(right then left): acSendWinDown() acSendKeys("^{TAB}") acSendWinUp()
-Switch App(right): acSendWinDown() acSendKeys("+{TAB}+{TAB}") acSendWinUp()
-App Bar(down): acSendKeys("@z")
-Charm Bar(left): acSendKeys("@c") |
Edited by - Doktrjones on 05/05/2013 12:35:55 |
|
Rob
USA
2615 Posts |
Posted - 05/05/2013 : 12:56:29
|
Well, you can get really close to what you're looking for, however, part of the action definition to show the charm bar would require a scroll up and scroll down action pair (since you also need to scroll up and down to select). Meaning, you would swipe left, and while holding the mouse, scroll up or down; the first tick up or down would open the charm bar (but not actually move the selected charm up or down). Then while you're still holding the mouse, scrolling up or down will just send the up/down arrow key. When you release the mouse, Enter will be sent.
First of all, make sure you have the following options selected in Preferences:
- Allow After Release Script* - Enable Mouse Wheel Relay*
Then make 2 actions, both using the Left gesture, one has Scroll Up selected as the modifier, the other has Scroll Down.
In the Global Lua tab, put the following code:bCharmsShown = 0 -- Initializes this to state that the Charms bar isn't open (only an internal state for S+)
function sp_after_release()
--Only do the stuff below if the charms bar was invoked by the action pair
if bCharmsShown == 1 then
--send the Enter key when the mouse is released
acSendKeys("~")
--reset the charms bar open status to 0 so the next left swipe/scroll sends WIN+C
bCharmsShown = 0
end
end In the Left+Scroll Up action:if bCharmsShown == 0 then
--the charms bar hasn't been invoked, this is the first event, send WIN+C
acSendKeys("@c")
--tell S+ that we've now opened the charms bar
bCharmsShown = 1
else
--charms bar already opened by S+, send the UP arrow
acSendKeys("{UP}")
end In the Left+Scroll Down action:if bCharmsShown == 0 then
--the charms bar hasn't been invoked, this is the first event, send WIN+C
acSendKeys("@c")
--tell S+ that we've now opened the charms bar
bCharmsShown = 1
else
--charms bar already opened by S+, send the UP arrow
acSendKeys("{DOWN}")
end |
|
|
Rob
USA
2615 Posts |
Posted - 05/05/2013 : 12:59:13
|
Though I've noticed if you scroll too fast, it can be unstable. S+ just crashed, actually. Make sure the each up/down tick are processed before scrolling again. Sounds worse than it actually is. I'll see if I can figure out the problem, but just don't get scroll happy in this action pair for the time being. |
|
|
Rob
USA
2615 Posts |
Posted - 05/05/2013 : 13:02:00
|
Also note that there's no way to abort the charms sequence in the action pair as whenever you release the mouse, Enter will be sent. |
|
|
Doktrjones
7 Posts |
Posted - 05/05/2013 : 14:01:11
|
Thanks for the quick reply! The script isn't function entirely correct though. Scrolling once works fine to select start but after that I can't just move one up or down, it keeps scrolling for a short while...
|
|
|
Doktrjones
7 Posts |
Posted - 05/05/2013 : 14:26:09
|
Is there a way to reposition the mouse? That way I could open the charm bar and on release position the mouse at the far right of the screen. |
|
|
Doktrjones
7 Posts |
Posted - 05/05/2013 : 15:58:59
|
I Changed the code a little bit. Now when you swipe+scroll the mouse is hidden and positioned on the charm bar. Now you can select an item by moving the mouse up/down. On release the mouse is shown and placed back.
Is it possible to only allow the mouse to move inside the charm bar? And is there any way to recognise a gesture without releasing the mouse or using the scroll button?
Global Lua:
bCharmsShown = 0 -- Initializes this to state that the Charms bar isn't open (only an internal state for S+)
iMouseX = 0 -- Variable to save original mouse coordinate
function sp_after_release()
--Only do the stuff below if the charms bar was invoked by the action pair
if bCharmsShown == 1 then
--send the Enter key when the mouse is released
acSendKeys("~")
--reset the charms bar open status to 0 so the next left swipe/scroll sends WIN+C
bCharmsShown = 0
--move the mouse back to original X coordinate
acMouseMove(iMouseX, acGetMouseLocationY())
--make the mouse visible again
acShowMouseCursor()
end
end
Left+ scrollBar:
if bCharmsShown == 0 then
--save current mouse x coordinate
iMouseX = acGetMouseLocationX()
--move the mouse to start location in taskbar (would be better if done programatically)
acMouseMove(1600, 450)
--hide the cursor
acHideMouseCursor()
--the charms bar hasn't been invoked, this is the first event, send WIN+C
acSendKeys("@c")
--tell S+ that we've now opened the charms bar
bCharmsShown = 1
end
|
|
|
Rob
USA
2615 Posts |
Posted - 05/05/2013 : 16:03:39
|
Is it possible to only allow the mouse to move inside the charm bar?
There's probably a way, but nothing simple or built into S+
And is there any way to recognise a gesture without releasing the mouse or using the scroll button?
Nope, stroke button release and scroll up/down are the only ways to initiate an action. If you think about it outside of the context of your particular intent, it doesn't make sense and would negatively affect other S+ operations. |
|
|
Doktrjones
7 Posts |
Posted - 05/05/2013 : 16:08:13
|
Okay, thanks for the help:) |
|
|
Rob
USA
2615 Posts |
Posted - 05/05/2013 : 16:09:01
|
You're welcome |
|
|
Doktrjones
7 Posts |
Posted - 05/07/2013 : 12:03:08
|
Hi, I want to add a little optimization; When opening the charms bar, the default selected item is usually the start charm and I made the mouse move there automatically. In the start screen however the default selected charm is search, but the mouse still moves over start.
How should I check wether the current screen is the startscreen or not so that I can set the mouse correctly? (I already found out in another post that the start screen is called "ImmersiveLauncher" but Im not sure how to use this)
Also how would I get the height and width of the monitor so that I can position the mouse without having to set the values myself?
the current code: Left+scroll:
if bCharmsShown == 0 then
--save current mouse coordinates
iMouseX = acGetMouseLocationX()
iMouseY = acGetMouseLocationY()
--move the mouse to start location in charm bar (would be better if done programatically)
acMouseMove(1680, 525)
--hide the cursor
acHideMouseCursor()
--the charms bar hasn't been invoked, this is the first event, send WIN+C
acSendKeys("@c")
--tell S+ that we've now opened the charms bar
bCharmsShown = 1
end
Global Lua:
bCharmsShown = 0 -- Initializes this to state that the Charms bar isn't open (only an internal state for S+)
bTasksShown = 0 -- Initializes this to state that the Task Bar isn't open (only an internal state for S+)
iMouseX = 0 -- Variable to save original mouse coordinate
iMouseY = 0 -- Variable to save original mouse coordinate
function sp_after_release()
--Only do the stuff below if the charms bar was invoked by the action pair
if bCharmsShown == 1 then
--send the Enter key when the mouse is released
acSendKeys("~")
--reset the charms bar open status to 0 so the next left swipe/scroll sends WIN+C
bCharmsShown = 0
--move the mouse back to original coordinates
acMouseMove(iMouseX, iMouseY)
--make the mouse visible again
acShowMouseCursor()
end
end
|
|
|
Rob
USA
2615 Posts |
Posted - 05/07/2013 : 13:01:48
|
On lunch break, so no verbose text to accompany the code below
if acGetForegroundWindow() == acFindWindow("ImmersiveLauncher") then
--The foreground window is the Windows 8 Start screen
end
--gets the monitor handle from where the gesture began
local hMonitorHandle = acGetMonitorFromPoint(gsx, gsy)
--The second parameter (1) says to only get the working area, so exclude any docked bars (Taskbar, etc)
--change to 0 (for all calls below) to get the full (actual) size of the screen
local iWidth = acGetMonitorRight(hMonitorHandle, 1)-acGetMonitorLeft(hMonitorHandle, 1)
local iHeight = acGetMonitorBottom(hMonitorHandle, 1)-acGetMonitorTop(hMonitorHandle, 1)
acMessageBox("Screen Working Width: "..iWidth.."\nScreen Working Height: "..iHeight) |
|
|
Doktrjones
7 Posts |
Posted - 05/07/2013 : 17:06:52
|
Okay great, almost got it. I also need to check if the SearchPane or Shell_CharmWindow is opened on top of either -the start screen (search charm is selected) -or otherwise(start charm is selected) |
|
|
|
Topic |
|
|
|