View Single Post
Quote:
Originally Posted by Schimmi View Post
My script editor crashes when trying to open the script. Can you post the program code or save it in plain text AppleScript?
Sure.

Code:
-- Purpose: To select random action from list
-- NOTE:  Most of the code is borrowed from snarke's "New Task to iCal" script.

-- Display directions

display dialog "Preparation:

1.  Open OmniFocus.
2.  Select (highlight) actions for the list.
3.  Press OK.

A random action will be displayed -- three times.  Choose one and go for it!" with title "Select Random Action from List"

-- Create empty list

set newTaskList to {}

tell application "OmniFocus"
	
	-- Set variables
	set theDoc to document window 1 of document 1
	set TaskList to the value of the selected tree of the content of theDoc
	
	-- Add selected tasks to list	
	repeat with theSelectedTask in TaskList
		set newTask to the name of theSelectedTask
		set end of newTaskList to newTask
	end repeat
end tell

-- Display result

repeat 3 times
	display dialog some item in newTaskList
end repeat