AppleScript works in Editor but not in Outlook -


this works in applescript editor:

tell application "microsoft outlook" activate tell application "system events"   click menu item "block sender" of menu "junk mail" of menu item "junk mail" of menu "message" of menu bar item "message" in menu bar 1 of process "outlook" end tell 

however, when move script outlook's script folder (~/library/application support/microsoft/office/outlook script menu items/) , attempt run outlook's script menu, error:

system events got error: can't menu bar 1 of process "outlook". invalid index.

should not using system events?

there's bug in outlook outlook plugin scripts can't access menu bar in ui scripting, if outlook added security list of apps can control computer. have 2 workaround options.

  1. save script in system-wide script menu @ /library/scripts/ in case you'll first prompted "osascript not allowed assistive access". need go system preferences/security & privacy/privacy/accessibility , enable systemuiserver then, script run system-wide menu instead of outlook's script menu.

  2. you set keyboard combo "block sender" menu item using system preferences/keyboard/shortcuts. use key combo yourself, or if still need through script, script can call key combo using ui scripting. enter image description here enter image description here


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -