Solved

Apple Script and check boxes

Posted on 2014-10-29
6
727 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

 
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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
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.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

695 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