Solved

Apple Script and check boxes

Posted on 2014-10-29
6
564 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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
There is a security feature on iOS devices that is nearly impenetrable when it has been activated.  This article will provide some possible solutions as well as necessary steps to take to ensure you do not end up with a locked device.
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

757 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

22 Experts available now in Live!

Get 1:1 Help Now