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

Notification

Icon
Error

Options
Go to last post Go to first unread
sunnyabcd  
#1 Posted : Saturday, May 23, 2020 4:43:52 AM(UTC)
sunnyabcd

Rank: Member

Reputation:

Groups: Approved
Joined: 4/10/2020(UTC)
Posts: 22

Thanks: 8 times
Was thanked: 2 time(s) in 2 post(s)
Dear Rob,

I have some gestures, marcos and hotkeys are prepared for some special environments
Every time I use these functions should enable and disable them. It's tedious.

so, i wish sp can provide a function to enable/disable a gesture or hotkey, just like:

sp.enable('Copy');
sp.disable('Cut');

thanks!
Rob  
#2 Posted : Saturday, May 23, 2020 2:52:58 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)
You can accomplish this by accessing the S+ config object in script.

Hotkey:
Code:
//Replace Test with name of hotkey
var spHotkey = sp_config.Hotkeys.Where(h => h.Description == 'Test').First();
//toggle active state
spHotkey.Active = !spHotkey.Active;

//Or set value explicitly
//spHotkey.Active = true;
//spHotkey.Active = false;

//Save and reload required for hotkey Active changes
sp_config.Save();
sp.Reload();


Global Action:
Code:
var spAction = sp_config.GlobalApplication.Actions.Where(a => a.Description == 'Copy').First();

//toggle active state
spAction.Active = !spAction.Active;

//Or set value explicitly
//spAction.Active = true;
//spAction.Active = false;


Application Action:
Code:
var spApp = sp_config.Applications.Where(app => app.Description == 'Notepad').First();
var spAction = spApp.Actions.Where(a => a.Description == 'New Action').First();
//toggle active state
spAction.Active = !spAction.Active;

//Or set value explicitly
//spAction.Active = true;
//spAction.Active = false;
sunnyabcd  
#3 Posted : Monday, May 25, 2020 2:50:08 AM(UTC)
sunnyabcd

Rank: Member

Reputation:

Groups: Approved
Joined: 4/10/2020(UTC)
Posts: 22

Thanks: 8 times
Was thanked: 2 time(s) in 2 post(s)
Thanks, Rob
Can sp Enable/Disable a Group of hotkey/Gestures?
suc as group "Clipboard"?
liuxilu  
#4 Posted : Monday, May 25, 2020 5:11:01 AM(UTC)
liuxilu

Rank: Advanced Member

Reputation:

Groups: Translators, Moderators, Approved
Joined: 4/6/2020(UTC)
Posts: 79
China

Thanks: 1 times
Was thanked: 21 time(s) in 21 post(s)
Code:
var b = sp_config.Hotkeys.Where(a => a.Category=='XXX').ToArray();
for(var i = 0; i < b.Length; i++)
    b[i].Active = false;
thanks 1 user thanked liuxilu for this useful post.
sunnyabcd on 5/25/2020(UTC)
lyscop  
#5 Posted : Monday, May 25, 2020 5:14:16 AM(UTC)
soooulp

Rank: Advanced Member

Reputation:

Groups: Moderators, Approved
Joined: 4/23/2020(UTC)
Posts: 161
China

Thanks: 46 times
Was thanked: 23 time(s) in 17 post(s)
Originally Posted by: liuxilu Go to Quoted Post
Code:
var b = sp_config.Hotkeys.Where(a => a.Category=='XXX').ToArray();
for(var i = 0; i < b.Length; i++)
    b[i].Active = false;


大佬优秀
sunnyabcd  
#6 Posted : Monday, May 25, 2020 10:53:33 AM(UTC)
sunnyabcd

Rank: Member

Reputation:

Groups: Approved
Joined: 4/10/2020(UTC)
Posts: 22

Thanks: 8 times
Was thanked: 2 time(s) in 2 post(s)
Originally Posted by: liuxilu Go to Quoted Post
Code:
var b = sp_config.Hotkeys.Where(a => a.Category=='XXX').ToArray();
for(var i = 0; i < b.Length; i++)
    b[i].Active = false;


Thank you , dear liuxilu
it works.
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.