omnifocus-applescripts icon indicating copy to clipboard operation
omnifocus-applescripts copied to clipboard

Script error: Can’t get day of theStartDate. Access not allowed.

Open bryantsili opened this issue 9 years ago • 2 comments

Hi @thinkingserious,

First off, thank you for creating the script. Now my boss doesn't have to keep asking me what I've been doing all day; I can show her! :)

But here is the problem - when I add the script to the toolbar, I receive the following error (screen shot below as well):

AppleScript reported the following error:

The operation couldn’t be completed. /Users/bryantsili/Library/Application Scripts/com.omnigroup.OmniFocus2/Task_completion_report.scpt:1987:2006: script error: Can’t get day of theStartDate. Access not allowed. (-1723)

However, when I run the script from the script editor, it works flawlessly. Any solutions you have in mind?

Best, BT

inbox__focus__work_

bryantsili avatar Jun 08 '16 06:06 bryantsili

Hi @bryantsili,

Unfortunately, I don't know of any solution. Perhaps you should drop a line in the OmniFocus forums. There are some serious OmniFocus script masters there.

thinkingserious avatar Jun 09 '16 03:06 thinkingserious

I know this is an old issue but I had encountered myself the same problem so I am sharing my solution here in case someone finds this:

Broken code with error Can’t get day of obj. Access not allowed.:

tell application "OmniFocus"

	set obj to current date

	log day of obj

	set day of obj to "25"

	log obj

end tell

My solution:

tell application "OmniFocus"
	
	using terms from scripting additions
		
		set obj to current date
		
		log day of obj
		
		set day of obj to "25"
		
		log obj
		
	end using terms from
	
end tell

So the trick is to use scripting additions. Taken from here.

alexkuc avatar Aug 24 '20 03:08 alexkuc