Skip to content

Commit

Permalink
2.3.3.6 - Active Window Title text comparison includes type of match …
Browse files Browse the repository at this point in the history
…to use during text comparison.
  • Loading branch information
igloo-gkendall committed Jan 1, 2021
1 parent 7f1cdce commit ab565a1
Show file tree
Hide file tree
Showing 12 changed files with 198 additions and 58 deletions.
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.3.3.5")]
[assembly: AssemblyFileVersion("2.3.3.5")]
[assembly: AssemblyVersion("2.3.3.6")]
[assembly: AssemblyFileVersion("2.3.3.6")]
[assembly: NeutralResourcesLanguageAttribute("en-CA")]
2 changes: 1 addition & 1 deletion app.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<assemblyIdentity
type="win32"
name="GavinKendall.AutoScreenCapture"
version="2.3.3.5"/>
version="2.3.3.6"/>
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>True/PM</dpiAware>
Expand Down
6 changes: 3 additions & 3 deletions autoscreen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,11 @@
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>autoscreen.pfx</AssemblyOriginatorKeyFile>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
Expand Down Expand Up @@ -325,7 +326,6 @@
</None>
<Compile Include="ScreenCapture.cs" />
<Compile Include="modules\slideshow\Slideshow.cs" />
<None Include="autoscreen.pfx" />
</ItemGroup>
<ItemGroup>
<Content Include="autoscreen.ico" />
Expand Down
Binary file removed autoscreen.pfx
Binary file not shown.
3 changes: 2 additions & 1 deletion interface/FormAbout.resx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="richTextBoxDeveloper.Text" xml:space="preserve">
<value>Auto Screen Capture 2.3.3.5 ("Boombayah")
<value>Auto Screen Capture 2.3.3.6 ("Boombayah")
Developed by Gavin Kendall (2008 - 2020)

SourceForge Project Site
Expand Down Expand Up @@ -322,6 +322,7 @@ END OF TERMS AND CONDITIONS</value>
</data>
<data name="richTextBoxChangelog.Text" xml:space="preserve">
<value>Codename "Boombayah"
2.3.3.6 Active Window Title text comparison includes type of match to use during text comparison.
2.3.3.5 Application Focus now has Delay Before and Delay After options.
2.3.3.4 A bug fix for saving of file when adding screenshot to collection.
2.3.3.3 An internal list of image hash values are stored when emailing screenshots so we do not email duplicate images.
Expand Down
62 changes: 52 additions & 10 deletions interface/main/FormMain-ScreenCapture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Text.RegularExpressions;

namespace AutoScreenCapture
{
Expand Down Expand Up @@ -70,7 +71,15 @@ private void EnableStartCapture()

groupBoxActiveWindowTitle.Enabled = true;
checkBoxActiveWindowTitle.Enabled = true;
textBoxActiveWindowTitle.Enabled = true;

groupBoxApplicationFocus.Enabled = true;
comboBoxProcessList.Enabled = true;
labelApplicationFocusDelayBefore.Enabled = true;
labelApplicationFocusDelayAfter.Enabled = true;
numericUpDownApplicationFocusDelayBefore.Enabled = true;
numericUpDownApplicationFocusDelayAfter.Enabled = true;
buttonApplicationFocusTest.Enabled = true;
buttonApplicationFocusRefresh.Enabled = true;
}
else
{
Expand Down Expand Up @@ -107,7 +116,15 @@ private void EnableStopScreenCapture()

groupBoxActiveWindowTitle.Enabled = false;
checkBoxActiveWindowTitle.Enabled = false;
textBoxActiveWindowTitle.Enabled = false;

groupBoxApplicationFocus.Enabled = false;
comboBoxProcessList.Enabled = false;
labelApplicationFocusDelayBefore.Enabled = false;
labelApplicationFocusDelayAfter.Enabled = false;
numericUpDownApplicationFocusDelayBefore.Enabled = false;
numericUpDownApplicationFocusDelayAfter.Enabled = false;
buttonApplicationFocusTest.Enabled = false;
buttonApplicationFocusRefresh.Enabled = false;
}

/// <summary>
Expand Down Expand Up @@ -186,15 +203,10 @@ private void TakeScreenshot(bool captureNow)

_screenCapture.ActiveWindowProcessName = _screenCapture.GetActiveWindowProcessName();

if (!string.IsNullOrEmpty(_screenCapture.ActiveWindowTitle))
// 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.
if (checkBoxActiveWindowTitle.Checked && !ActiveWindowTitleMatchesText())
{
// Do not continue if the active window title needs to be checked and the active window title
// does not contain the text defined in "Active Window Title Capture Text".
if (checkBoxActiveWindowTitle.Checked && !string.IsNullOrEmpty(textBoxActiveWindowTitle.Text) &&
!_screenCapture.ActiveWindowTitle.ToLower().Contains(textBoxActiveWindowTitle.Text.ToLower()))
{
return;
}
return;
}

RunRegionCaptures();
Expand Down Expand Up @@ -642,5 +654,35 @@ private void timerScreenCapture_Tick(object sender, EventArgs e)
StopScreenCapture();
}
}

private bool ActiveWindowTitleMatchesText()
{
try
{
if (!string.IsNullOrEmpty(_screenCapture.ActiveWindowTitle) && !string.IsNullOrEmpty(textBoxActiveWindowTitle.Text))
{
if (radioButtonCaseSensitiveMatch.Checked)
{
return _screenCapture.ActiveWindowTitle.Contains(textBoxActiveWindowTitle.Text);
}
else if (radioButtonCaseInsensitiveMatch.Checked)
{
return _screenCapture.ActiveWindowTitle.ToLower().Contains(textBoxActiveWindowTitle.Text.ToLower());
}
else if (radioButtonRegularExpressionMatch.Checked)
{
return Regex.IsMatch(_screenCapture.ActiveWindowTitle, textBoxActiveWindowTitle.Text);
}
}

return false;
}
catch (Exception ex)
{
Log.WriteExceptionMessage("FormMain-ScreenCapture::ActiveWindowTitleMatchesText", ex);

return false;
}
}
}
}
54 changes: 52 additions & 2 deletions interface/main/FormMain-Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,47 @@ private void LoadSettings()

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

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

if (checkBoxActiveWindowTitle.Checked)
{
textBoxActiveWindowTitle.Enabled = true;
radioButtonCaseSensitiveMatch.Enabled = true;
radioButtonCaseInsensitiveMatch.Enabled = true;
radioButtonRegularExpressionMatch.Enabled = true;
}
else
{
textBoxActiveWindowTitle.Enabled = false;
radioButtonCaseSensitiveMatch.Enabled = false;
radioButtonCaseInsensitiveMatch.Enabled = false;
radioButtonRegularExpressionMatch.Enabled = false;
}

radioButtonCaseSensitiveMatch.Checked = false;
radioButtonCaseInsensitiveMatch.Checked = false;
radioButtonRegularExpressionMatch.Checked = false;

int activeWindowTitleMatchType = Convert.ToInt32(Settings.User.GetByKey("ActiveWindowTitleMatchType", DefaultSettings.ActiveWindowTitleMatchType).Value);

switch (activeWindowTitleMatchType)
{
case 1:
radioButtonCaseSensitiveMatch.Checked = true;
break;

case 2:
radioButtonCaseInsensitiveMatch.Checked = true;
break;

case 3:
radioButtonRegularExpressionMatch.Checked = true;
break;
}


// Application Focus
RefreshApplicationFocusList();

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

// Active Window Title text comparison check.
// Active Window Title
Settings.User.GetByKey("ActiveWindowTitleCaptureCheck", DefaultSettings.ActiveWindowTitleCaptureCheck).Value = checkBoxActiveWindowTitle.Checked;
Settings.User.GetByKey("ActiveWindowTitleCaptureText", DefaultSettings.ActiveWindowTitleCaptureText).Value = textBoxActiveWindowTitle.Text.Trim();

if (radioButtonCaseSensitiveMatch.Checked)
{
Settings.User.GetByKey("ActiveWindowTitleMatchType", DefaultSettings.ActiveWindowTitleMatchType).Value = 1;
}
else if (radioButtonCaseInsensitiveMatch.Checked)
{
Settings.User.GetByKey("ActiveWindowTitleMatchType", DefaultSettings.ActiveWindowTitleMatchType).Value = 2;
}
else if (radioButtonRegularExpressionMatch.Checked)
{
Settings.User.GetByKey("ActiveWindowTitleMatchType", DefaultSettings.ActiveWindowTitleMatchType).Value = 3;
}

// Application Focus
Settings.User.GetByKey("ApplicationFocus", DefaultSettings.ApplicationFocus).Value = comboBoxProcessList.Text;
Settings.User.GetByKey("ApplicationFocusDelayBefore", DefaultSettings.ApplicationFocusDelayBefore).Value = (int)numericUpDownApplicationFocusDelayBefore.Value;
Expand Down
Loading

0 comments on commit ab565a1

Please sign in to comment.