Switch to Win console app for new Outlook mail

This commit is contained in:
2013-12-10 13:57:04 -05:00
parent b5deea18d9
commit 90ddc605d1
36 changed files with 230 additions and 34 deletions

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>

View File

@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C43F0F6F-9DF2-4698-9493-354CE1ED71BC}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OutlookNewMail</RootNamespace>
<AssemblyName>OutlookNewMail</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Office.Interop.Outlook, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OutlookNewMail", "OutlookNewMail.csproj", "{C43F0F6F-9DF2-4698-9493-354CE1ED71BC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C43F0F6F-9DF2-4698-9493-354CE1ED71BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C43F0F6F-9DF2-4698-9493-354CE1ED71BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C43F0F6F-9DF2-4698-9493-354CE1ED71BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C43F0F6F-9DF2-4698-9493-354CE1ED71BC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Office.Interop.Outlook;
using System.Runtime.InteropServices;
namespace OutlookNewMail
{
class Program
{
static void Main(string[] args)
{
Application outlookApp;
System.Diagnostics.Process[] processes = System.Diagnostics.Process.GetProcessesByName("OUTLOOK");
if (processes.Length > 0)
{
outlookApp = Marshal.GetActiveObject("Outlook.Application") as Application;
}
else
{
outlookApp = new Application();
}
var inbox = outlookApp.GetNamespace("mapi").GetDefaultFolder(OlDefaultFolders.olFolderInbox);
if (inbox.UnReadItemCount == 0)
{
Console.Out.Write("\"#000000\"");
return;
}
Console.Out.Write("\"pattern: \"NewMail\"\"");
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OutlookNewMail")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("OutlookNewMail")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7ff13c81-e91d-4227-8660-38e91c6ccbbe")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// 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("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

View File

@@ -0,0 +1,6 @@
D:\GitHub\furry-octo-sansa\blink1\OutlookNewMail\OutlookNewMail\bin\Debug\OutlookNewMail.exe.config
D:\GitHub\furry-octo-sansa\blink1\OutlookNewMail\OutlookNewMail\bin\Debug\OutlookNewMail.exe
D:\GitHub\furry-octo-sansa\blink1\OutlookNewMail\OutlookNewMail\bin\Debug\OutlookNewMail.pdb
D:\GitHub\furry-octo-sansa\blink1\OutlookNewMail\OutlookNewMail\obj\Debug\OutlookNewMail.csprojResolveAssemblyReference.cache
D:\GitHub\furry-octo-sansa\blink1\OutlookNewMail\OutlookNewMail\obj\Debug\OutlookNewMail.exe
D:\GitHub\furry-octo-sansa\blink1\OutlookNewMail\OutlookNewMail\obj\Debug\OutlookNewMail.pdb

View File

@@ -0,0 +1,5 @@
D:\GitHub\furry-octo-sansa\blink1\OutlookNewMail\OutlookNewMail\bin\Release\OutlookNewMail.exe.config
D:\GitHub\furry-octo-sansa\blink1\OutlookNewMail\OutlookNewMail\bin\Release\OutlookNewMail.exe
D:\GitHub\furry-octo-sansa\blink1\OutlookNewMail\OutlookNewMail\bin\Release\OutlookNewMail.pdb
D:\GitHub\furry-octo-sansa\blink1\OutlookNewMail\OutlookNewMail\obj\Release\OutlookNewMail.exe
D:\GitHub\furry-octo-sansa\blink1\OutlookNewMail\OutlookNewMail\obj\Release\OutlookNewMail.pdb

View File

@@ -1,7 +0,0 @@
@echo off
rem setx DT_DISABLEINITIALLOGGING true
powershell -File C:\Users\maweir\Documents\blink1-scripts\new-mail.ps1
for /F "tokens=*" %%a in (d:\blink-new-mail-temp.txt) do set "color=%%a"
rem set /p color=<d:\blink-new-mail-temp.txt
echo "%color%"

View File

@@ -1,9 +0,0 @@
$outlook = New-Object -com Outlook.Application
$inbox = $outlook.Session.GetDefaultFolder(6)
$stream = New-Object 'System.IO.StreamWriter' -ArgumentList "d:\blink-new-mail-temp.txt", $false
if ($inbox.UnReadItemCount -eq 0) {
$stream.WriteLine("#000000")
} else {
$stream.WriteLine("pattern: ""NewMail""")
}
$stream.close()

View File

@@ -9,42 +9,36 @@
"pname": "New Comic",
"type": "ifttt",
"arg1": "GR: New Comic",
"lastVal": "Gmail",
"possibleVals": [
"FPGNewMail"
],
"lastTime": "1386674867"
"lastVal": "[couldn't connect]",
"possibleVals": [],
"lastTime": "1386700363"
},
"New Dev Article": {
"iname": "New Dev Article",
"pname": "New Dev Article",
"type": "ifttt",
"arg1": "GR:New Dev Item",
"lastVal": "Gmail",
"possibleVals": [
"FPGNewMail"
],
"lastTime": "1386674867"
"lastVal": "[couldn't connect]",
"possibleVals": [],
"lastTime": "1386700363"
},
"NewMail": {
"iname": "NewMail",
"pname": "NewMail",
"type": "script",
"arg1": "C:\\Users\\maweir\\Documents\\blink1-scripts\\blinkOutlookNewMail.bat",
"lastVal": "no color or pattern in output",
"arg1": "C:\\Users\\maweir\\Documents\\blink1-scripts\\OutlookNewMail.exe",
"lastVal": "NewMail",
"possibleVals": [],
"lastTime": "1386691221"
"lastTime": "1386700363"
},
"FPG New Mail": {
"iname": "FPG New Mail",
"pname": "FPG New Mail",
"type": "ifttt",
"arg1": "FPGNewMail",
"lastVal": "Gmail",
"possibleVals": [
"FPGNewMail"
],
"lastTime": "1386674867"
"lastVal": "[couldn't connect]",
"possibleVals": [],
"lastTime": "1386700363"
}
}</value>
</setting>