Give this a go, @noisneil. Long-form and arrow-headed for readability.
It seems the trick is to select the row containing the checkbox before you click the checkbox...
tell application "System Events"
tell application process "Installer"
tell window 1
tell group 1
tell splitter group 1
tell group 1
tell scroll area 1
tell outline 1
repeat with eachRow in (get every row)
set cbName to name of checkbox 1 of eachRow
if cbName contains "AAX" or cbName contains "VST" then
select eachRow
tell checkbox 1 of eachRow
click
end tell
end if
end repeat
end tell
end tell
end tell
end tell
end tell
end tell
end tell
end tell
You can then create a "choice changes file" -- an XML file that the installer merges with the original to create an install solution it can then run.
That's as much of the theory as I know -- and I have never done this in practice! I'll dig further if the AS above isn't working, coz it's something I should learn about anyway...
More info available via the Terminal with man installer if you're interested.
You've only gone and nailed it! Thankyou so much!!! The only way it could be improved is if the list of strings to check for could be set as a KM variable and then iterated in the AS.
set inst to system attribute "KMINSTANCE"
tell application "Keyboard Maestro Engine"
set searchStrings to getvariable "Local_theSearchStrings" instance inst
end tell
tell application "System Events"
tell application process "Installer"
tell window 1
--activate
tell group 1
tell splitter group 1
tell group 1
tell scroll area 1
tell outline 1
repeat with eachRow in (get every row)
set cbName to name of checkbox 1 of eachRow
repeat with eachItem in (every paragraph of searchStrings)
if cbName contains eachItem then
select eachRow
tell checkbox 1 of eachRow
click
end tell
exit repeat
end if
end repeat
end repeat
end tell
end tell
end tell
end tell
end tell
end tell
end tell
end tell
I have found one other thing. The Press button named action does press the button if its row is selected. I can't think of a way to make that work in the macro though.
It makes me a bit nervous that things would be installed without any visual feedback at all. Here's how I think it might work, but this is as yet completely untested:
Wow! I’ve been continuing to manually do this (creating xml files for each installer I have to automate the install for) but this method could be very promising. I’ll check it out!
Also I haven’t had any issues at all using this silent install method, I’m primarily using it to generate commands send via my company’s MDM to install packages on all of our studio computers.
I didn't have any luck with your script, but ran with the idea and came up with a (mostly) working script with a few functional changes, which, for my cases (running a script via an MDM with secure token access as root) i'm comfortable with.
However, doing some digging it seems like you are assuming the user (you) will be modifying the sudoers file to enable passwordless sudo with the install command. Once you do that, this script should work, but I don't personally feel comfortable enabling that for a command as potentially destructive as 'installer'.
Another method could be saving each of these scripts as a script file, running it via terminal and getting the password for sudo via standard input, but
I'm not sure how to then access KM Variables
You'd be entering the password for every installer, defeating the purpose of this whole thing.
On second thought... probably the way around this is hard coding your desired plug-in formats in a script file, and executing the script with multiple parameters, being your selected .pkg files. So you could run the script file from KM, only get prompted once for your password via terminal and go from there.
But, here's the macro/script, which works, assuming you've allowed passwordless sudo of 'installer', but otherwise is not functional, as sudo won't take the password as standard input when run from KM as far as i can tell.
Very cool, yeah that could definitely help passing a list of PKG files and formats to a script file, and a lot of other useful stuff where you'd want visual feedback from a script run.
Instance/locals are little more difficult, but not much -- assuming you are putting text into Terminal from a macro that has access to those variables. Just set an environment variable to %ExecutingInstance% amongst the rest of the text you're inputting:
If you chain the installations within a single Terminal session you'll probably only have to enter your password once for sudo (unless you've changed the default duration or the installers take a very long time to run).