Automator App Assistive Access - System Event Error

Hullo Automator Pals,

Hopefully this will not always be a one-sided relationship, but at this stage I’m a total AppleScript Idiot and don’t have much to give…

Nevertheless, I’ve been tinkering, and was hoping someone might be able to point me in the right direction. Basically, I’ve cobbled together an AppleScript that opens two URLS in two different Safari Windows. They’re in the format of an Automator App, because I want to be able to launch it with Launchbar.

What I’m trying to do is place one window on the left side of the central screen (I’m running three monitors) and the other on the right. I seem to have figured out the first part of this, but whenever I run the app, I get told the below:

51%20am

Now, I’ve enabled both ScriptEditor and the newly-created ‘Melbourne Poetry App’ in Security > Privacy - to no avail. If anyone has any ideas, I’d be most obliged. I’ll paste the script below. Thank you, Automatorers!

on run {input, parameters}
	
	tell application "Safari"
		activate
		make new document with properties {URL:"https://us14.admin.mailchimp.com/"}
		set the URL of document 1 to "https://us14.admin.mailchimp.com/"
		make new document with properties {URL:"https://www.facebook.com/melbournepoetry/"}
		set the URL of document 2 to "https://www.facebook.com/melbournepoetry/"
		
		tell application "System Events"
			
			
			get the size of scroll area 1 of application process "Finder"
			set Display to {width:item 1, height:item 2} of the result
			
			
			set position of window 1 to [0, 0]
			set size of window 1 to [the Display's width, the Display's height]
			
			
			
			
			set [_w, _h] to the size of window 1
			set [_x, _y] to the position of window 1
			
			
			set the size of window 1 to [_h, _w / 2 - 1]
			
			
			set position of window 2 to [_x, _y + _h / 2]
			set size of window 2 to [_h, _w / 2 - 1]
		end tell
		
		
		activate application "Safari"
		
	end tell
	
	
	return input
end run

T

Take a look here at enabling assistive access.

http://www.macosxautomation.com/applescript/uiscripting/