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
 Need help to minimize metro apps completely
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

chandisciple

75 Posts

Posted - 09/10/2015 :  07:18:01  Show Profile
Hey Guys & Rob,

hope you are doing great exploiting S+.

If someone could help me figure out my issue please. When i draw the gesture to minimize the metro app like in "reader" app only the pdf file i was reading minimizes but not the "reader" app itself.

Current config : acMinimizeWindow(nil, gsx, gsy)

Had issues with closing metro apps earlier but fixed it with ROB's update and changed the config as below, so now i can close the metro apps but have issue still with minimizing them,
if acIsImmersiveProcess(acGetOwnerWindowByPoint(gsx,gsy)) == 1 then
acActivateWindow(nil, gsx, gsy)
acSendKeys("%{F_4}")
else
acCloseApplication(nil, gsx, gsy)
end

chandisciple

75 Posts

Posted - 09/28/2015 :  09:06:14  Show Profile
I reinstalled my OS. fixed most of the issues but looks like there is still lot of issues playing with metro apps. The zoom works with the all desktop applications but not with metro app reader. I use it a lot and will be final settlement if i can have this working. Please let me know what i can tweak from below .
local MK_CONTROL = 0x08
local WM_MOUSEWHEEL = 0x20A
local WHEEL_POS = 0x00780000
local WHEEL_NEG = 0xff880000

--local handle = acGetOwnerWindowByPoint(gsx, gsy)
acDelay(5)
acSendControlDown()
acDelay(5)
acPostMessage(acGetWindowByPoint(gsx, gsy), WM_MOUSEWHEEL, WHEEL_POS+MK_CONTROL, bit32.lshift(gsy,16)+gsx)
acDelay(5)
acSendControlUp()
Go to Top of Page

chandisciple

75 Posts

Posted - 09/29/2015 :  04:22:39  Show Profile
Rob,

Looks like its your turn now. May i please have your attention on this ? :)
Go to Top of Page

Rob

USA
2615 Posts

Posted - 09/29/2015 :  08:43:35  Show Profile  Visit Rob's Homepage
The problem is that metro apps process/capture input differently, they also aren't aware of many messages being posted to them; they're not really Win32 programs (intentionally). They only way I can think of is sending keys to the window, like CTRL+:

acSendControlDown()
acDelay(20)
acSendKeys("{PLUS}")
acDelay(20)
acSendControlUp()
Go to Top of Page

chandisciple

75 Posts

Posted - 09/29/2015 :  12:26:12  Show Profile
Kickass !!!

It may be simple for you or may be time consuming for you . when you give such fix feels to hug you sire ! it worked flawless . MY S+ is now complete !

Just for knowledge base can you please take time and explain in detail why delay() makes most most things work ? I read in some post that the system is not powerful enough to grasp it but it doesnt work in most powerful desktop i have too . Why does adding delay makes many many scripts work all of a sudden ?

A detailed explanation should keep me from asking you such silly questions again. You are a rockstar. If only we make Microsoft aware of this app you should be real famous sire.

i am pasting my script below for others if they would want it easy ,
if acIsImmersiveProcess(acGetOwnerWindowByPoint(gsx,gsy)) == 1 then
acActivateWindow(nil, gsx, gsy)
acSendControlDown()
acDelay(20)
acSendKeys("{PLUS}")
acDelay(20)
acSendControlUp()
else
acDelay(50)
acSendControlDown()
acDelay(50)
acPostMessage(acGetWindowByPoint(gsx, gsy), WM_MOUSEWHEEL, WHEEL_POS+MK_CONTROL, bit32.lshift(gsy,16)+gsx)
acDelay(50)
acSendControlUp()
end
Go to Top of Page

chandisciple

75 Posts

Posted - 09/29/2015 :  12:41:53  Show Profile
oh oh ! one small thing that is not settled with this script. The zoom in/out does not happen where actually the cursor is but happens generallay at the center of the page.

to explain it , i am using it in reader (pdf) without s+ the zoom happens where the cursor is currently situated but with s+ zoom happens at the center of the screen all the time . Can you please spray your magic on the above script to make it zoom where the cuurent location of the mouse is ?
Go to Top of Page

Rob

USA
2615 Posts

Posted - 09/29/2015 :  12:54:53  Show Profile  Visit Rob's Homepage
That's the problem you have with the original script, though. Since the metro app doesn't process posted mouse wheel messages, there's no way to tell it the location of the mouse. Sending CTRL+ doesn't have a location as it's just a keyboard action. I'm honestly not sure if you will be able to accomplish precisely what you're looking for since metro apps don't process mouse wheel messages.
Go to Top of Page

chandisciple

75 Posts

Posted - 09/30/2015 :  04:25:17  Show Profile
oh ok .

1) I am using the below script for now which works most of the time properly. Do you think this is the best we could get with ?

if acIsImmersiveProcess(acGetOwnerWindowByPoint(gsx,gsy)) == 1 then
acActivateWindow(nil, gsx, gsy)
acSendKeys("% n")
acSendKeys("n")
else
acMinimizeWindow(nil, gsx, gsy)
end


2) Also can you please reveal why time delay makes most script work ?
Go to Top of Page

Rob

USA
2615 Posts

Posted - 09/30/2015 :  08:51:30  Show Profile  Visit Rob's Homepage
1)
Which metro app(s) are you having issues with not being minimized? Mind you, I don't use many, but the ones I use are always minimized fine using acMinimizeWindow(nil,gsx, gsy)

2)
It has to do with timing and the way a program is internally written. In the real world (you at the keyboard), it's pretty much impossible for you to press and hold the CTRL key and then press another key in 1 millisecond. In reality, there's at least going to be 50ms from the time you press the CTRL key until you are able to press the other key, then another 50ms until you are able to release the CTRL key.

The next part of the problem has to do with exactly how the target program's message loop is constructed. In a perfect world, when it detects the CTRL key, it would store some flag to indicate the CTRL is being pressed so a subsequent keystroke is recognized as CTRL+(something); but it's not a requirement, an app is free to behave however the developers make it. So, imagine a message loop where the program turns on some kind of flag when the CTRL key is pressed down, then when it sees another keystroke it noticed the control key is being held down and then decides how to process that key combination. In that instance, acSendKeys("^t") would work fine as the CTRL key down is sent first immediately followed by "T". However, if the program calls getkeystate() to see if CTRL is held down AFTER receiving "T", S+ send CTRL+T together instantaneously, too fast for it to check if the CTRL key is down because it's already been released. There are other ways the app's code could be written where it gets a keystroke, then checks the control key; let's say this processing takes 2ms, but since the keystroke was sent in together and immediately released, the app wouldn't recognize the control key.

Ideal program:
keystroke_message received
(first key received is CTRL, second key is "T")
If keystroke_message = CTRL Then
   set flag that CTRL is being pressed --first pass
Else If keystroke_message is "T" Then
   If CTRL flag is set Then
      execute as a key combination CTRL+T
   Else
      process letter "T"
Else
   process the letter pressed

Less than ideal program:
keystroke_message received
If call to getkeystate() reports that the CTRL key is currently being pressed Then
   execute as a key combination CTRL+T
Else
   process the letter "T"
In the case of the less than ideal program, the message sent by acSendKeys would happen so fast that by the time it checked to see if the CTRL was being pressed, it would no longer be. Where the ideal program immediately stores that the CTRL is in the pressed position so the "T" is immediately recognized as a CTRL+T.

Basically, you have to think about it in terms of the real world. Sometimes programs are written and tested against actual people pressing keys, which is nowhere near as lightning-fast as a program (like S+) can send them. In a perfect world, people would write programs perfectly, but many times something like this just is never considered.


Go to Top of Page

chandisciple

75 Posts

Posted - 09/30/2015 :  11:37:01  Show Profile
1) I am actually the defualt apps. like Alarm and Reader mostly. On both the apps with just acMinimizeWindow(nil,gsx, gsy) (assigned to /Down Keystroke) when i draw the gesture the actual front page ( pdf file in READER app, alarm display in ALARM app) gets minimized revealing background of the app (which is blank) . Now when i draw the same gesture again it actually minimizes the app. BUT when i open the minimized app , only the background of the app is visible and the pdf cannot be brought back up on the app its minimized like permanently. All i can do is to drag the app all the way to bottom to completely crash delete the app and then i can open pdf .

in a nutshell, i have to draw gesture twice to minimize the metro app though the app actually fails badly having to restart freshly.

2) Thanks and perfect! I guess it deserves to be on our new "guides" section.
Go to Top of Page

Rob

USA
2615 Posts

Posted - 09/30/2015 :  11:39:08  Show Profile  Visit Rob's Homepage
1) Do you have anything in your Global under sp_before_action or anywhere else that is doing something for all windows? For example, calling acActivateWindow or anything?

2) Yea, I was thinking the same thing... (just added to Guides)
Go to Top of Page

Rob

USA
2615 Posts

Posted - 09/30/2015 :  11:57:08  Show Profile  Visit Rob's Homepage
For example, if I open Reader, the standard acMinimizeWindow(nil,gsx, gsy) works as I'd expect; minimizes the whole window.
Go to Top of Page

chandisciple

75 Posts

Posted - 10/05/2015 :  11:03:02  Show Profile
no there is nothing under global, Giving you a complete copy of it

--Enter any Lua script that you'd like always executed when StrokesPlus loads,
--or when you click Reload Config and Lua Engine.
function sp_init()
-- code in this function is fired once when the Lua engine is reloaded
-- which occurs when S+ is started, Ok/Apply is clicked in the settings window
-- or when Reload Config and Lua Engine is clicked from the tray menu
end
function sp_before_action(gnm, gsx, gsy, gex, gey, gwd, gapp, gact, gbl, gbt, gbr, gbb)
-- this code is fired before each action (excluding hotkey actions)
end
function sp_after_action(gnm, gsx, gsy, gex, gey, gwd, gapp, gact, gbl, gbt, gbr, gbb)
-- this code is executed after each action (excluding hotkey actions)
-- this function is not enabled by default, you must check the following setting
-- in the Preferences tab: Allow After Action Script*
end

function sp_right_mouse_up()
-- this code is executed whenever you press the right mouse button down
-- this function is not enabled by default, you must check the following setting
-- in the Preferences tab: Allow Right Click Script*
end

function sp_middle_mouse_up()
-- this code is executed whenever you press the middle mouse button down
-- this function is not enabled by default, you must check the following setting
-- in the Preferences tab: Allow Middle Click Script*
end

function sp_left_mouse_up()
-- this code is executed whenever you press the left mouse button down
-- this function is not enabled by default, you must check the following setting
-- in the Preferences tab: Allow Left Click Script*
end

function sp_x1_mouse_up()
-- this code is executed whenever you press the X1 mouse button down
-- this function is not enabled by default, you must check the following setting
-- in the Preferences tab: Allow X1 Click Script*
end

function sp_x2_mouse_up()
-- this code is executed whenever you press the X2 mouse button down
-- this function is not enabled by default, you must check the following setting
-- in the Preferences tab: Allow X2 Click Script*
end

function sp_after_release()
-- this code is executed whenever you release the stroke button
-- this function is not enabled by default, you must check the following setting
-- in the Preferences tab: Allow After Release Script*
end

Go to Top of Page

Rob

USA
2615 Posts

Posted - 10/05/2015 :  20:51:17  Show Profile  Visit Rob's Homepage
That's very odd... If I could reproduce it, I could probably help; but it works without issue for me :-/
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