Skip to content

Commit ab565a1

Browse files
2.3.3.6 - Active Window Title text comparison includes type of match to use during text comparison.
1 parent 7f1cdce commit ab565a1

File tree

12 files changed

+198
-58
lines changed

12 files changed

+198
-58
lines changed

Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("2.3.3.5")]
36-
[assembly: AssemblyFileVersion("2.3.3.5")]
35+
[assembly: AssemblyVersion("2.3.3.6")]
36+
[assembly: AssemblyFileVersion("2.3.3.6")]
3737
[assembly: NeutralResourcesLanguageAttribute("en-CA")]

app.manifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<assemblyIdentity
44
type="win32"
55
name="GavinKendall.AutoScreenCapture"
6-
version="2.3.3.5"/>
6+
version="2.3.3.6"/>
77
<asmv3:application>
88
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
99
<dpiAware>True/PM</dpiAware>

autoscreen.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,11 @@
7171
<ApplicationManifest>app.manifest</ApplicationManifest>
7272
</PropertyGroup>
7373
<PropertyGroup>
74-
<SignAssembly>true</SignAssembly>
74+
<SignAssembly>false</SignAssembly>
7575
</PropertyGroup>
7676
<PropertyGroup>
77-
<AssemblyOriginatorKeyFile>autoscreen.pfx</AssemblyOriginatorKeyFile>
77+
<AssemblyOriginatorKeyFile>
78+
</AssemblyOriginatorKeyFile>
7879
</PropertyGroup>
7980
<ItemGroup>
8081
<Reference Include="System" />
@@ -325,7 +326,6 @@
325326
</None>
326327
<Compile Include="ScreenCapture.cs" />
327328
<Compile Include="modules\slideshow\Slideshow.cs" />
328-
<None Include="autoscreen.pfx" />
329329
</ItemGroup>
330330
<ItemGroup>
331331
<Content Include="autoscreen.ico" />

autoscreen.pfx

-1.72 KB
Binary file not shown.

interface/FormAbout.resx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119119
</resheader>
120120
<data name="richTextBoxDeveloper.Text" xml:space="preserve">
121-
<value>Auto Screen Capture 2.3.3.5 ("Boombayah")
121+
<value>Auto Screen Capture 2.3.3.6 ("Boombayah")
122122
Developed by Gavin Kendall (2008 - 2020)
123123

124124
SourceForge Project Site
@@ -322,6 +322,7 @@ END OF TERMS AND CONDITIONS</value>
322322
</data>
323323
<data name="richTextBoxChangelog.Text" xml:space="preserve">
324324
<value>Codename "Boombayah"
325+
2.3.3.6 Active Window Title text comparison includes type of match to use during text comparison.
325326
2.3.3.5 Application Focus now has Delay Before and Delay After options.
326327
2.3.3.4 A bug fix for saving of file when adding screenshot to collection.
327328
2.3.3.3 An internal list of image hash values are stored when emailing screenshots so we do not email duplicate images.

interface/main/FormMain-ScreenCapture.cs

Lines changed: 52 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
using System;
2222
using System.Drawing;
2323
using System.Windows.Forms;
24+
using System.Text.RegularExpressions;
2425

2526
namespace AutoScreenCapture
2627
{
@@ -70,7 +71,15 @@ private void EnableStartCapture()
7071

7172
groupBoxActiveWindowTitle.Enabled = true;
7273
checkBoxActiveWindowTitle.Enabled = true;
73-
textBoxActiveWindowTitle.Enabled = true;
74+
75+
groupBoxApplicationFocus.Enabled = true;
76+
comboBoxProcessList.Enabled = true;
77+
labelApplicationFocusDelayBefore.Enabled = true;
78+
labelApplicationFocusDelayAfter.Enabled = true;
79+
numericUpDownApplicationFocusDelayBefore.Enabled = true;
80+
numericUpDownApplicationFocusDelayAfter.Enabled = true;
81+
buttonApplicationFocusTest.Enabled = true;
82+
buttonApplicationFocusRefresh.Enabled = true;
7483
}
7584
else
7685
{
@@ -107,7 +116,15 @@ private void EnableStopScreenCapture()
107116

108117
groupBoxActiveWindowTitle.Enabled = false;
109118
checkBoxActiveWindowTitle.Enabled = false;
110-
textBoxActiveWindowTitle.Enabled = false;
119+
120+
groupBoxApplicationFocus.Enabled = false;
121+
comboBoxProcessList.Enabled = false;
122+
labelApplicationFocusDelayBefore.Enabled = false;
123+
labelApplicationFocusDelayAfter.Enabled = false;
124+
numericUpDownApplicationFocusDelayBefore.Enabled = false;
125+
numericUpDownApplicationFocusDelayAfter.Enabled = false;
126+
buttonApplicationFocusTest.Enabled = false;
127+
buttonApplicationFocusRefresh.Enabled = false;
111128
}
112129

113130
/// <summary>
@@ -186,15 +203,10 @@ private void TakeScreenshot(bool captureNow)
186203

187204
_screenCapture.ActiveWindowProcessName = _screenCapture.GetActiveWindowProcessName();
188205

189-
if (!string.IsNullOrEmpty(_screenCapture.ActiveWindowTitle))
206+
// Do not continue if the active window title needs to be checked and the active window title does not contain the defined text or regex pattern.
207+
if (checkBoxActiveWindowTitle.Checked && !ActiveWindowTitleMatchesText())
190208
{
191-
// Do not continue if the active window title needs to be checked and the active window title
192-
// does not contain the text defined in "Active Window Title Capture Text".
193-
if (checkBoxActiveWindowTitle.Checked && !string.IsNullOrEmpty(textBoxActiveWindowTitle.Text) &&
194-
!_screenCapture.ActiveWindowTitle.ToLower().Contains(textBoxActiveWindowTitle.Text.ToLower()))
195-
{
196-
return;
197-
}
209+
return;
198210
}
199211

200212
RunRegionCaptures();
@@ -642,5 +654,35 @@ private void timerScreenCapture_Tick(object sender, EventArgs e)
642654
StopScreenCapture();
643655
}
644656
}
657+
658+
private bool ActiveWindowTitleMatchesText()
659+
{
660+
try
661+
{
662+
if (!string.IsNullOrEmpty(_screenCapture.ActiveWindowTitle) && !string.IsNullOrEmpty(textBoxActiveWindowTitle.Text))
663+
{
664+
if (radioButtonCaseSensitiveMatch.Checked)
665+
{
666+
return _screenCapture.ActiveWindowTitle.Contains(textBoxActiveWindowTitle.Text);
667+
}
668+
else if (radioButtonCaseInsensitiveMatch.Checked)
669+
{
670+
return _screenCapture.ActiveWindowTitle.ToLower().Contains(textBoxActiveWindowTitle.Text.ToLower());
671+
}
672+
else if (radioButtonRegularExpressionMatch.Checked)
673+
{
674+
return Regex.IsMatch(_screenCapture.ActiveWindowTitle, textBoxActiveWindowTitle.Text);
675+
}
676+
}
677+
678+
return false;
679+
}
680+
catch (Exception ex)
681+
{
682+
Log.WriteExceptionMessage("FormMain-ScreenCapture::ActiveWindowTitleMatchesText", ex);
683+
684+
return false;
685+
}
686+
}
645687
}
646688
}

interface/main/FormMain-Settings.cs

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,47 @@ private void LoadSettings()
194194

195195
checkBoxScreenshotLabel.Checked = Convert.ToBoolean(Settings.User.GetByKey("ApplyScreenshotLabel", DefaultSettings.ApplyScreenshotLabel).Value);
196196

197-
// The user can compare the current Active Window Title text to compare against what the text they've defined.
197+
// Active Window Title
198198
checkBoxActiveWindowTitle.Checked = Convert.ToBoolean(Settings.User.GetByKey("ActiveWindowTitleCaptureCheck", DefaultSettings.ActiveWindowTitleCaptureCheck).Value);
199199
textBoxActiveWindowTitle.Text = Settings.User.GetByKey("ActiveWindowTitleCaptureText", DefaultSettings.ActiveWindowTitleCaptureText).Value.ToString();
200200

201+
if (checkBoxActiveWindowTitle.Checked)
202+
{
203+
textBoxActiveWindowTitle.Enabled = true;
204+
radioButtonCaseSensitiveMatch.Enabled = true;
205+
radioButtonCaseInsensitiveMatch.Enabled = true;
206+
radioButtonRegularExpressionMatch.Enabled = true;
207+
}
208+
else
209+
{
210+
textBoxActiveWindowTitle.Enabled = false;
211+
radioButtonCaseSensitiveMatch.Enabled = false;
212+
radioButtonCaseInsensitiveMatch.Enabled = false;
213+
radioButtonRegularExpressionMatch.Enabled = false;
214+
}
215+
216+
radioButtonCaseSensitiveMatch.Checked = false;
217+
radioButtonCaseInsensitiveMatch.Checked = false;
218+
radioButtonRegularExpressionMatch.Checked = false;
219+
220+
int activeWindowTitleMatchType = Convert.ToInt32(Settings.User.GetByKey("ActiveWindowTitleMatchType", DefaultSettings.ActiveWindowTitleMatchType).Value);
221+
222+
switch (activeWindowTitleMatchType)
223+
{
224+
case 1:
225+
radioButtonCaseSensitiveMatch.Checked = true;
226+
break;
227+
228+
case 2:
229+
radioButtonCaseInsensitiveMatch.Checked = true;
230+
break;
231+
232+
case 3:
233+
radioButtonRegularExpressionMatch.Checked = true;
234+
break;
235+
}
236+
237+
201238
// Application Focus
202239
RefreshApplicationFocusList();
203240

@@ -235,10 +272,23 @@ private void SaveSettings()
235272
Settings.User.GetByKey("ScreenshotLabel", DefaultSettings.ScreenshotLabel).Value = comboBoxScreenshotLabel.Text.Trim();
236273
Settings.User.GetByKey("ApplyScreenshotLabel", DefaultSettings.ApplyScreenshotLabel).Value = checkBoxScreenshotLabel.Checked;
237274

238-
// Active Window Title text comparison check.
275+
// Active Window Title
239276
Settings.User.GetByKey("ActiveWindowTitleCaptureCheck", DefaultSettings.ActiveWindowTitleCaptureCheck).Value = checkBoxActiveWindowTitle.Checked;
240277
Settings.User.GetByKey("ActiveWindowTitleCaptureText", DefaultSettings.ActiveWindowTitleCaptureText).Value = textBoxActiveWindowTitle.Text.Trim();
241278

279+
if (radioButtonCaseSensitiveMatch.Checked)
280+
{
281+
Settings.User.GetByKey("ActiveWindowTitleMatchType", DefaultSettings.ActiveWindowTitleMatchType).Value = 1;
282+
}
283+
else if (radioButtonCaseInsensitiveMatch.Checked)
284+
{
285+
Settings.User.GetByKey("ActiveWindowTitleMatchType", DefaultSettings.ActiveWindowTitleMatchType).Value = 2;
286+
}
287+
else if (radioButtonRegularExpressionMatch.Checked)
288+
{
289+
Settings.User.GetByKey("ActiveWindowTitleMatchType", DefaultSettings.ActiveWindowTitleMatchType).Value = 3;
290+
}
291+
242292
// Application Focus
243293
Settings.User.GetByKey("ApplicationFocus", DefaultSettings.ApplicationFocus).Value = comboBoxProcessList.Text;
244294
Settings.User.GetByKey("ApplicationFocusDelayBefore", DefaultSettings.ApplicationFocusDelayBefore).Value = (int)numericUpDownApplicationFocusDelayBefore.Value;

0 commit comments

Comments
 (0)