Applescript to click checkbox in cell in row in outline - macos

I have a checkbox in the following hierarchy:
Outline->Row->Cell->Checkbox
This is how it looks in accessibility inspector:
I need to click on it.
So, I tried:
click checkbox 1 of cell 1 of row 3 of outline 1 of scroll area 2 of splitter group 1 of tab group 1 of window 1
This gives the error:
Expected end of line, etc. but found number.
If I try to select the row like this:
select row 3 of outline 1 of scroll area 2 of splitter group 1 of tab group 1 of window 1
The row is getting selected.
Also, I can read the properties of the row like so:
get properties row 3 of outline 1 of scroll area 2 of splitter group 1 of tab group 1 of window 1
but not the properties of the checkbox/cell using:
get properties of checkbox 1 of cell 1 of row 3 of outline 1 of scroll area 2 of splitter group 1 of tab group 1 of window 1
I'm an absolute n00b at applescript, I have no, I idea what is going wrong.
Can anyone help?
PS: I am trying to turn off the screenshot shortcuts with in system preferences.

It's choking on the specifier for AXCell. Cell doesn't work. Just use UI Element 1:
tell application "System Events"
tell process "System Preferences"
click checkbox 1 of UI element 1 of row 3 of outline 1 of scroll area 2 of splitter group 1 of tab group 1 of window 1
end tell
end tell

Related

How do you work backward and get the button from other people code

Let say this was the code provided? How do I get to see the “list 1 of group 2 of group 1 of group 1)? I understand that you would need to use the accessibility inspector but I have no clue how to do it. Hope someone can help out. Thank you!!!
tell application "System Events"
--mission control starten
tell application "Mission Control" to launch
delay 0.25
tell process "Dock"
set countSpaces to count buttons of list 1 of group 2 of group 1 of group 1
--new space
click button 1 of group 2 of group 1 of group 1
--switch to new space
repeat until (count buttons of list 1 of group 2 of group 1 of group 1) = (countSpaces + 1)
end repeat
click button (countSpaces + 1) of list 1 of group 2 of group 1 of group 1
end tell
delay 0.25
tell application "Calendar" to launch
tell application "Reminders" to launch
end tell

Unable to click checkbox of System Preferences by AppleScript, although it doesn't show errors

Errors
I had written the code below, and it seems to work until it select the row.
However, click checkbox doesn't work even though it doesn't give any errors.
tell application "System Preferences"
activate
reveal anchor "shortcutsTab" of pane id "com.apple.preference.keyboard"
end tell
tell application "System Events"
tell application process "System Preferences"
repeat while not (window 1 exists)
end repeat
tell window 1
repeat while not (rows of table 1 of scroll area 1 of splitter group 1 of tab group 1 exists)
end repeat
repeat with current_row in (rows of table 1 of scroll area 1 of splitter group 1 of tab group 1)
if value of static text 1 of current_row is equal to "Input Sources" then
select current_row
exit repeat
end if
end repeat
repeat while not (rows of outline 1 of scroll area 2 of splitter group 1 of tab group 1 exists)
end repeat
repeat with current_row in rows of outline 1 of scroll area 2 of splitter group 1 of tab group 1
if name of UI element 2 of current_row is equal to "Select next source in input menu" then
select current_row
click checkbox of current_row
exit repeat
end if
end repeat
end tell
end tell
end tell
What I have tried
I wrote below alternatively, but they all not work.
set value of checkbox of selected_row
set checkbox of selected_row to true
References
I searched many articles, but it doesn't solve.
How to click a checkbox of a drop-down tab in System Preferences
http://hints.macworld.com/article.php?story=20040317131326880
Any help is appreciated.
Change:
click checkbox of current_row
To:
click checkbox of UI element 1 of current_row
Tested your script on macOS Mojave, making the change shown above, and it worked as desired.

Update a screen on a webbrowser using applescript

Using safari on this website I can get applescript to change the input values for R G and B but I cannot Applescript to update the screen to reflect the new color. The screen only changes when you tab out of the box.
tell text field 1 of group 1 of group 4 of group 4 of UI element 1 of scroll
area 1 of group 1 of group 1 of tab group 1 of splitter group 1 of window "RGB
Color Codes Chart"
set value to item i of red1
end tell
The above code changes the value in safari of that cell but I cannot get Safari to update its screen.

AppleScript to change Audio MIDI Settings

Quick and simple AppleScript question.
I need to have an applescript that ticks the checkbox in the Audio MIDI Setup application. I am completely new to applescript.
The dialog looks like this, I need to check the 2nd checkbox.
Any hints?
Thank you!
I do not have "Soundflower" in my own system audio devices so I don't know I can get the exact values to create the AppleScript exactly the way you need it. However, this script will select the second checkbox for "Built In Output".
Here is the script that will accomplish this:
tell application "Audio MIDI Setup"
activate
end tell
delay 2
try
tell application "System Events"
tell process "Audio MIDI Setup"
select row 2 of outline 1 of scroll area 1 of splitter group 1 of window "Audio Devices"
-- change the value in the beginning of that line from "select row 2" to "select row 3" This should select the "Soundflower Output Devicee"
click checkbox 1 of UI element 4 of row 3 of outline 1 of scroll area 1 of tab group 1 of splitter group 1 of window "Audio Devices"
end tell
end tell
end try

FileMaker: Batch Changes to Source of a Table Occurrence

Is there any way (or are there any tools) to batch change the source of a Table Occurrence from a local file to an externally sourced file?
Situation: I manage a hosted database with hundreds of Table Occurrences of 15 or so tables. Some of my users access the database with slow internet connections. While many of the tables need to be updated for the entire workgroup, some data on other tables and UI information is mostly static.
I'd like to take a copy of the database, change the Table Occurrences of the tables which must be shared from a Local File source to an External Source (of the existing server.) I can do this by hand, but it would require thousands of clicks and be prone to inaccuracy. Much better if I can automate the process. (To specify, say, that all Occurrences of my Sales Table move from Local File to External Source.)
I realize that I might be able to so something with AppleScript's UI Scripting if there's not a better way to do it.
No answers so far, so I wrote this yesterday. It's dirty, long-winded and doesn't catch errors but it'll do the job and is something to build off of for the future.
--to prepare to run this script, you should already have the External Data Source set up
--you should also open the Manage > Database menu and select the "Relationships" tab
--set newDataSource to the name of the new external data source
set newDataSource to ""
--obtain tableOccurrences from TableNames ( Get ( FileName ) ) in the Data Viewer and copy the list into the tableOccurrences variable below
--note that tableOccurrences will be a return-separated list which is quite long when set
set tableOccurrences to ""
--a list of which tables should be moved from the local file to the hosted file. Note that these should be proper table names not table occurrences
set tablesToReplace to {"table1", "table2", ..., "tableN"}
tell application "FileMaker Pro Advanced"
activate
end tell
set AppleScript's text item delimiters to {return}
set j to the number of text items of tableOccurrences
repeat until j < 1
tell application "System Events"
tell application Process "FileMaker Pro Advanced"
keystroke text item j of tableOccurrences
keystroke "o" using command down
delay 1
set i to 1
repeat until ((i > (count of rows of table 1 of scroll area 1 of window 1)) or selected of row i of table 1 of scroll area 1 of window 1)
set i to i + 1
end repeat
if (i <= (count of rows of table 1 of scroll area 1 of window 1) and name of static text of row i of table 1 of scroll area 1 of window 1 is in tablestoReplace) then
set currentMasterTable to name of static text of row i of table 1 of scroll area 1 of window 1
set currentOccurrenceName to value of text field 1 of window 1
click pop up button 1 of window 1
tell menu 1 of pop up button 1 of window 1
click menu item newDataSource
end tell
set k to 1
set tableSelected to false
repeat until tableSelected or k > (count of rows of table 1 of scroll area 1 of window 1)
if name of static text of row k of table 1 of scroll area 1 of window 1 = currentMasterTable then
select row k of table 1 of scroll area 1 of window 1
set tableSelected to true
end if
set k to k + 1
end repeat
set value of text field 1 of scroll area 1 of window 1 to currentOccurrenceName
click button "OK" of window 1
else
click button "Cancel" of window 1
end if
end tell
end tell
set j to j - 1
end repeat

Resources