Created
June 20, 2018 01:25
-
-
Save ddacunha/cc0a00580648550fbd931f569245d971 to your computer and use it in GitHub Desktop.
[AppleScript] Select next message in Outlook 2016 (in Javascript)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var outlook = Application('Microsoft Outlook') | |
var selectedMessageList = outlook.currentMessages() | |
for ( m of selectedMessageList) { | |
console.log( "selectedMessageList: " + m.id()) | |
} | |
var lastSelectedMessage = selectedMessageList[selectedMessageList.length-1] //set lastMessage to last item of msgList | |
console.log (lastSelectedMessage.subject()) | |
var messagesInInbox = outlook.inbox.messages() | |
console.log( "Message count in Inbox: " + messagesInInbox.length) | |
// Find next message after selection | |
var nextMessage | |
for (var i = 0; i < messagesInInbox.length; i++) { | |
if( messagesInInbox[i].id() == lastSelectedMessage.id() ) { | |
console.log( "Found message") | |
nextMessage = messagesInInbox[ i + 1] | |
break | |
} | |
} | |
console.log( "Next message: " + nextMessage.id() + " subject: " + nextMessage.subject()) | |
var account = lastSelectedMessage.account() | |
outlook.selection = nextMessage |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment