I enjoy using the Forecast view with it’s lovely sidebar calendar, but often want to quickly narrow it down to “work” items vs. “personal” items. I was wondering if it would be possible to do this with AppleScript. Here’s what I cooked up, which doesn’t work.
tell application "OmniFocus"
tell front document
set focus of document window 1 to "Work"
end tell
end tell
I’m guessing “Work” is a folder? If so, you want something like this:
tell application "OmniFocus"
tell the default document
set folderList to folders whose name is "Work"
tell the front document window
set focus to folderList
set selected sidebar tab to forecast tab
end tell
end tell
end tell
This works great! Thank you! The only thing of note is that the first " before Work was a smart quote. I ironed it out and now the script works perfectly.
I love this because I get the calendar in the sidebar and I can focus on today’s (or any day’s) due items for work, personal or both.
This is a helpful script. Any way to specify more than one folder? I get an AppleScript error that I am using an illogical comparison if I script “whose name is X or Y” or “whose name is X and Y”.
property pFocusList : {"Work", "Office", "Stockroom"}
tell application "OmniFocus"
tell the default document
set folderList to (folders whose name is first item of pFocusList)
repeat with folderName in rest of pFocusList
set theFolder to (folders whose name is folderName)
set folderList to theFolder & folderList
end repeat
tell the front document window
set focus to folderList
set selected sidebar tab to forecast tab
end tell
end tell
end tell
Any chance you can adapt this to include projects as well?
Set q to "My folder or project"
tell application "OmniFocus"
tell the default document
set folderList to folders whose name is q
tell the front document window
set focus to folderList
end tell
end tell
end tell
Set q to "Project name"
tell application "OmniFocus"
tell the default document
set FocusProject to (every flattened project whose name is q)
tell the front document window
set focus to FocusProject
end tell
end tell
end tell
property pProjectName : "Project Name"
on run
tell application "OmniFocus" to tell the default document
set FocusProject to (every flattened project whose name is pProjectName)
tell the front document window to set its focus to FocusProject
end tell
end run