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

Notification

Icon
Error

Options
Go to last post Go to first unread
zyxi  
#1 Posted : Friday, June 7, 2019 5:27:47 PM(UTC)
zyxi

Rank: Advanced Member

Reputation:

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

Thanks: 8 times
Was thanked: 1 time(s) in 1 post(s)
Hi, I meet you again.
Now, I have a problem and need your help. The code I use in Google Browser is as follows.
It executed the Close Label when I did not press Ctr, but when I used it the second time, it executed the Close Browser without pressing Ctrl.
Please help me to find out why.
Confused Confused


if (sp.GetKeyState(vk.CONTROL)){
sp.SendKeys("%{F4}")
}else{sp.SendKeys("^w")}
Rob  
#2 Posted : Friday, June 7, 2019 6:16:29 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,359
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 419 time(s) in 356 post(s)
What is the action bound to? Is this an action where Control is a modifier?

You should be using this, though, either way:
Code:
if(sp.GetKeyState(vk.LCONTROL) & 0x8000) {
    //Control down
}

There might be a timing issue if control is also being used in the action.
Rob  
#3 Posted : Friday, June 7, 2019 6:17:22 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,359
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 419 time(s) in 356 post(s)
That would be for the left control button, you might use CONTROL or RCONTROL, depending on your keyboard layout and usage.
zyxi  
#4 Posted : Saturday, June 8, 2019 12:32:52 AM(UTC)
zyxi

Rank: Advanced Member

Reputation:

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

Thanks: 8 times
Was thanked: 1 time(s) in 1 post(s)
Yeah. When I press Ctrl on the keyboard, the above problem is not there, but no function has been implemented.
I think it is not just a matter of time. It does not achieve the same effect as executing Ctrl modifier keys.
Or is it that this script can't achieve that effect at all?

Edited by user Saturday, June 8, 2019 12:40:22 AM(UTC)  | Reason: Not specified

Rob  
#5 Posted : Saturday, June 8, 2019 1:10:05 AM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,359
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 419 time(s) in 356 post(s)
I think we are having a bit of a language/translation barrier. Can you describe is very fine detail how the action is configured, the exact steps and sequences, and the results in the different scenarios?
zyxi  
#6 Posted : Saturday, June 8, 2019 1:42:52 AM(UTC)
zyxi

Rank: Advanced Member

Reputation:

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

Thanks: 8 times
Was thanked: 1 time(s) in 1 post(s)
I'm sorry for my poor English.
I want to complete the gesture of closing the browser when I press the Ctrl key, and closing Tab without pressing the Ctrl key.

UserPostedImage
Rob  
#7 Posted : Saturday, June 8, 2019 1:59:56 AM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,359
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 419 time(s) in 356 post(s)
Honestly, you should just make another action with Control and Left as modifiers, so each action does the intended script.

Not to say you have to do this, but I think it would be much simpler BigGrin
zyxi  
#8 Posted : Saturday, June 8, 2019 2:49:47 AM(UTC)
zyxi

Rank: Advanced Member

Reputation:

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

Thanks: 8 times
Was thanked: 1 time(s) in 1 post(s)
Maybe you are right. Thank you, Rob
Users browsing this topic
Guest
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.