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: Newbie

Reputation:

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

Thanks: 2 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: Newbie

Reputation:

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

Was thanked: 4 time(s) in 4 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);
}
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: 73
United States

Thanks: 4 times
Was thanked: 12 time(s) in 7 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: Newbie

Reputation:

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

Thanks: 2 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: 73
United States

Thanks: 4 times
Was thanked: 12 time(s) in 7 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: Newbie

Reputation:

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

Thanks: 2 times
This time it has become much easier to use, thank you again for your selfless sharing, Rob
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.