StrokesPlus.net Forum
»
General Discussion
»
Scripts
»
Enable/Disable some gestures and hotkeys
Rank: Member
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!
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,359 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;
|
|
|
|
Rank: Member
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"?
|
|
|
|
Rank: Advanced Member
Groups: Translators, Moderators, Approved Joined: 4/6/2020(UTC) Posts: 79 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;
|
1 user thanked liuxilu for this useful post.
|
|
|
Rank: Advanced Member
Groups: Moderators, Approved Joined: 4/23/2020(UTC) Posts: 161 Thanks: 46 times Was thanked: 23 time(s) in 17 post(s)
|
Originally Posted by: liuxilu Code:var b = sp_config.Hotkeys.Where(a => a.Category=='XXX').ToArray();
for(var i = 0; i < b.Length; i++)
b[i].Active = false;
大佬优秀
|
|
|
|
Rank: Member
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 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.
|
|
|
|
StrokesPlus.net Forum
»
General Discussion
»
Scripts
»
Enable/Disable some gestures and hotkeys
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.
Important Information:
The StrokesPlus.net Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close