AppleScript to lay out OF and Fantastical for side-by-side dragging and dropping?

Hi there,

I’ve been writing up how I use OmniFocus and Fantastical together and Joebuhlig suggested that I post here regarding an AppleScript I’d love to have in case anyone was interested enough to try to make it. (Pretty please?)

I use Fantastical side by side with Omnifocus for planning my day so that I can drag and drop the tasks I intend to get done today into spaces in my timetable. Here is an example of how that looks.

Dragging a task from OmniFocus to Fantastical creates a new entry in the default calendar and makes it the same duration as that given in Omnifocus’ “estimate time” field.

It would be nice to make sure these windows don’t get too big. I’m doing this on a MacBook Air so it’s all nice and close for dragging and dropping. It might get too spaced on other machines. On one side is my “Current Projects” perspective, without any of the extra sidebars that are usually open, and on the other is today’s or tomorrow’s day view. It would be great to be able to double click an icon or a link somewhere and have this setup open automatically.

Here is how I construct my “Current Projects” perspective in case you’re wondering:

1 Like

Since I already had Keyboard Maestro, I chained its window resize macro abilities to an AppleScript opening my desired perspective. Here’s my script to get you started…

tell application "OmniFocus"
	tell default document
		activate "OmniFocus"
		make new document window with properties {perspective name:"Next Actions"}
		tell application "System Events"
			keystroke "i" using command down & option down
		end tell
		-- ignoring application responses
		tell application "Keyboard Maestro Engine"
			do script "KM_determined_number_here"
			-- or: do script "2/3 left"
			-- or: do script "KM_determined_number_here" with parameter "Whatever"
		end tell
		-- end ignoring
		delay 2
		tell application "OmniFocus" to activate
		make new document window with properties {perspective name:"Dashboard"}
		-- ignoring application responses
		tell application "Keyboard Maestro Engine"
			do script "KM_determined_number_here"
			-- or: do script "Maximize"
			-- or: do script "KM_determined_number_here" with parameter "Whatever"
		end tell
		-- end ignoring
		tell application "System Events"
			keystroke "s" using command down & option down
		end tell
		-- ignoring application responses
		tell application "Keyboard Maestro Engine"
			do script "KM_determined_number_here"
			-- or: do script "1/3 right"
			-- or: do script "KM_determined_number_here" with parameter "Whatever"
		end tell
		-- end ignoring
		activate "OmniFocus"
	end tell
end tell
1 Like