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 11:27:47 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)
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 12:16:29 PM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 5 times
Was thanked: 134 time(s) in 120 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 12:17:22 PM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 5 times
Was thanked: 134 time(s) in 120 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 : Friday, June 7, 2019 6:32:52 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. 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 Friday, June 7, 2019 6:40:22 PM(UTC)  | Reason: Not specified

Rob  
#5 Posted : Friday, June 7, 2019 7:10:05 PM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 5 times
Was thanked: 134 time(s) in 120 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 : Friday, June 7, 2019 7:42:52 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)
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 : Friday, June 7, 2019 7:59:56 PM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 5 times
Was thanked: 134 time(s) in 120 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 : Friday, June 7, 2019 8:49:47 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)
Maybe you are right. Thank you, 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.