How to get current focus in macos with bash?
See the article "Help a Mac Automation Find Focus". There is a link to a gist. In the Apple terminal user guide, "Automate tasks using AppleScript and Terminal on Mac" may also help.
Related
One new feature of macOS 13 Ventura is the new layout and design of the system preferences. However, this caused many of my automation scripts to stop working.
Does anyone know how to navigate through the new system preferences? To be precise, what is the equivalent to the following code which is compatible with macOS 13 Ventura?
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.sound"
end tell
The code above worked with old versions fine, but shows
execution error: System Settings got an error: AppleEvent handler
failed. (-10000)
in macOS 13 Ventura
I've encountered the same issue, it seems to be a known issue, and it was also discussed at https://gist.github.com/rmcdongit/f66ff91e0dad78d4d6346a75ded4b751?permalink_comment_id=4286384
What you're looking for is:
do shell script "open x-apple.systempreferences:com.apple.Sound-Settings.extension"
However, manipulating that screen is another pickle.
Does it have to be AppleScript or is bash okay? If bash is an option, you can use the open command. To your specific ask, you can use the following to open Sound preferences:
open x-apple.systempreferences:com.apple.Sound-Settings.extension
More details can be found here: https://www.macosadventures.com/2022/12/05/how-to-open-every-section-of-macos-ventura-system-settings/
When I was using MacOS 12.5.1, I found out that older version(e.g. 11.3) of Xcodes can't be opened. It's icon became a banned image and can be opened neither by double click nor 'open' cmd in terminal.
So I want to know how to verify Xcode in terminal? Use 'open' cmd is an option but if the target app is available, it will be opened which I don't expect to happen.
I found there is a "Minimum system version" in /Applications/Xcode.app/Contents/Info.plist, but no "Max system version". In my case I wanna to know which older verison of xcode is unavailable on new MacOS. Any help will be appreciated!
Use the excellent Go64 application from St. Clair Software. When you load it and scan, you can then see programs that will not work on your system clearly marked with a strike thru circle:
I am an aspiring software engineer and in doing some studying and development work I have found that it would be very convenient to have a Terminal command which would launch chrome in a new window with the first argument being passed as the URL to launch (or a local HTML file). Is there a way to do this on Mac OSX (I'm on Sierra 10.12.4)? I tried searching but the only guide I found was 5 years old and doesn't seem to work.
Bonus:
It would be even better if we could force the new window to open with the Inspection window already opened showing source code and page structure!
I am working on a cocoa application. I see a strange behaviour on Mac OS 10.6.8..!
My Cocoa application has an Automator action inside it. I want it to be listed in Automator as soon as I install it.
The conditions are as follows:
1. After installation, user should not go to the installed path.
2. User should not launch the application.
I mean, I am seeing this bug only for above mentioned situations. If I go to the installed folder, or launch the application, the automator app gets listed.
I didn't see this defect on Mac OS 10.7.5 or Mac OS 10.8.2..
Also I tried touch command via terminal just in case thinking that if any kind of Access updating is required and all. But that wasn't the case.
Any suggestions? Can I run any kind or Shell/Applescript while installing [After installation of the application] so that I can list the automator action in automator?
Any advice or help would be great!!
You can have a .txt file with the below script and then you have to add postflight script when taking .pkg file in Package Maker.
open "/Applications/yourAppName.app"
Try this Terminal command.
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister .../Whatever.app
You shouldn't hard-code the path, though, as users sometimes stick apps in weird locations (citation: I do it :).
I was wondering...
Is it possible to disable the prompt on Mac OSX Lion that says.
Are you sure you want to run this script? [Yes, Cancel]
I added this script to the "Login Items" File to start automatically when I login, but the prompt still pops up. Any Ideas?
Thanks.
When an Applescript is saved as an application so that it can be run independently of Script Editor with a double-click, there is an option to have a "startup screen" which, in Snow Leopard and before (I don't have Lion), offers a choice between "Run" (the default) or "Quit". I imagine you might have enabled that feature without realizing, or maybe in Lion it is now activated by default.