diff --git a/ShareX.HelpersLib/ExternalProgram.cs b/ShareX.HelpersLib/ExternalProgram.cs index 050b4c804..0533f70c6 100644 --- a/ShareX.HelpersLib/ExternalProgram.cs +++ b/ShareX.HelpersLib/ExternalProgram.cs @@ -32,6 +32,7 @@ namespace ShareX.HelpersLib public class ExternalProgram { public bool IsActive { get; set; } + public bool HiddenWindow { get; set; } public string Name { get; set; } public string Path { get; set; } public string Args { get; set; } @@ -60,7 +61,7 @@ public ExternalProgram(string name, string path, string args) } } - public string Run(string filePath) + public string Run(string filePath, bool hiddenWindow) { if (!string.IsNullOrEmpty(filePath) && CheckExtensions(filePath) && !string.IsNullOrEmpty(Path) && File.Exists(Path)) { @@ -98,6 +99,12 @@ public string Run(string filePath) psi.Arguments = args; } + if (hiddenWindow) + { + psi.WindowStyle = ProcessWindowStyle.Hidden; + psi.CreateNoWindow = true; + } + process.StartInfo = psi; DebugHelper.WriteLine(string.Format("Running {0} with arguments: {1}", Path, psi.Arguments)); diff --git a/ShareX/Forms/ActionsForm.Designer.cs b/ShareX/Forms/ActionsForm.Designer.cs index 2c00e9627..f6251a4e1 100644 --- a/ShareX/Forms/ActionsForm.Designer.cs +++ b/ShareX/Forms/ActionsForm.Designer.cs @@ -42,6 +42,7 @@ private void InitializeComponent() this.txtExtensions = new System.Windows.Forms.TextBox(); this.txtOutputExtension = new System.Windows.Forms.TextBox(); this.lblOutputExtension = new System.Windows.Forms.Label(); + this.cbHiddenWindow = new System.Windows.Forms.CheckBox(); this.SuspendLayout(); // // lblName @@ -115,11 +116,18 @@ private void InitializeComponent() resources.ApplyResources(this.lblOutputExtension, "lblOutputExtension"); this.lblOutputExtension.Name = "lblOutputExtension"; // + // cbHiddenWindow + // + resources.ApplyResources(this.cbHiddenWindow, "cbHiddenWindow"); + this.cbHiddenWindow.Name = "cbHiddenWindow"; + this.cbHiddenWindow.UseVisualStyleBackColor = true; + // // ActionsForm // this.AcceptButton = this.btnOK; resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.cbHiddenWindow); this.Controls.Add(this.lblOutputExtension); this.Controls.Add(this.txtOutputExtension); this.Controls.Add(this.txtExtensions); @@ -155,5 +163,6 @@ private void InitializeComponent() private System.Windows.Forms.TextBox txtExtensions; private System.Windows.Forms.TextBox txtOutputExtension; private System.Windows.Forms.Label lblOutputExtension; + private System.Windows.Forms.CheckBox cbHiddenWindow; } } \ No newline at end of file diff --git a/ShareX/Forms/ActionsForm.cs b/ShareX/Forms/ActionsForm.cs index ea0e415be..fd699c949 100644 --- a/ShareX/Forms/ActionsForm.cs +++ b/ShareX/Forms/ActionsForm.cs @@ -49,6 +49,7 @@ public ActionsForm(ExternalProgram fileAction) CodeMenu.Create(txtArguments); txtOutputExtension.Text = fileAction.OutputExtension ?? ""; txtExtensions.Text = fileAction.Extensions ?? ""; + cbHiddenWindow.Checked = fileAction.HiddenWindow; } private void btnPathBrowse_Click(object sender, EventArgs e) @@ -75,6 +76,7 @@ private void btnOK_Click(object sender, EventArgs e) FileAction.Args = txtArguments.Text; FileAction.Extensions = txtExtensions.Text; FileAction.OutputExtension = txtOutputExtension.Text; + FileAction.HiddenWindow = cbHiddenWindow.Checked; DialogResult = DialogResult.OK; } diff --git a/ShareX/Forms/ActionsForm.resx b/ShareX/Forms/ActionsForm.resx index fcaee0350..32e68d99a 100644 --- a/ShareX/Forms/ActionsForm.resx +++ b/ShareX/Forms/ActionsForm.resx @@ -123,10 +123,14 @@ - 5, 8 + 7, 10 + + + + 4, 0, 4, 0 - 38, 13 + 49, 17 0 @@ -144,16 +148,19 @@ $this - 12 + 13 True - 5, 56 + 7, 69 + + + 4, 0, 4, 0 - 50, 13 + 66, 17 2 @@ -171,16 +178,19 @@ $this - 11 + 12 True - 5, 104 + 7, 128 + + + 4, 0, 4, 0 - 60, 13 + 80, 17 5 @@ -198,17 +208,19 @@ $this - 10 + 11 - Top, Left, Right - 8, 24 + 11, 30 + + + 4, 4, 4, 4 - 296, 20 + 393, 22 1 @@ -223,16 +235,19 @@ $this - 9 + 10 Top, Left, Right - 8, 72 + 11, 89 + + + 4, 4, 4, 4 - 248, 20 + 329, 22 3 @@ -247,16 +262,19 @@ $this - 8 + 9 Top, Left, Right - 8, 120 + 11, 148 + + + 4, 4, 4, 4 - 296, 20 + 393, 22 6 @@ -271,23 +289,26 @@ $this - 7 + 8 Top, Right - 264, 70 + 352, 86 + + + 4, 4, 4, 4 - 40, 24 + 53, 30 4 ... - @Invariant + btnPathBrowse @@ -298,16 +319,19 @@ $this - 6 + 7 Top, Right - 152, 248 + 207, 351 + + + 4, 4, 4, 4 - 72, 24 + 96, 30 11 @@ -325,16 +349,19 @@ $this - 5 + 6 Top, Right - 232, 248 + 311, 351 + + + 4, 4, 4, 4 - 72, 24 + 96, 30 12 @@ -352,16 +379,19 @@ $this - 4 + 5 True - 5, 200 + 7, 246 + + + 4, 0, 4, 0 - 191, 13 + 257, 17 9 @@ -379,16 +409,19 @@ $this - 3 + 4 Top, Left, Right - 8, 216 + 11, 266 + + + 4, 4, 4, 4 - 296, 20 + 393, 22 10 @@ -403,16 +436,19 @@ $this - 2 + 3 Top, Left, Right - 8, 168 + 11, 207 + + + 4, 4, 4, 4 - 296, 20 + 393, 22 8 @@ -427,16 +463,19 @@ $this - 1 + 2 True - 5, 152 + 7, 187 + + + 4, 0, 4, 0 - 277, 13 + 373, 17 7 @@ -454,16 +493,46 @@ $this + 1 + + + True + + + 12, 295 + + + 128, 21 + + + 13 + + + Hidden Window + + + cbHiddenWindow + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + 0 True - 6, 13 + 8, 16 - 313, 281 + 417, 394 + + + 4, 4, 4, 4 CenterScreen diff --git a/ShareX/WorkerTask.cs b/ShareX/WorkerTask.cs index 9eaa7806c..3aadbc33c 100644 --- a/ShareX/WorkerTask.cs +++ b/ShareX/WorkerTask.cs @@ -613,7 +613,7 @@ private void DoFileJobs() foreach (ExternalProgram fileAction in actions) { - Info.FilePath = fileAction.Run(Info.FilePath); + Info.FilePath = fileAction.Run(Info.FilePath, fileAction.HiddenWindow); } LoadFileStream();