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 : Friday, May 22, 2020 10:43:52 PM(UTC)
sunnyabcd

Rank: Member

Reputation:

Groups: Approved
Joined: 4/9/2020(UTC)
Posts: 19

Thanks: 7 times
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 8:52:58 AM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 11 times
Was thanked: 143 time(s) in 125 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 : Sunday, May 24, 2020 8:50:08 PM(UTC)
sunnyabcd

Rank: Member

Reputation:

Groups: Approved
Joined: 4/9/2020(UTC)
Posts: 19

Thanks: 7 times
Thanks, Rob
Can sp Enable/Disable a Group of hotkey/Gestures?
suc as group "Clipboard"?
liuxilu  
#4 Posted : Sunday, May 24, 2020 11:11:01 PM(UTC)
liuxilu

Rank: Advanced Member

Reputation:

Groups: Moderators, Approved
Joined: 4/5/2020(UTC)
Posts: 67
China

Was thanked: 15 time(s) in 15 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 : Sunday, May 24, 2020 11:14:16 PM(UTC)
lyscop

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 4/23/2020(UTC)
Posts: 39
China

Thanks: 5 times
Was thanked: 1 time(s) in 1 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 4:53:33 AM(UTC)
sunnyabcd

Rank: Member

Reputation:

Groups: Approved
Joined: 4/9/2020(UTC)
Posts: 19

Thanks: 7 times
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.