Skip to content

Commit

Permalink
Add Process Start Action
Browse files Browse the repository at this point in the history
A new type of action which executes an arbitrary command string.
The configured string is passed as-is to cmd.exe /C with no validation
or checking, to be used to launch applications.

Example inputs:
notepad.exe
C:\Program Files\Mozilla Firefox\firefox.exe
notepad.exe foo.txt
  • Loading branch information
baykovr committed Jun 29, 2022
1 parent 8b4b33b commit eaa35f6
Show file tree
Hide file tree
Showing 12 changed files with 3,479 additions and 53 deletions.
12 changes: 9 additions & 3 deletions GAVPI/GAVPI/Core/Engine/Action.cs
Expand Up @@ -376,11 +376,11 @@ public override void run()

#region System Action
// System calls and actionss.
public partial class ProcessExec : Action
public partial class ProcessStart : Action
{
Process proc = new Process();

public ProcessExec(string proc_name) : base(proc_name) { }
public ProcessStart(string value) : base(value) { }

public override string value
{
Expand All @@ -389,7 +389,13 @@ public override string value

public override void run()
{
Process.Start(this.value);
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.Arguments = "/C " + this.value;
process.StartInfo = startInfo;
process.Start();
}
}

Expand Down
2 changes: 1 addition & 1 deletion GAVPI/GAVPI/Core/GAVPI.cs
Expand Up @@ -24,7 +24,7 @@ static class GAVPI
// The application's title, a system-wide unique ID to facilitate single-instancing (see Mutex,
// later), and an XML Path to easily extract specific information from GAVPI Profile XML documents.

public const string BUILD_VERSION = "21.11.01";
public const string BUILD_VERSION = "22.06.28";

const string APPLICATION_TITLE = "GAVPI";

Expand Down
9 changes: 9 additions & 0 deletions GAVPI/GAVPI/GAVPI.csproj
Expand Up @@ -96,6 +96,12 @@
<Compile Include="GUI\Actions\frm_AddEdit_PlaySoundAction.designer.cs">
<DependentUpon>frm_AddEdit_PlaySoundAction.cs</DependentUpon>
</Compile>
<Compile Include="GUI\Actions\frm_AddEdit_ProcessStartAction.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GUI\Actions\frm_AddEdit_ProcessStartAction.Designer.cs">
<DependentUpon>frm_AddEdit_ProcessStartAction.cs</DependentUpon>
</Compile>
<Compile Include="GUI\frm_AddEdit_ActionSequence.cs">
<SubType>Form</SubType>
</Compile>
Expand Down Expand Up @@ -204,6 +210,9 @@
<EmbeddedResource Include="GUI\Actions\frm_AddEdit_PlaySoundAction.resx">
<DependentUpon>frm_AddEdit_PlaySoundAction.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GUI\Actions\frm_AddEdit_ProcessStartAction.resx">
<DependentUpon>frm_AddEdit_ProcessStartAction.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GUI\frm_AddEdit_ActionSequence.resx">
<DependentUpon>frm_AddEdit_ActionSequence.cs</DependentUpon>
<SubType>Designer</SubType>
Expand Down
54 changes: 32 additions & 22 deletions GAVPI/GAVPI/GUI/Actions/frm_AddEdit_PressAction.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

151 changes: 151 additions & 0 deletions GAVPI/GAVPI/GUI/Actions/frm_AddEdit_ProcessStartAction.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit eaa35f6

Please sign in to comment.