Solved

Apple Script and check boxes

Posted on 2014-10-29
6
592 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How can I do this in Pyhton? 12 113
Folder Permission Powershell 4 50
React or Angular? 6 52
iPad Music not displaying playlists in iTunes on an iMac 2 42
This article will show, step by step, how to integrate R code into a R Sweave document
Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
Users will learn how resize a batch of photos from a single command in Photoshop via Photoshop's Image Processor. Open up an Image you'd like to resize in Adobe Photoshop: Adjust the image size according to your preferences. Image > Adjustments > …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

911 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now