Showing posts with label code. Show all posts
Showing posts with label code. Show all posts

Saturday, January 22, 2011

Mac Outlook 2011: Keyboard shortcut to quickly file messages

Trying a switch to Outlook 2011 for Mac I needed a keyboard shortcut to quickly move selected email messages to specific folders. I edited some of the default AppleScripts which appear in Outlook's script menu, ended up with a script per folder I want to move messages to. Next step was to assign a keyboard shortcut to each script e.g. Option-A for File Message to Archive, Option-F for File Message to Follow-Up and so on.


A sample script is below, this is the one I use to move messages to a folder named "Archive", I simply created copies of this script for each folder I want to move messages to from the keyboard. The script is saved under ~/Documents/Microsoft User Data/Outlook Script Menu Items/File Message to Archive.scptd

*** UPDATE*** Microsoft released an Office 2011 SP2 upgrade on 4/12/2012, in this version of Outlook the scripts are expected to be placed in the folder: ~/Library/Application\ Support/Microsoft/Office/Outlook\ Script\ Menu\ Items/

The keyboard shortcut mapping is done from the OSX > System Preferences > Keyboard panel, just create a new Application shortcut, pick Outlook 2011 as the application and enter the exact name of your script as it appears in the script menu.


(*

 File message to Archive folder

*)

on run {}
 
 tell application "Microsoft Outlook"
  
  -- listSelectedItems : a list of all items selected in Entourage
  set listMessages to current messages
  
  -- Check to make sure items are selected, if not then quit
  if ((count of listMessages) < 1) then return
  
  -- Iterate through selected items
  repeat with objInSelection in listMessages
   
   set listFolders to mail folders
   
   repeat with objFolder in listFolders
    
    if (name of objFolder is "Archive") then
     set gtdFolder to objFolder
    end if
    
   end repeat
   
   if (class of account of objInSelection is not imap account) then
    -- IMAP currently not supported
    move objInSelection to gtdFolder
   end if
   
  end repeat
  
 end tell
 
end run

Friday, May 22, 2009

GWT disable text selection in an HTMLTable

While modifying FlexTable to handle cell selection It took me a while to figure out how to disable the native text selection behavior of the browsers on 'SHIFT+Click' events. Turns out this native javascript function does the job pretty well. I tried playing with event.preventDefault() and event.stopPropagation() but that didn't work.

private native static void disableTextSelectInternal(Element e, boolean disable)/*-{
if (disable) {
e.ondrag = function () { return false; };
e.onselectstart = function () { return false; };
e.style.MozUserSelect="none"
} else {
e.ondrag = null;
e.onselectstart = null;
e.style.MozUserSelect="text"
}
}-*/;

@Override
public void onKeyDown(KeyDownEvent event) {
if (event.isShiftKeyDown()) {
disableTextSelectInternal(table.getElement(), true);
}
...

Sunday, May 3, 2009

GWT+Eclipse: NoSuchMethodError

If you get this error message while compiling a GWT module in Eclipse, go to the project Build Path and change the Order/Export tab to have the GWT-SDK module at the top.

java.lang.NoSuchMethodError:
org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding.genericType()
Lorg/eclipse/jdt/internal/compiler/lookup/ReferenceBinding;
at com.google.gwt.dev.jdt.TypeRefVisitor.maybeDispatch(TypeRefVisitor.java:178)
at com.google.gwt.dev.jdt.TypeRefVisitor.endVisit(TypeRefVisitor.java:101)