From f43fbf666efd694b58e90a6bf6e4ea458a807841 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Ferreira?= Date: Thu, 15 Oct 2020 03:50:00 +0100 Subject: [PATCH 1/6] ScriptRunenr allows the user to run script / files. May be used with Autohotkey to enable advanced key bindings --- .modules/OpenTabletDriver | 2 +- ScriptRunner/ScriptRunner.cs | 121 +++++++++++++++++++++++++++++++ ScriptRunner/ScriptRunner.csproj | 17 +++++ 3 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 ScriptRunner/ScriptRunner.cs create mode 100644 ScriptRunner/ScriptRunner.csproj diff --git a/.modules/OpenTabletDriver b/.modules/OpenTabletDriver index b211077..ef13505 160000 --- a/.modules/OpenTabletDriver +++ b/.modules/OpenTabletDriver @@ -1 +1 @@ -Subproject commit b21107772e9605316cc7179f9163b651ac73ae76 +Subproject commit ef13505cc71a626f04e00665ffa6a80521f4cc6c diff --git a/ScriptRunner/ScriptRunner.cs b/ScriptRunner/ScriptRunner.cs new file mode 100644 index 0000000..8c878cf --- /dev/null +++ b/ScriptRunner/ScriptRunner.cs @@ -0,0 +1,121 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using OpenTabletDriver.Plugin; +using OpenTabletDriver.Plugin.Tablet; +using OpenTabletDriver.Plugin.Attributes; +using System.Collections; + +namespace ScriptRunner +{ + internal static class ScriptRunnerHelper + { + public static Dictionary ScriptPathList = new Dictionary(); + } + + [PluginName("Script Runner")] + public class ScriptRunner : ITool, IValidateBinding, IBinding + { + public Dictionary ScriptPathList = ScriptRunnerHelper.ScriptPathList; + public string[] ValidProperties + { + get + { + string[] Properties = new string[10]; + for (int index = 0; index <= 9; index++) + { + Properties[index] = $"Script Path {index}"; + } + return Properties; + } + } + public string Property { set; get; } + public Action Press => (Action)(() => RunScript(ScriptPathList[Int32.Parse(Property)]) ); + private void RunScript(string path) + { + //TODO: distinguish between platforms + new Process + { + StartInfo = new ProcessStartInfo(path) + { + UseShellExecute = true + } + }.Start(); + } + public Action Release => (Action)(() => { }); + public bool Initialize() { return true; } + public void Dispose() { } + + //TODO: make this dynamic + [Property("Script Path 0")] + public string ScriptPath0 + { + get => ScriptPathList[0]; + set { ScriptPathList[0] = value; } + } + + [Property("Script Path 1")] + public string ScriptPath1 + { + get => ScriptPathList[1]; + set { ScriptPathList[1] = value; } + } + + [Property("Script Path 2")] + public string ScriptPath2 + { + get => ScriptPathList[2]; + set { ScriptPathList[2] = value; } + } + + [Property("Script Path 3")] + public string ScriptPath3 + { + get => ScriptPathList[3]; + set { ScriptPathList[3] = value; } + } + + [Property("Script Path 4")] + public string ScriptPath4 + { + get => ScriptPathList[4]; + set { ScriptPathList[4] = value; } + } + + [Property("Script Path 5")] + public string ScriptPath5 + { + get => ScriptPathList[5]; + set { ScriptPathList[5] = value; } + } + + [Property("Script Path 6")] + public string ScriptPath6 + { + get => ScriptPathList[6]; + set { ScriptPathList[6] = value; } + } + + [Property("Script Path 7")] + public string ScriptPath7 + { + get => ScriptPathList[7]; + set { ScriptPathList[7] = value; } + } + + [Property("Script Path 8")] + public string ScriptPath8 + { + get => ScriptPathList[8]; + set { ScriptPathList[8] = value; } + } + + [Property("Script Path 9")] + public string ScriptPath9 + { + get => ScriptPathList[9]; + set { ScriptPathList[9] = value; } + } + } +} \ No newline at end of file diff --git a/ScriptRunner/ScriptRunner.csproj b/ScriptRunner/ScriptRunner.csproj new file mode 100644 index 0000000..25c888a --- /dev/null +++ b/ScriptRunner/ScriptRunner.csproj @@ -0,0 +1,17 @@ + + + + netcoreapp3.1; net5.0 + + + + none + false + false + + + + + + + From c0c2b5f955ffe02b11d073fc48ad071033e7f8d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Ferreira?= Date: Thu, 15 Oct 2020 09:06:41 +0100 Subject: [PATCH 2/6] Fix getting selected script --- ScriptRunner/ScriptRunner.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ScriptRunner/ScriptRunner.cs b/ScriptRunner/ScriptRunner.cs index 8c878cf..d6f80e2 100644 --- a/ScriptRunner/ScriptRunner.cs +++ b/ScriptRunner/ScriptRunner.cs @@ -25,7 +25,7 @@ namespace ScriptRunner string[] Properties = new string[10]; for (int index = 0; index <= 9; index++) { - Properties[index] = $"Script Path {index}"; + Properties[index] = $"{index}"; } return Properties; } From 066566ba59154e4aaed127aaf66cce2b5c835bf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Ferreira?= Date: Thu, 15 Oct 2020 15:39:08 +0100 Subject: [PATCH 3/6] Cleaned ScriptRunner --- OTDPlugins.sln | 55 ++++++++++++++++++++++++++++++++++++ ScriptRunner/ScriptRunner.cs | 22 ++++++++------- 2 files changed, 67 insertions(+), 10 deletions(-) create mode 100644 OTDPlugins.sln diff --git a/OTDPlugins.sln b/OTDPlugins.sln new file mode 100644 index 0000000..4eb6956 --- /dev/null +++ b/OTDPlugins.sln @@ -0,0 +1,55 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30309.148 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OemKill", "OemKill\OemKill.csproj", "{4EC8FA2D-0CCC-4FC3-A32A-BC063924A803}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TouchEmu", "TouchEmu\TouchEmu.csproj", "{FC135341-4870-4555-8917-7248CFE07FCC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WindowsInk", "WindowsInk\WindowsInk.csproj", "{5DDEBB0A-D359-49F4-B1AE-7A13DB28987B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VMultiMode", "VMultiMode\VMultiMode.csproj", "{7D086384-9E50-45A1-BD7A-ECF44CB31223}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MeL", "MeL\MeL.csproj", "{F0931C43-4A63-4CDB-9B5F-A8DC50557109}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScriptRunner", "ScriptRunner\ScriptRunner.csproj", "{0FD75DED-4B34-4BB2-AFDF-3BB9B5DCC6FF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4EC8FA2D-0CCC-4FC3-A32A-BC063924A803}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4EC8FA2D-0CCC-4FC3-A32A-BC063924A803}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4EC8FA2D-0CCC-4FC3-A32A-BC063924A803}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4EC8FA2D-0CCC-4FC3-A32A-BC063924A803}.Release|Any CPU.Build.0 = Release|Any CPU + {FC135341-4870-4555-8917-7248CFE07FCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FC135341-4870-4555-8917-7248CFE07FCC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FC135341-4870-4555-8917-7248CFE07FCC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FC135341-4870-4555-8917-7248CFE07FCC}.Release|Any CPU.Build.0 = Release|Any CPU + {5DDEBB0A-D359-49F4-B1AE-7A13DB28987B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5DDEBB0A-D359-49F4-B1AE-7A13DB28987B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5DDEBB0A-D359-49F4-B1AE-7A13DB28987B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5DDEBB0A-D359-49F4-B1AE-7A13DB28987B}.Release|Any CPU.Build.0 = Release|Any CPU + {7D086384-9E50-45A1-BD7A-ECF44CB31223}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7D086384-9E50-45A1-BD7A-ECF44CB31223}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7D086384-9E50-45A1-BD7A-ECF44CB31223}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7D086384-9E50-45A1-BD7A-ECF44CB31223}.Release|Any CPU.Build.0 = Release|Any CPU + {F0931C43-4A63-4CDB-9B5F-A8DC50557109}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F0931C43-4A63-4CDB-9B5F-A8DC50557109}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F0931C43-4A63-4CDB-9B5F-A8DC50557109}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F0931C43-4A63-4CDB-9B5F-A8DC50557109}.Release|Any CPU.Build.0 = Release|Any CPU + {0FD75DED-4B34-4BB2-AFDF-3BB9B5DCC6FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0FD75DED-4B34-4BB2-AFDF-3BB9B5DCC6FF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0FD75DED-4B34-4BB2-AFDF-3BB9B5DCC6FF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0FD75DED-4B34-4BB2-AFDF-3BB9B5DCC6FF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {2BABACBE-E6E4-4641-BD76-927BFF428316} + EndGlobalSection +EndGlobal diff --git a/ScriptRunner/ScriptRunner.cs b/ScriptRunner/ScriptRunner.cs index d6f80e2..daacf0e 100644 --- a/ScriptRunner/ScriptRunner.cs +++ b/ScriptRunner/ScriptRunner.cs @@ -11,13 +11,13 @@ namespace ScriptRunner { internal static class ScriptRunnerHelper { - public static Dictionary ScriptPathList = new Dictionary(); + public static List ScriptPathList = Enumerable.Repeat("", 10).ToList(); } [PluginName("Script Runner")] public class ScriptRunner : ITool, IValidateBinding, IBinding { - public Dictionary ScriptPathList = ScriptRunnerHelper.ScriptPathList; + public List ScriptPathList = ScriptRunnerHelper.ScriptPathList; public string[] ValidProperties { get @@ -31,23 +31,25 @@ namespace ScriptRunner } } public string Property { set; get; } - public Action Press => (Action)(() => RunScript(ScriptPathList[Int32.Parse(Property)]) ); + public Action Press => (Action)(() => RunScript(ScriptPathList[Int32.Parse(Property)])); private void RunScript(string path) { - //TODO: distinguish between platforms - new Process + try { - StartInfo = new ProcessStartInfo(path) + new Process { - UseShellExecute = true - } - }.Start(); + StartInfo = new ProcessStartInfo(path) + { + UseShellExecute = true + } + }.Start(); + } + catch { } } public Action Release => (Action)(() => { }); public bool Initialize() { return true; } public void Dispose() { } - //TODO: make this dynamic [Property("Script Path 0")] public string ScriptPath0 { From 02700ad21191b5d2c55bf142bd1fedf2a73753a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Ferreira?= Date: Sat, 24 Oct 2020 19:56:06 +0100 Subject: [PATCH 4/6] Deleted old solution --- OTDPlugins.sln | 55 -------------------------------------------------- 1 file changed, 55 deletions(-) delete mode 100644 OTDPlugins.sln diff --git a/OTDPlugins.sln b/OTDPlugins.sln deleted file mode 100644 index 4eb6956..0000000 --- a/OTDPlugins.sln +++ /dev/null @@ -1,55 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30309.148 -MinimumVisualStudioVersion = 15.0.26124.0 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OemKill", "OemKill\OemKill.csproj", "{4EC8FA2D-0CCC-4FC3-A32A-BC063924A803}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TouchEmu", "TouchEmu\TouchEmu.csproj", "{FC135341-4870-4555-8917-7248CFE07FCC}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WindowsInk", "WindowsInk\WindowsInk.csproj", "{5DDEBB0A-D359-49F4-B1AE-7A13DB28987B}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VMultiMode", "VMultiMode\VMultiMode.csproj", "{7D086384-9E50-45A1-BD7A-ECF44CB31223}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MeL", "MeL\MeL.csproj", "{F0931C43-4A63-4CDB-9B5F-A8DC50557109}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScriptRunner", "ScriptRunner\ScriptRunner.csproj", "{0FD75DED-4B34-4BB2-AFDF-3BB9B5DCC6FF}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4EC8FA2D-0CCC-4FC3-A32A-BC063924A803}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4EC8FA2D-0CCC-4FC3-A32A-BC063924A803}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4EC8FA2D-0CCC-4FC3-A32A-BC063924A803}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4EC8FA2D-0CCC-4FC3-A32A-BC063924A803}.Release|Any CPU.Build.0 = Release|Any CPU - {FC135341-4870-4555-8917-7248CFE07FCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FC135341-4870-4555-8917-7248CFE07FCC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FC135341-4870-4555-8917-7248CFE07FCC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FC135341-4870-4555-8917-7248CFE07FCC}.Release|Any CPU.Build.0 = Release|Any CPU - {5DDEBB0A-D359-49F4-B1AE-7A13DB28987B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5DDEBB0A-D359-49F4-B1AE-7A13DB28987B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5DDEBB0A-D359-49F4-B1AE-7A13DB28987B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5DDEBB0A-D359-49F4-B1AE-7A13DB28987B}.Release|Any CPU.Build.0 = Release|Any CPU - {7D086384-9E50-45A1-BD7A-ECF44CB31223}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7D086384-9E50-45A1-BD7A-ECF44CB31223}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7D086384-9E50-45A1-BD7A-ECF44CB31223}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7D086384-9E50-45A1-BD7A-ECF44CB31223}.Release|Any CPU.Build.0 = Release|Any CPU - {F0931C43-4A63-4CDB-9B5F-A8DC50557109}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F0931C43-4A63-4CDB-9B5F-A8DC50557109}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F0931C43-4A63-4CDB-9B5F-A8DC50557109}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F0931C43-4A63-4CDB-9B5F-A8DC50557109}.Release|Any CPU.Build.0 = Release|Any CPU - {0FD75DED-4B34-4BB2-AFDF-3BB9B5DCC6FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0FD75DED-4B34-4BB2-AFDF-3BB9B5DCC6FF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0FD75DED-4B34-4BB2-AFDF-3BB9B5DCC6FF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0FD75DED-4B34-4BB2-AFDF-3BB9B5DCC6FF}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {2BABACBE-E6E4-4641-BD76-927BFF428316} - EndGlobalSection -EndGlobal From 41c617101d30b390e0a88357c19181626557bb48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Ferreira?= Date: Sat, 24 Oct 2020 20:00:01 +0100 Subject: [PATCH 5/6] Added to project --- VoiDPlugins.sln | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/VoiDPlugins.sln b/VoiDPlugins.sln index 4129354..cbd348d 100644 --- a/VoiDPlugins.sln +++ b/VoiDPlugins.sln @@ -15,6 +15,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MeL", "MeL\MeL.csproj", "{F EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PrecisionControl", "PrecisionControl\PrecisionControl.csproj", "{3315D19C-54CB-4947-8CF5-54953870FB4F}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScriptRunner", "ScriptRunner\ScriptRunner.csproj", "{7B727343-91A8-44DA-AF2A-9FC8A0986AA4}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -45,6 +47,10 @@ Global {3315D19C-54CB-4947-8CF5-54953870FB4F}.Debug|Any CPU.Build.0 = Debug|Any CPU {3315D19C-54CB-4947-8CF5-54953870FB4F}.Release|Any CPU.ActiveCfg = Release|Any CPU {3315D19C-54CB-4947-8CF5-54953870FB4F}.Release|Any CPU.Build.0 = Release|Any CPU + {7B727343-91A8-44DA-AF2A-9FC8A0986AA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7B727343-91A8-44DA-AF2A-9FC8A0986AA4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7B727343-91A8-44DA-AF2A-9FC8A0986AA4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7B727343-91A8-44DA-AF2A-9FC8A0986AA4}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 5d31a5e2e5b0c8262ef58ec4a2437ef3acf66635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Ferreira?= Date: Sat, 24 Oct 2020 20:24:54 +0100 Subject: [PATCH 6/6] Updated Submodule --- .modules/OpenTabletDriver | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.modules/OpenTabletDriver b/.modules/OpenTabletDriver index ef13505..84261d8 160000 --- a/.modules/OpenTabletDriver +++ b/.modules/OpenTabletDriver @@ -1 +1 @@ -Subproject commit ef13505cc71a626f04e00665ffa6a80521f4cc6c +Subproject commit 84261d8d8a90c5df4b5a1a38099212dec02a4f4f