Skip to content

Instantly share code, notes, and snippets.

@deenseth
deenseth / gist:1514633
Created December 23, 2011 16:23
Add Google Calendar Event Bookmarklet
javascript: var s;
/*Figure out the selected text*/
if ( window.getSelection ) {
s = window.getSelection();
} else if ( document.getSelection ) {
s = document.getSelection();
} else {
s = document.selection.createRange().text;
}
/*If there isn't any text selected, get user input*/
@deenseth
deenseth / gist:1453886
Created December 9, 2011 23:52
Determine Active Windows and URL of the item from IE 8, Firefox 3.6, Chrome 11, Outlook
handle is the return of the function GetForegroundWindow()
private InfoItem GetActiveItemFromHandle(string processName, IntPtr handle)
{
try
{
if (processName == ProcessList.iexplore.ToString())
{
#region IE 8
@deenseth
deenseth / gist:1453884
Created December 9, 2011 23:51
Get active application and url of Word, Excel, Powerpoint, and PDF
private InfoItem GetActiveItemFromROT(IntPtr handle)
{
activeItem = new InfoItem();
String activeTitle = GetActiveWindowText(handle);
String title;
IntPtr numFetched = IntPtr.Zero;
IRunningObjectTable runningObjectTable;
IEnumMoniker monikerEnumerator;
IMoniker[] monikers = new IMoniker[1];