Solved

Apple Script and check boxes

Posted on 2014-10-29
6
680 Views
Last Modified: 2014-11-04
I have tried everything that I can think of to check a check box in Apple Script. I am trying to enable Full Keyboard Shortcuts. I know there are Terminal command but when I have been playing around with them they don't work. So, I just want to do this via Apple Script. I have a script written to open up System Preferences and then go to Keyboard. I need to enable "Use all F1, F2, etc. keys as standard keys" then I can handle the rest. I have been working on this for a bit and reaching out here as a last hope I have tried everything. Thank you for your assistance. I am just starting to learning this platform. Just trying to check this checkbox in AppleScript
0
Comment
Question by:Kevin Portell
  • 4
  • 2
6 Comments
 
LVL 10

Expert Comment

by:EdTechy
ID: 40411509
0
 

Author Comment

by:Kevin Portell
ID: 40411546
I found those links and tried the second one. I am going to be running this one multiple computers so the first one isn't an option.  I even tried hacking some code together with Automator to no avail. I have created:
tell application "System Preferences"
	activate
	delay 1
	tell application "System Events" to keystroke "Keyboard"
	delay 1
	tell application "System Events" to keystroke return
	delay 3
	tell application "System Events" to tell process "Keyboard"
		set theCheckbox to checkbox "Use all F1, F2, etc. keys as standard function keys / When this option is selected, press the Fn key to use the special features printed on each key." of sheet 1 of window 1
		tell theCheckbox
			if not (1) then click theCheckbox
		end tell
	end tell
	delay 10
	tell application "System Events" to keystroke "q" using {command down}
end tell

Open in new window



However, it's doesn't work all the way. Could you assist me in ironing it out? Am I missing something or completely FUBARing it?
0
 

Author Comment

by:Kevin Portell
ID: 40411681
I think I am getting closer. I am getting the error:
Script Error
System Events got an error: Can't get sheet 1 of windows 1 of process "System Preferences. Invalid index.
Any thoughts?
0
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 
LVL 10

Assisted Solution

by:EdTechy
EdTechy earned 200 total points
ID: 40413189
Sorry, I have played with it but I am a much better Googler than scripter. I do think you will have to have assistive device services enabled before your Apple script will work as per the first post.
0
 

Accepted Solution

by:
Kevin Portell earned 0 total points
ID: 40414296
So, I had a bit of code together and got a functioning piece.
tell application "System Preferences"
	activate
	reveal anchor "keyboardTab" of pane "com.apple.preference.keyboard"
end tell
delay 1
tell application "System Events" to tell process "System Preferences"
	click checkbox 1 of tab group 1 of window 1
delay 1
tell application "System Events" to keystroke "q" using {command down}
end tell

Open in new window

0
 

Author Closing Comment

by:Kevin Portell
ID: 40421200
I am sure there is a better way and would like little discussion of best practices.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
Is your phone running out of space to hold pictures?  This article will show you quick tips on how to solve this problem.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question