StrokesPlus.net
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
2014218866  
#1 Posted : Monday, May 13, 2019 6:58:18 AM(UTC)
2014218866

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 5/6/2019(UTC)
Posts: 41
China

Thanks: 7 times
I'm glad to meet you here.
Everyone knows that "ALT + TAB" is a fast way to switch the currently open window.
But, how to switch different windows by rolling wheel, then open the selected window after loosening. Can you help me? Thank you.
Yuichi  
#2 Posted : Monday, May 13, 2019 10:41:38 AM(UTC)
Yuichi

Rank: Member

Reputation:

Groups: Approved
Joined: 9/13/2018(UTC)
Posts: 29
Poland

Thanks: 7 times
Was thanked: 9 time(s) in 8 post(s)
Maybe this will help you (i use Win key from my old script)

As gesture:
Code:
if (!sp.GetStoredBool("Window_selection")) {
    sp.SendVKeyDown(vk.RWIN); // vk.LMENU (ALT)
    sp.SendVKey(vk.TAB);
    sp.StoreBool("Window_selection", true);
}


this to Left Mouse Button:
Code:
if (sp.GetStoredBool("Window_selection") && !click.Down) {
    sp.SendVKeyUp(vk.RWIN);
    sp.StoreBool("Window_selection", false);
}
thanks 1 user thanked Yuichi for this useful post.
zyxi on 6/1/2019(UTC)
Rob  
#3 Posted : Monday, May 13, 2019 11:10:21 AM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 261
United States

Thanks: 5 times
Was thanked: 53 time(s) in 45 post(s)
Okay, this is a complicated setup, but it can be done. I also have not done a lot of testing, so it might have problems.
When it is all setup, you would hold down the stroke button and scroll the mouse wheel up or down, release to reset things for the next time.



First, Ensure This Option is Enabled:

First Ensure This Option is Enabled



Next, enable your load script and put this script line:
Code:
var allWindowsList;


Load Action



Next, enable your Release script and put this script line:
Code:
sp.DeleteTimer("clearLastWindow");


Release script



Now, create your actions:



Scroll Up (starts from bottom of windows and moves up)
Code:
//Get the last window index used by these scripts
var lastWindowIndex = sp.GetStoredNumber("lastWindowIndex"); 

//If there is none, if the window list is empty, or if we're at the top of the 
//stack then reset everything
if(lastWindowIndex == 0 || !allWindowsList) {
    allWindowsList = sp.AllApplications();
    //Set the window index to be the last window in the stack 
    //Note this is technically out of bounds, but the decrement below
    //will bring it back to the last item
    lastWindowIndex = allWindowsList.Length ;
}
if(allWindowsList && allWindowsList.Length > 0) {
    //Decrement the window list to get the previous window
    lastWindowIndex--;
    //Activate the window
    allWindowsList[lastWindowIndex].Activate();
    //store the last window so the scripts know where we are in the stack
    sp.StoreNumber("lastWindowIndex", lastWindowIndex);
    //clear the previous timer, if it exists
    sp.DeleteTimer("clearLastWindow");
    //Create a timer that will reset the window after 2 seconds (2000 milliseconds)
    //This ensures that if you do not scroll the wheel within 2 seconds, it resets
    //the window list and order, this is to prevent getting stuck in certain 
    //situations
    sp.CreateTimer("clearLastWindow", 2000, -1, String.raw`sp.StoreNumber("lastWindowIndex", 0);`);
}


Scroll up script



Scroll down script
Code:
//Get the last window index used by these scripts
var lastWindowIndex = sp.GetStoredNumber("lastWindowIndex"); 

//If there is none, if the window list is empty, or if we're at the top of the 
//stack then reset everything
if(lastWindowIndex == 0 || !allWindowsList) {
    lastWindowIndex = 0;
    allWindowsList = sp.AllApplications();
}
if(allWindowsList && allWindowsList.Length > 0) {
    //Increment the window list to get the previous window
    lastWindowIndex++;
    //If we are at the bottom of the window stack, set to 0
    //so it is back at the top of the window stack
    if(lastWindowIndex > allWindowsList.Length - 1) {
        lastWindowIndex = 0;
    }
    //Activate the window
    allWindowsList[lastWindowIndex].Activate();
    //store the last window so the scripts know where we are in the stack
    sp.StoreNumber("lastWindowIndex", lastWindowIndex);
    //clear the previous timer, if it exists
    sp.DeleteTimer("clearLastWindow");
    //Create a timer that will reset the window after 2 seconds (2000 milliseconds)
    //This ensures that if you do not scroll the wheel within 2 seconds, it resets
    //the window list and order, this is to prevent getting stuck in certain 
    //situations
    sp.CreateTimer("clearLastWindow", 2000, -1, String.raw`sp.StoreNumber("lastWindowIndex", 0);`);
}


(Note: Script in screenshot below doesn't match after edit, use script above)
Scroll down script

Edited by user Wednesday, May 15, 2019 5:59:06 AM(UTC)  | Reason: Updated Scroll Down script

2014218866  
#4 Posted : Wednesday, May 15, 2019 4:32:46 AM(UTC)
2014218866

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 5/6/2019(UTC)
Posts: 41
China

Thanks: 7 times
First of all, thank you very much for your kind response. But there are some problems with the scripts you provide.
This may be the reason for my computer, or other reasons.


For Yuichi' script , my computer has an abnormal phenomenon, such as not being able to copy.

For Rob' script , this gesture shows an error in the Scroll down script. as the picture shows。

down

I still want to implement the software to cycle through the small windows,
and then determine the selected window by releasing the right mouse button.
Although the results are not perfect, thank you very much.


Rob  
#5 Posted : Wednesday, May 15, 2019 5:59:55 AM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 261
United States

Thanks: 5 times
Was thanked: 53 time(s) in 45 post(s)
I edited my post above, updated the Scroll Down script, replace it using the new Scroll Down script and see if it works.
thanks 1 user thanked Rob for this useful post.
2014218866 on 5/16/2019(UTC)
2014218866  
#6 Posted : Thursday, May 16, 2019 3:59:17 AM(UTC)
2014218866

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 5/6/2019(UTC)
Posts: 41
China

Thanks: 7 times
This time it has become much easier to use, thank you again for your selfless sharing, Rob
zyxi  
#7 Posted : Saturday, June 1, 2019 8:43:01 PM(UTC)
zyxi

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 3/30/2019(UTC)
Posts: 49
China

Thanks: 4 times
Was thanked: 1 time(s) in 1 post(s)
Dear Yuichi,

The script you provided is very suitable for me,
but there is a problem when I use the Alt+TAB.
When my mouse is not in the small window range,
clicking the left mouse button will not choose the selected window.

In other words, clicking does not work. Is there any way to solve this problem?


UserPostedImage


I look forward to your reply.

Thank you.
Yuichi  
#8 Posted : Sunday, June 2, 2019 12:32:19 PM(UTC)
Yuichi

Rank: Member

Reputation:

Groups: Approved
Joined: 9/13/2018(UTC)
Posts: 29
Poland

Thanks: 7 times
Was thanked: 9 time(s) in 8 post(s)
Hi
I could do that by getting information which window is in process of selecting and then with that information i can do what i want.
But the problem with the ALT+TAB option is that when the Switch Window is active, it force be at the top and i cannot get that info.
Few days ago i writed code that stick Switch Window to the mouse and move up and down but still needs adjustment because when many windows are running Switch Window can separate windows in more than 1 row.

Second my idea is to parted screen in columns and address the windows to each column, but that in the future.

if you want some of this scripts just tell me.

Edited by user Sunday, June 2, 2019 12:33:56 PM(UTC)  | Reason: Not specified

zyxi  
#9 Posted : Sunday, June 2, 2019 10:26:11 PM(UTC)
zyxi

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 3/30/2019(UTC)
Posts: 49
China

Thanks: 4 times
Was thanked: 1 time(s) in 1 post(s)
Thank you for your reply. At present, my alternative is to move the mouse to the switching window and replace the left mouse button with the wheel click.
It's not a very good alternative. But I'm not very proficient in JavaScript, so I can only expect you to successfully debug this perfect gesture and forgive my rudeness.
Yuichi  
#10 Posted : Monday, June 3, 2019 3:22:13 AM(UTC)
Yuichi

Rank: Member

Reputation:

Groups: Approved
Joined: 9/13/2018(UTC)
Posts: 29
Poland

Thanks: 7 times
Was thanked: 9 time(s) in 8 post(s)
Hi
I try to do that but need a little more time.
zyxi  
#11 Posted : Monday, June 3, 2019 8:49:48 AM(UTC)
zyxi

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 3/30/2019(UTC)
Posts: 49
China

Thanks: 4 times
Was thanked: 1 time(s) in 1 post(s)

No problem. Take your time. I look forward to your success.

Thank you again.
Rob  
#12 Posted : Monday, June 3, 2019 9:51:19 AM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 261
United States

Thanks: 5 times
Was thanked: 53 time(s) in 45 post(s)
Actually, you can do this via a timer in your Global Actions > Load/Unload Scripts > Load Script:

Code:
sp.CreateTimer("ActivateWindow", 0, 200, `if(sp.WindowFromPoint(sp.GetCurrentMousePoint(), true).HWnd != sp.ForegroundWindow().HWnd) {
                                                sp.WindowFromPoint(sp.GetCurrentMousePoint(), true).BringToFront();
                                         }`); 


HOWEVER this script just covers the very basic functionality! Quick testing reveals it would need to be tweaked to better handle certain scenarios.

For example, right click the S+ tray menu and the menu disappears because it's activating the main parent window, etc.

So it would probably need to have some additional logic and checks to function smoothly.

Also, having a script error in this timer function, which executes every 200 milliseconds, can get you stuck in an endless loop of script error popup messages.

If that happens, go to Task Manager and kill StrokesPlus.net.exe. Then hold the Control key and start S+. This will start S+ in Safe Mode which prevents pretty much everything from working. But you can then go into the Load Script tab and correct or comment the code, click OK, then Exit and restart S+ without holding the Control key.
zyxi  
#13 Posted : Monday, June 3, 2019 9:43:34 PM(UTC)
zyxi

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 3/30/2019(UTC)
Posts: 49
China

Thanks: 4 times
Was thanked: 1 time(s) in 1 post(s)
Thank you for your advice, Rob.
Could you consider replacing “sp. Exit ()” with this function (go to Task Manager and kill StrokesPlus.net.exe. Then hold the Control key and start S+. )
or add it to the software as a new feature? because it is often more practical than "sp. Exit ()" when errors occur.
Rob  
#14 Posted : Monday, June 3, 2019 9:45:16 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 261
United States

Thanks: 5 times
Was thanked: 53 time(s) in 45 post(s)
I was just about to delete my comment as I meant to post it to another thread (automatically activating windows), lol.

So I will leave it here.

I'm not following what you're asking. Could you provide more details?

Edited by user Monday, June 3, 2019 9:47:23 PM(UTC)  | Reason: Not specified

zyxi  
#15 Posted : Monday, June 3, 2019 9:59:22 PM(UTC)
zyxi

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 3/30/2019(UTC)
Posts: 49
China

Thanks: 4 times
Was thanked: 1 time(s) in 1 post(s)
Yeah, I mean it's a good feature---go to Task Manager and kill StrokesPlus.net.exe. Then hold the Control key and start S+, compared to “sp. Exit“, when my script goes wrong
Rob  
#16 Posted : Tuesday, June 4, 2019 7:18:12 AM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 261
United States

Thanks: 5 times
Was thanked: 53 time(s) in 45 post(s)
I guess I'm not following you. If there's a script error, there's no guarantee that an sp. function will be able to be executed (e.g. the script engines are locked up, or something).

You can create the code to handle failures gracefully if you want, which would be the recommended method; though it does require a decent level of programming knowledge to do properly.

How are you calling sp.Exit()? Do you have this as another action, or in a hot key?

If the assumption is that you are still able to execute scripts, there's technically no reason you would need to exit S+; though the specific situation would need to be known in regards to the best way to handle each case.

For example, let's say that I have a Load script with a timer that is causing a problem (and I'm still able to execute actions..), this script disables the Load script, saves the settings, then reloads S+:
Code:
sp_config.FireOnLoadAction = false;
sp_config.Save();  //Save() does not currently show in the auto complete list
sp.Reload();

So I just execute that script, say via hot key, and the load script is disabled.

Again, this is a specific example, but there are many ways this can be achieved. I would say that most issues can be handled via proper script logic and checks to prevent failures, or by handling them gracefully when they occur.

If you can provide an example script where this is some error condition which you would have to exit S+ to address, post it here and I can try to give you an example of how to handle it.

Yuichi  
#17 Posted : Thursday, June 6, 2019 6:08:49 AM(UTC)
Yuichi

Rank: Member

Reputation:

Groups: Approved
Joined: 9/13/2018(UTC)
Posts: 29
Poland

Thanks: 7 times
Was thanked: 9 time(s) in 8 post(s)
Hi, Rob can you help if want?

Before start change "s_wTitle". (info in code)
I made few mistakes and i don't have ideas how to solve it.

How it works:
Script run and wait to action.
When you touch left side (not all height) of screen Switch Window will active.
When the cursor is in the Switch Window, the script will start selecting items with the right mouse button, and when the cursor leaves the window, it accepts the selection. (Switch Window will not allow to select item/window by going outside and click on it. I tested it many times.)

Problems:
1) - when the cursor touches the activation field it fires only once, re-entering the field does not activate Switch Window (without "sp.GetCurrentMousePoint().Y >= y_rect" and "sp.GetCurrentMousePoint().Y <= (y_rect*2)" work fine)

2) - line in code"sp.SendVKeyDown(vk.CONTROL); sp.Sleep(20); sp.SendVKeyDown(vk.LMENU); ..." sometimes change working of keyboard (CTRL work as ALT)

3) - when you move mouse fast, it can sometimes click outside the window "if (sp.WindowFromPoint(sp.GetCurrentMousePoint(), true).Title == s_wTitle)"

Even guidance on solving problems would be great :)

PS. I turn off "Aero Peek" in Win7 to get Switch Window on top and I installed program could "Winaero Tweaker" to change size of the window.


Code:
// AUTO ////////////////////////////////////////////////////////////////////////////////////////////
if (sp.GetStoredBool("AutoSwitcher")) { // if "AutoSwitcher" if runing
    sp.StoreBool("AutoSwitcher", false); // send info to the loop to close
    sp.ShowBalloonTip("Auto Switch Windows", "Turn off", "Info", 1000);
} else {
    sp.StoreBool("AutoSwitcher", true); // send info to the loop to start
    sp.ShowBalloonTip("Auto Switch Windows", "Turn on", "Info", 1000);
    var s_wTitle = "Przełączanie zadań"; // name depends on the languane in Windows (somehow ".ClassName" create a problem)
    var b_m_touch = false; // contol if mouse is inside activation area
    var b_m_notTouch = true; // contol if mouse is outside activation area
    var screenRect = Screen.FromPoint(sp.GetCurrentMousePoint()).Bounds; // reusing :)
    var y_rect = Math.floor(screenRect.Height / 3); // the middle part of the 1/3 of the screen
    var x_rect = 1;

    // RUN "AUTOSWITCHER"
    while (sp.GetStoredBool("AutoSwitcher")) { // or instead "while" use "CreateTimer"? (And "b_m_Touch" and "b_m_notTouch" define as "StoredBool"?)

        sp.Sleep(50); // refresh time when switch window is not active

        // ACTIVATION RECT
        // this part activates the switch window (CTRL+ALT+TAB) once, to restart it you have to leave the field and enter again
        //if (!sp.WindowFromClassOrTitle("TaskSwitcherWnd", "")) { // do not work if switch window is running (PART TO FIX!)
            if (b_m_notTouch) {
                if (sp.GetCurrentMousePoint().X <= x_rect &&
                      sp.GetCurrentMousePoint().Y >= y_rect && // (PART TO FIX!)
                      sp.GetCurrentMousePoint().Y <= (y_rect*2)) { // (PART TO FIX!)
                            b_m_touch = true;
                            b_m_notTouch = false;
                }
            } else {
                if (sp.GetCurrentMousePoint().X > x_rect &&
                      sp.GetCurrentMousePoint().Y < y_rect && // (PART TO FIX!)
                      sp.GetCurrentMousePoint().Y > (y_rect*2)) { // (PART TO FIX!)
                            b_m_touch = false;
                            b_m_notTouch = true;
                } else {
                    b_m_touch = false;
                }
            }
        //}

        if (b_m_touch) {
            sp.SendVKeyDown(vk.CONTROL); sp.Sleep(20); sp.SendVKeyDown(vk.LMENU); sp.Sleep(20); sp.SendVKey(vk.TAB); sp.Sleep(20); sp.SendVKeyUp(vk.LMENU); sp.Sleep(20); sp.SendVKeyUp(vk.CONTROL); // when you hit ctrl+alt+tab switching window will be in "stay mode" (PART TO FIX!)
            sp.StoreBool("w_selection", true); // window selection / switcher window
            sp.StoreBool("m_click", false); // mouse click
            var m_oldPos = 0; // mouse old position
            var b_m_InW = false; // mouse in window

            while (!sp.GetStoredBool("m_click")) {
                sp.Sleep(20); // refresh time in switch window

                // EMERGENCY STOP
                if (sp.ForegroundWindow().Title != s_wTitle) { // if switcher somehow disappear
                    sp.StoreBool("w_selection", false);
                    sp.StoreBool("m_click", true);
                    break;
                }

                if (sp.WindowFromPoint(sp.GetCurrentMousePoint(), true).Title == s_wTitle) b_m_InW = true; // cursor is in window
                if (b_m_InW) {
                    if (m_oldPos != sp.GetCurrentMousePoint().ToString()) { // do not allow to click in the same point
                        if (sp.WindowFromPoint(sp.GetCurrentMousePoint(), true).Title == s_wTitle) { // select item (PART TO FIX!)
                            sp.MouseClick(sp.GetCurrentMousePoint(), "Right", false, true); // if switcher is in "stay mode" right click will select item
                            sp.ShowBalloonTip("In window", sp.GetCurrentMousePoint().ToString() + " ", "Info", 100);
                        } else { // if mouse go outside of switch window
                            sp.Sleep(20);
                            sp.SendKeys("~"); // accept selection
                            sp.StoreBool("w_selection", false);
                            sp.StoreBool("m_click", true);
                        }
                    }
                    m_oldPos = sp.GetCurrentMousePoint().ToString(); // remember last mouse position
                }
            } // while 2
        } // b_m_touch "true"
    } // while 1
} // sp.GetStoredBool("AutoSwitcher")



Global Actions > Load/Unload Scripts > Load Script:

Code:
// AUTO SWITCHER
if (sp.GetStoredBool("AutoSwitcher")) { // if "AutoSwitcher" if runing
    sp.StoreBool("AutoSwitcher", false);
    sp.ShowBalloonTip("Auto Switch Windows", "Turn off", "Info", 1000);
}



Mouse button script:

Code:
// ACCEPT WINDOW SELECTION (SWITCH WINDOW)
if (sp.GetStoredBool("w_selection") && !click.Down) {
    sp.StoreBool("w_selection", false);
    sp.StoreBool("m_click", true);
    sp.Sleep(50);
    if (sp.WindowFromPoint(sp.GetCurrentMousePoint(), true).Title == "Przełączanie zadań") {
        sp.SendVKey(vk.PAUSE); // close switch window if you missclick
    }
}
Rob  
#18 Posted : Friday, June 7, 2019 6:43:53 AM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 261
United States

Thanks: 5 times
Was thanked: 53 time(s) in 45 post(s)
I'm still trying to figure out exactly how this is all tied together, you mention selecting with the right button, but there's also a button script.

1)
This logic is faulty:
Code:
if (sp.GetCurrentMousePoint().X > x_rect &&
      sp.GetCurrentMousePoint().Y < y_rect && // (PART TO FIX!)
      sp.GetCurrentMousePoint().Y > (y_rect*2)) { // (PART TO FIX!)
            b_m_touch = false;
            b_m_notTouch = true;
            console.log('check B');
} else {
    b_m_touch = false;
    console.log('check C');
}

It is impossible for the mouse pointer to be both at the top and bottom part of the screen at the same time BigGrin :
Code:
sp.GetCurrentMousePoint().Y < y_rect && sp.GetCurrentMousePoint().Y > (y_rect*2)

You want an OR condition check:
Code:
if (sp.GetCurrentMousePoint().X > x_rect &&
      (
        sp.GetCurrentMousePoint().Y < y_rect 
        ||  //OR 
        sp.GetCurrentMousePoint().Y > (y_rect*2)
      ) //Enclose both of these to form a single condition for the if
) { 
            b_m_touch = false;
            b_m_notTouch = true;
            console.log('check B');
} else {
    b_m_touch = false;
    console.log('check C');
}



2)
If you're not in US keyboard layout, try using the LCONTROL vk instead, but also, why not use this:
Code:
sp.SendModifiedVKeys([vk.LCONTROL,vk.LMENU], [vk.TAB]);



3)
Not sure about that one, again I think I'm not understanding exactly how this is being used, where right-click up event is in play.
I found it was very helpful to enable V8 debugging and log data to the console to see what the values were, like this:
Code:
console.log(`Loop Top - sp.GetCurrentMousePoint().X: ${sp.GetCurrentMousePoint().X} - sp.GetCurrentMousePoint().Y: ${sp.GetCurrentMousePoint().Y} - x_rect: ${x_rect} - y_rect: ${y_rect} - (y_rect*2): ${(y_rect*2)}`);
console.log(`b_m_notTouch: ${b_m_notTouch} - b_m_touch: ${b_m_touch}`);

A few things to keep in mind about this:
  1. Any time you click OK or Apply, the script engines are reloaded. Any Chrome Dev tools window you have open will lose connection to the scripts.
  2. You will need to close the Dev Tools window and refresh this URL, then wait several seconds to show the S+ inspect link again to connect to the newly created script engines: chrome://inspect/#devices
  3. I changed the sleep at the top of the script to 2000 when testing, otherwise the console window fills up with data too fast



Yes, I would recommend this script being in a timer. Take the whole script and put it inside a function in the Load script area, like:
Code:
function TaskSwitcher() {
  //code
}

Then create a timer to call that function. Some things will need to be changed, like you'd need to call delete timer to stop it, etc.
thanks 1 user thanked Rob for this useful post.
Yuichi on 6/10/2019(UTC)
Rob  
#19 Posted : Friday, June 7, 2019 7:04:45 AM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 261
United States

Thanks: 5 times
Was thanked: 53 time(s) in 45 post(s)
Also, it seems that class isn't right, at least not for the latest Windows 10; this seems to work for me:

Code:
sp.WindowFromClassOrTitle('MultitaskingViewFrame','')
thanks 1 user thanked Rob for this useful post.
Yuichi on 6/10/2019(UTC)
Yuichi  
#20 Posted : Monday, June 10, 2019 6:49:17 AM(UTC)
Yuichi

Rank: Member

Reputation:

Groups: Approved
Joined: 9/13/2018(UTC)
Posts: 29
Poland

Thanks: 7 times
Was thanked: 9 time(s) in 8 post(s)
Thank you very Rob for your help, i will follow your advices.
2014218866  
#21 Posted : Wednesday, August 21, 2019 1:40:25 AM(UTC)
2014218866

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 5/6/2019(UTC)
Posts: 41
China

Thanks: 7 times
Quote:
Code:
if (!sp.GetStoredBool("Window_selection")) {
sp.SendVKeyDown(vk.LMENU); // vk.LMENU (ALT)
sp.SendVKey(vk.TAB);
sp.StoreBool("Window_selection", true);
}


this to Left Mouse Button:
Code:
if (sp.GetStoredBool("Window_selection") && !click.Down) {
sp.SendVKeyUp(vk.LMENU);
sp.StoreBool("Window_selection", false);
}


Hello, Rob, I used the Yuichi's script. There is a problem.
When I click on the left key, the ALT key will not be released. When I use the wheel key instead of the left key, the script will work and the ALT key can be released normally.
In addition, when the ALT key is pressed all the time, the ALT will not be released even if S + is killed by me.
Can you help me solve this problem, thank you.

Rob  
#22 Posted : Wednesday, August 21, 2019 8:15:24 AM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 261
United States

Thanks: 5 times
Was thanked: 53 time(s) in 45 post(s)
The original scripts used the WIN key, for Win+Tab, not the ALT key.

As gesture:
Code:
if (!sp.GetStoredBool("Window_selection")) {
    sp.SendVKeyDown(vk.RWIN); // vk.LMENU (ALT)
    sp.SendVKey(vk.TAB);
    sp.StoreBool("Window_selection", true);
}

this to Left Mouse Button:
Code:
if (sp.GetStoredBool("Window_selection") && !click.Down) {
    sp.SendVKeyUp(vk.RWIN);
    sp.StoreBool("Window_selection", false);
}


The context of this script was to show the task switcher and when you click on an item, to select and release the WIN key.
Using the ALT key for Alt+Tab doesn't really make sense for this script pair.

What exactly is it that you're trying to accomplish?
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.