Hi everyone,
I'm looking for a way to programmatically set the left/right audio balance to perfect center (50/50) using either a Terminal command or AppleScript.
Background:
The audio balance slider in System Settings > Sound > Output & Input works functionally, but I have difficulty determining when it's positioned at the exact center point. The visual nature of the slider makes it challenging for me to achieve the precision I need, and I end up adjusting it repeatedly trying to get it perfectly centered.
What I'm looking for:
A Terminal command that can set the audio balance to exact center
An AppleScript that accomplishes the same thing
Any other programmatic method to ensure perfect 50/50 balance
I've tried searching through the defaults command documentation and Core Audio frameworks but haven't found the right approach yet. Has anyone successfully automated this setting before?
Any help would be greatly appreciated!
Thanks in advance,
Dylan
Automation & Scripting
RSS for tagLearn about scripting languages and automation frameworks available on the platform to automate repetitive tasks.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Issue: CSV Headings Not Appearing in Shortcut-Generated File
I'm using an iPhone 16 Pro with iOS 18.5 and the latest Shortcuts app to log expenses into a CSV file. The shortcut works fine, except the resulting file doesn't include the column headings.
Here’s what I’ve done:
Created a file called Expenses.csv with this single header line:
Date,Price,Category,Store,Notes,Location
Saved it to both /iCloud Drive and /iCloud Drive/Shortcuts (via iCloud on my Windows PC).
My Shortcut builds the CSV line from inputs (date, price, category, etc.) and appends it to the file.
I renamed the variables only in the final “Text” block, since renaming in earlier blocks seems no longer possible in this Shortcuts version.
Despite this setup, the file doesn’t preserve the header row—it either doesn’t show up, or gets overwritten.
Goal:
Have a persistent CSV file with the correct headers once, and each new entry appended below the correct columns.
Can anyone help me figure out what I’m doing wrong?
I'm soliciting you because I'm having a problem using the 3D short cut for my ios application in uikit in the AppDelegate file but it's impossible to redirect the route when the user has completely killed the application. It works as a background application. I'd like it to redirect to the searchPage search page when the application is fully closed and the user clicks on search with 3D touch.
final class AppDelegate: UIResponder, UIApplicationDelegate {
lazy var window: UIWindow? = {
return UIWindow(frame: UIScreen.main.bounds)
}()
private let appDependencyContainer = Container()
private let disposeBag = DisposeBag()
var pendingDeeplink: String?
private lazy var onboardingNavigationController: UINavigationController = {
let navigationController = UINavigationController(nibName: nil, bundle: nil)
navigationController.setNavigationBarHidden(true, animated: false)
return navigationController
}()
private func handleShortcutItem(_ shortcutItem: UIApplicationShortcutItem) {
guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
let window = windowScene.windows.first(where: { $0.isKeyWindow }),
let rootVC = window.rootViewController else {
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) { [weak self] in
self?.handleShortcutItem(shortcutItem)
}
return
}
if let presentedVC = rootVC.presentedViewController {
presentedVC.dismiss(animated: !UIAccessibility.isReduceMotionEnabled) { [weak self] in
self?.executeShortcutNavigation(shortcutItem)
}
} else {
executeShortcutNavigation(shortcutItem)
}
}
private func executeShortcutNavigation(_ shortcutItem: UIApplicationShortcutItem) {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { [weak self] in
guard let self = self else { return }
switch shortcutItem.type {
case ShortcutType.searchAction.rawValue:
self.mainRouter.drive(to: .searchPage(.show), origin: AppRoutingOrigin())
case ShortcutType.playAction.rawValue:
self.mainRouter.drive(to: .live(channel: Channel(), appTabOrigin: AppTabOrigin.navigation.rawValue), origin: AppRoutingOrigin())
case ShortcutType.myListHistoryAction.rawValue:
self.mainRouter.drive(to: .myList(.history), origin: AppRoutingOrigin())
default:
break
}
}
}
What I've tried:
Adding delays with DispatchQueue.main.asyncAfter
Checking for window availability and rootViewController
Dismissing presented view controllers before navigation
Environment:
iOS 15+
Swift 6
Using custom router system (mainRouter)
App supports both SwiftUI and UIKit
Questions:
What's the best practice for handling shortcuts on cold launch vs warm launch?
How can I ensure the router is properly initialized before navigation?
I would like to have an AppEntity with a Property that is a Date, which is only the date, not the time. ie the equivalent of 09/14/2025, not 09/14/2025 09:00 UTC
How would I model this? How would I create an EntityPropertyQuery for this? If I add QueryProperties they have the UI in Shortcuts pick a time too.
Thanks!
I want to offer the user the opportunity to add more stuff to a list in AppIntents, but nothing I've tried "loops back" to the first Siri query. Checked several LLMs and they are suggest using "requestDialog" which doesn't exist, and calling recursively my AppIntent.
Is this even possible?
I and many of my users observed the problem that the Shortcuts app seems to confuse and swap actions of different apps from the same developer. This happens after updating to iOS 26.
This breaks many Shortcuts. Deleting one of the apps or re-adding the actions sometimes seems to help.
Does anybody else observe this problem, or know how to handle this?
My phone turns or gets connected to Beats, Aipods max 2, and sometimes the Marshall Bluetooth device but it keeps triggering the automation for “When Connected To Bluetooth” - My Car
tried deleting and recreating the automation and it’s still buggy.
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
Scripting
Shortcuts
Core Bluetooth
Here's my AppleScript:
tell application "Finder"
activate
open application file "Messages.app" of folder "Applications" of folder "System" of startup disk
end tell
I just need the step to send the message making the script automatically send the message which has already been created. This step opens the completed iMessage ready to send . I want to send it without and keyboard usage. All that is needed is the step to send
Topic:
App & System Services
SubTopic:
Automation & Scripting
Is there a way to create a data roaming or cellular profile or shortcut so that we can turn data off for certain sets of apps when we travel (and turn them all back on when we're back)?
I am developing an app that allows the user to ask it to process the clipboard contents and do something with it.
In developing a XC UI Test, I find the app stops while it waits for the user to give permission. That breaks the automation.
I tried:
let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
let allowButton = springboard.buttons["Allow Paste"]
But that does not work. Is there a way to tell the framework to automatically give the test permission to access the Paste clipboard (or to allow me to write tests to grant this)?
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
Xcode
XCTest
Testing
Swift Testing
Hi,
I am developing a music app. We are using siri media search functionality for a while. We recently had a case where siri would not provide keyword for a search.
When user speaks "Play Kid songs" (in Turkish, çocuk şarkıları çal), when I debug I see mediaSearch.mediaName is nil.
When user speaks "Play Kids" (in Turkish, çocuklar çal) a keyword is given and we can search and play related song.
Normally I would think that siri is somehow censoring the word "Kid". But when i try the same voice search in Spotify, I get a children song search result.
I've read documentations and searched web but couldnt find any similar experience.
What would be the cause, is there an extra setting for this kind of behaviour. What would be the cause or a different capability that Spotify can get a keyword out of this voice search but not us?
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
Siri and Voice
SiriKit
App Intents
I have a script that stop working since Tahoe migration.
The script need to send a notification on the my mac.
The issue is this line:
osascript -e 'display notification "The task has been completed" with title "✅ My script"'
It doesn't fail (return 0), nothing in outputs, but doesn't show anything.
I check all my notification settings, but all seems to be right, I tested the configuration of iterm & script editor.
And the global ettongs of the notifications:
Hello?
Does anyone have a program to "Create Shortcuts" in Swift?
With:
Program Name:
Program Path:
Program Image:
Topic:
App & System Services
SubTopic:
Automation & Scripting
I have recently added a SetFocusFilterIntent target extension to my app which is a system utility which goes into the menu bar(Application is agent = YES). I have followed the approach in the WWDC22 video introducing Focus Intent and I have created an App Groups to being able to make the Extension to communicate with my main app, however from when I did this sometimes when I run the app I do get this log line:
Couldn't read values in CFPrefsPlistSource<0x97cd34700> (Domain: group.xxx.xxx.MyApp, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null), Contents Need Refresh: Yes): Using kCFPreferencesAnyUser with a container is only allowed for System Containers, detaching from cfprefsd
Despite this the Focus mode integration is working correctly on my development Mac. However I used to Archive the app and then Copy the app to my MacBook but when I do that now my other Mac cannot open the app and it is giving me an error. If I revert this change then I can bring the app back to my other Mac as usual following the procedure: Product -> Archive.
Then from the archiver: Distribute App -> Copy App. After that I copy the app generated to the App folder of my other MacBook but it doesn't open anymore.
During the archival phase now I am even getting this warning:
MyAppFocus.appex is an ExtensionKit extension and must be embedded in the parent app bundle's Extensions directory, but is embedded in the parent app bundle's ../../../BuildProductsPath/Release/MyApp.app/Contents/Extensions directory.
How can I solve this issue?
If I rollback the commit related to this SetFocusFilterIntent new feature the app can be Copied and moved to the other Mac as before.
Is this related to the extension or to the fact that I had to use this new entitlement: com.apple.security.application-groups ?
I am creating an AppIntent to be used with Shortcuts and I would like to return a flexible dictionary of values with nested structures. As far as I understand the custom AppEntity only uses the displayRepresentation to store a title and subtitle which are LocalizedStringResource. types. Although I can convert my dictionary into a string I found no way in shortcuts to be able to retrieve the original structure of it and inspect individual elements like in subsequent actions. Is there a way to do this?
Thank you in advance
Nick Karanatsios
当用户开启App自动更新后,自动更新App后,App有些功能会错乱。
1.有的会触发旧App代码功能,如旧版本有个选择框,在新版本选择框从界面移除了,但自动更新看,有的用户会还会触旧版本选择框的功能
2.数据错乱,如App录入数字6,发送到服务端变成5.4
现在发现这些问题。都是要把App删除,重新下载就可以。
请问要如何避免这样的问题。
App是有Objective-C,会不会与开启 BITCODE有关?
Topic:
App & System Services
SubTopic:
Automation & Scripting
When you correctly implement EntityPropertyQuery on an AppEntity, Shortcuts will expose a "Find Entity" action that calls into entities(matching:mode:sortedBy:limit:). This is demoed in the "Dive into App Intents" session and works as expected.
However, with this action, you can change the "All Entity" input to a list variable which changes the action text from "Find All Entity" to "Filter Entity where" still giving you the same filter, sort and limit options. This appears to work as expected too. But, what's unexpected is that this filter action does not appear to call any method on my AppEntity code. It doesn't call entities(matching:mode:sortedBy:limit:). One would think there would need to be a filter(entities:matching:mode:sortedBy:limit:) to implement this functionality. But Shortcut just seems to do it all on it's own. I'm mostly wondering, how is this even working?
Here's some example code:
import AppIntents
let books = [
BookEntity(id: 0, title: "A Family Affair"),
BookEntity(id: 1, title: "Atlas of the Heart"),
BookEntity(id: 2, title: "Atomic Habits"),
BookEntity(id: 3, title: "Memphis"),
BookEntity(id: 4, title: "Run Rose Run"),
BookEntity(id: 5, title: "The Maid"),
BookEntity(id: 6, title: "The Match"),
BookEntity(id: 7, title: "Where the Crawdads Sing"),
]
struct BookEntity: AppEntity, Identifiable {
static var typeDisplayRepresentation: TypeDisplayRepresentation = "Book"
var displayRepresentation: DisplayRepresentation { DisplayRepresentation(title: "\(title)") }
static var defaultQuery = BookQuery()
var id: Int
@Property(title: "Title")
var title: String
init(id: Int, title: String) {
self.id = id
self.title = title
}
}
struct BookQuery: EntityQuery {
func entities(for identifiers: [Int]) async throws -> [BookEntity] {
return identifiers.map { id in books[id] }
}
}
extension BookQuery: EntityPropertyQuery {
static var properties = QueryProperties {
Property(\BookEntity.$title) {
EqualToComparator { str in { book in book.title == str } }
ContainsComparator { str in { book in book.title.contains(str) } }
}
}
static var sortingOptions = SortingOptions {
SortableBy(\BookEntity.$title)
}
func entities(
matching comparators: [(BookEntity) -> Bool],
mode: ComparatorMode,
sortedBy: [Sort<BookEntity>],
limit: Int?
) async throws -> [BookEntity] {
books.filter { book in comparators.allSatisfy { comparator in comparator(book) } }
}
}
The example Shortcut first invokes entities(matching:mode:sortedBy:limit:) with comparators=[], sortedBy=[], limit=nil to fetch all Book entities. Next the filter step correctly applies the title contains filter but never calls entities(matching:mode:sortedBy:limit:) or even the body of the ContainsComparator. But the output is correctly filtered.
Hi, new to this forum.
Recently discovered how to share a location in Maps app with my Tesla to automatically start navigating. How cool is that!
Being the nerd that I am, I wrote a shortcut to select a contact and share it's address with my Tesla. That way, I don't leave the Maps app in memory to use up my battery, and don't have to go to all the trouble of swiping Maps out of memory. JK.
Anyway, when I share the shortcut-selected address with the Tesla, it says "Error this content could not be shared". To me this means the address as shared by the shortcut is not in the same format as when you share it directly from Maps.
So the question is, how can I send a properly formatted location from my shortcut?
Thanks...
I have:
an Automator workflow saved as an application "workflow.app"
an Apple Script saved as an application "script.app"
a PDF file residing on Desktop "test.pdf"
How do I launch workflow.app and pass test.pdf as the input for workflow from inside script.app?
Hi,
I am trying to make an app that uses Spotify's web API to play songs. For the web API to work, Spotify needs to be running, and my Mac has to be recognized as an active device. For my Mac to be recognized as an active device, I have to play a song for a very short amount of time (under a second).
I want to make my app automatically do that on launch. I already wrote the AppleScript in Automator, and it worked. It successfully launched Spotify, played a song for 0.5 seconds, then hid itself. After writing the code, I tried to implement it into my app to run on startup, but I ran into a problem. The app only started the Spotify app on my mac, and gave me an error that told me it wasn't running.
What do I do? Is this an issue with the permissions of the app, or something else? I have given the app the "Apple Events" entitlement.
This is the error I am getting. Note that the app opens Spotify, after which it gives me this.
Error: { NSAppleScriptErrorAppName = Spotify; NSAppleScriptErrorBriefMessage = "Application isn\U2019t running."; NSAppleScriptErrorMessage = "Spotify got an error: Application isn\U2019t running."; NSAppleScriptErrorNumber = "-600"; NSAppleScriptErrorRange = "NSRange: {31, 8}"; }
This is the function I am trying to use to do the actions with Spotify:
func runAppleScript() {
let appleScript = """
tell application "Spotify"
activate
if player state is not playing then
play track "spotify:track:5XSKC4d0y0DfcGbvDOiL93"
delay 1
pause
end if
end tell
tell application "System Events"
tell process "Spotify"
set frontmost to true
delay 1
keystroke "h" using {command down}
end tell
end tell
"""
var error: NSDictionary?
if let scriptObject = NSAppleScript(source: appleScript) {
scriptObject.executeAndReturnError(&error)
}
if let error = error {
print("Error: \(error)")
}
}
Any help is appreciated. Thank you in advance.
Topic:
App & System Services
SubTopic:
Automation & Scripting