Launching Apple Music with a specific library using Applescript - macos

I'd like to have an Applescript change the current Apple Music library automatically, instead of requiring me to hold down the option key when opening the app and manually select a new one. I found this answer which apparently works for iTunes, but the the name of the library location default seems to be different in Apple Music, and I can't figure out what it is. Any help is appreciated. Thanks!

Related

Automator takes screenshot of background instead of window

System specs: mac OS Monterrey V12.5, Apple M1 chip 2020
I am making an application which will take a screenshot of a video, and take the timestamp of the current point in this video, after which both the timestamp and screenshot will be send to a numbers file (mac OS excel like program).
I could not find an application to do this and I tried to get it working using python as shown here but was unable to. Now because I am on Mac I have decided to use Automator instead. I am currently on the screenshot part and Automator has a build in screenshot functionality.
Unfortunately, this screenshot does not detect browser or application windows, it will only take a screenshot of my background.
I have no idea why this is but I suspect it might have to do with permissions related to the M1 chip.
I tried different monitors and simplyfying the automation to just taking a screenshot, but so far nothing has helped, I could not find others online who had a similar problem.
If there is any information missing from this post I will be happy to provide it.
Edit: It seems to be some kind of permission issue, automator CAN take screenshots within Safari, now I just need to find a way to do so in firefox.
I have solved the issue, it turns out that the M1 chip has a special permission for screen recording, adding my Automator application to this permission list will allow it to take screenshots of all windows.

How to get status and song info from iTunes on Mac

The iPhone has an app that can control iTunes on a Mac, for example play a song. Is it possible to get iTunes status in my program (Objective-c or other language like node.js)? When I play a song I want to receive an event, and when I add a song I want to know what file I added in my program. I tried to find documentation about this but found no result - is there documentation about how to do this?
Absolutely, this can be done with Applescript. iTunes is fully scriptable. You can control it, get information about the currently playing media, etc.
http://dougscripts.com/itunes/itinfo/info01.php

ObjectiveC/Cocoa Screencapture/Crosshead mouse pointer selector help

I want to write a basic app so I can upload some images to my personal server and as the CMD+Shift+4 Screen capture method apple offers doesn't let you upload your images I thought I would start from scratch... I've looked around quite a lot on how to make something what lets me grab a selection of my screen (like the crosshair apple offer) and can't find any samples/pointers however I've seen other tools such as gyazo use the exact same capture system apple offer :S... Is it some sort of framework I can access in Xcode or something?
If anyone knows how its done I would be very grateful.
Thanks
Liam
You can just run screencapture(1) and capture to a temporary file location which your app then reads.

How to get iTunes playlist or entire library into program in Cocoa?

I'm wondering how to get the iTunes library into a mac application using Cocoa? I want the user to be able to choose a song from the iTunes library and then play that song. How would I do this?
You can use Karelia Software's iMedia Browser framework, which lets the user choose all sorts of things from the user's iLife libraries.
To play the song, you'll probably use NSSound.

simple record and play application!

I am trying to make a simple application which will store the sound said by user , say on click of record button and will play it back to him/her , say on click of play button.
Can anyone suggest me some appropriate way to do this ??
Thanks,
Miraaj
You can use QuickTime Kit's capture APIs to record a movie of the audio, and QTMovie (from the same framework) to convert it to a more conventional format for audio files and to play back both the intermediate file and the converted file.
There used to be a QuickTime Kit Programming Guide, but it didn't cover capturing and is now gone from developer.apple.com. You should file a bug against the docs.
This answer will work in a Cocoa (Mac) app. If you meant to ask about the iPhone, you should re-tag your question, as the solution will be completely different for a Cocoa app vs. a Cocoa Touch (iPhone) app.
I used direct sound to create an entire internet phone application a few years ago. Your question is far simpler, you won't have to deal with the circular buffer as critically. Direct sound is pretty main stream and you can find a lot of help with it in forums, and it's free!

Resources