Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jul 21, 2013, 08:34 AM   #1
simonmason
macrumors newbie
 
Join Date: Jul 2013
Help with very simple Outlook 2011 script

I have just started playing with Applescript so forgive the simple questions.

I want to set up some scripts that move messages into subfolders and mark them unread - loosely copying the Quick Steps feature of Outlook 2010.

I created a simple script, but had some issues with it so started to reverse engineer a Microsoft sample script - which I fear ended up to be too complicated.

The script I created is below and results in an error "Microsoft Outlook got an error: Can't make current messages into type specifier".

I started off much simpler using some code that others had posted but I got stumped on the very first line:

set selectedMessages to current messages

This line always resulted in an "Expected end of line but got identifier error" - but others are using this statement so I am not sure what is causing this error. If I can get past this I think I can greatly simplify my code below? Thanks.

Code:
(*
	File Message to specific folder

*)

tell application "Microsoft Outlook"
	
	-- get the currently selected message or messages
	set currentMessages to «class CMgs»
	-- set selectedMessages to current messages
	
	-- if there are no messages selected, warn the user and then quit
	if ((count of currentMessages) < 1) then
		display dialog "Please select a message first and then run this script." with icon 1
		return
	end if
	
	repeat with aMessage in currentMessages
		set messageAccount to «class cAct» of aMessage
		
		if ((class of messageAccount is «class Eact») and (messageSender is not missing value)) then
			
			set filingFolderName to "Commercial"
			set matchingFolders to (every «class cMFo» of messageAccount whose name is filingFolderName)
			set filingFolder to make new «class cMFo» at messageAccount with properties {name:filingFolderName}
			
			repeat with aMessage in currentMessages
				
				if filingFolder is not missing value then
					move aMessage to filingFolder
				end if
				
			end repeat
			
		end if
		
	end repeat
	
end tell
simonmason is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Need help on simple send mail php script 835153 Web Design and Development 4 Sep 5, 2013 10:55 PM
Simple Input Output Script shurgie Mac Programming 4 Jan 31, 2013 11:56 AM
Outlook 2011 for MAC cgiurgiu Windows, Linux & Others on the Mac 0 Oct 23, 2012 02:58 PM
Help make a simple script carterx Mac Programming 6 Jul 11, 2012 01:54 PM
Outlook 2011 on 10.6.8 mwave1239 Mac Applications and Mac App Store 0 Jul 3, 2012 04:13 PM

Forum Jump

All times are GMT -5. The time now is 01:56 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC