Scripting a click on a button in a pop-up window on the login screen

At my school, we use Profile Manager.

To disable the managed preferences, an admin user needs to enter the admin username and password and then hold down the shift key and hit return at the same time. Then, a window pops up with the message, “This computer will be managed. Would you like to continue with managed settings enabled?”

There are three buttons at the bottom of the window, I need to be able to click/select the middle button that is labeled, Disable Settings.

tell application "System Events" to activate
tell application "System Events"
	keystroke "Other"
	keystroke return
	delay 10.0
	keystroke "USERNAME"
	keystroke tab
	delay 3.0
	keystroke "PASSWORD"
	delay 3.0
	key down shift
	keystroke return
	delay 5.0
	key up shift
	
end tell

I tried using click at {910,620}, but that produced an error. I tried to get the UI elements when the window was up and received the message, busy indicator 1 of window 1 of application process loginwindow.

This was the AppleScript I used.

tell application "System Events" to tell process "loginwindow"
	
	set frontmost to true
	
	delay 1
	
	tell window 1
		
	UI elements
		
	end tell
	
end tell

I would greatly appreciated any help on this.

Sincerely,

Hugh Hughes

Just to be clear, I am trying to automate the entire login process for admin users. This would be especially helpful when using Apple Remote Desktop to perform tasks on multiple machines.

Thanks,

Hugh Hughes

Hello

(1) your delays are awfully long. I never need more than 1 second

(2) issuing the command shift + return is not achieved with :
delay 3.0
key down shift
keystroke return
delay 5.0

but with :
keystroke return using {shift down}

Yvan KOENIG (VALLAURIS, France) vendredi 5 juin 2015 15:44:50

Here is an edited version :

tell application "Profile Manager" to activate
tell application "System Events" to tell process "Profile Manager"
	set frontmost to true
tell window 1
	keystroke "Other"
	keystroke return
	
	keystroke "USERNAME"
	keystroke tab
	delay 0.2
	keystroke "PASSWORD"
	delay 0.2
	keystroke return using {shift down}
end tell	
	repeat
		delay 0.2
		if exists window "PUT THE TITLE OF THE WINDOW HERE" then exit repeat
	end repeat
	
	tell window 1
		click button "Disable Settings"
	end tell
end tell

Alas, I don’t use Os X Server and so don’t own Profile Manager.

I’m not sure of what is really needed.

(1) Is it wanted to enter the string “Other” or is it required to select an item named “Other” ?
(2) You wrote that pressing shift + return open a new window.
Are you sure that it’s a window ?
Often in such case the new UI item is not a window but a sheet.

Yvan KOENIG (VALLAURIS, France) vendredi 5 juin 2015 16:00:06

At a quick glance, I think you can use a launch daemon or something like that. Need to look back through the post. I was just taking it from the title of your post.

Edited: I can’t remember using one, but what it can do I think is run programs at the login screen.

Edited: btw, think I know how it works by theory.

gl,
kel

This is the image that appears.

The entire script works fine. I just need to click the “Disable Settings” button to complete it.

The delays are that long because of the speed of the machines I am working on here.