Automation & Scripting

RSS for tag

Learn about scripting languages and automation frameworks available on the platform to automate repetitive tasks.

Automation & Scripting Documentation

Post

Replies

Boosts

Views

Activity

Alarms- watch face widget no longer working properly.
Hello, since an update in September, the alarm widget on the watch face no longer counts down accurately like it used to. This is extremely frustrating for me because I used it for work so I have know exactly how much time I had in a particular circumstance. So for example, say I have an alarm set for 12:30. Before the update in September, I was able to look at my watch and know immediately that I had 24 minutes before the alarm, or look again and know it was the. 10 minutes before the alarm. Now, if I look at the watch face, it will say I have 24 minutes before the alarm, but it may actually only be 10 minutes before the alarm. I understand for some people this may be trivial, but it is really disappointing for me, and renders one of the most useful features of the Apple Watch useless to me now. I am hoping this is just an oversight during an update, so looking to see if this is something that is currently being worked on? I just installed beta 11.3 and still having the same issue. Now, if I press and hold on the watch face, like I’m going to change watch faces, then click out of it. It does update it. But it is not the same as it used to be. Thank you
2
0
17
4h
Apple Mail and Drag&Drop
I have been trying to accept drops from Apple Mail which do supply data with type identifiers : com.apple.mail.email The problem is that even though the drop says it does contain items for com.apple.mail.email it does provide the items for com.apple.mail.email. Mail dropped from Microsoft Outlook however confirms to the protocols and returns the items for com.apple.mail.email Is this a known issue with Apple Mail and is there are reason for what seems to be a non-compliance to it own standards in Apple Mail?
0
0
113
1w
ShortCuts: Send email with email address as a parameter
Hello everyone, I would like to dictate a text with Shortcuts and then send it to one of two e-mail addresses (private or business). I would like to be able to select one of two email addresses. Unfortunately, I am not able to pass an email address as a parameter to the Send email function. Is it possible to do this? I'm new to apple and I'm all but not a programmer. So take pity on me :) Best, Niko
0
0
119
2w
Batching CatalogSearchRequests for Spotify Playlist conversion
Hi! Im attempting to make a spotify to apple playlist converter and to do so am using the Catalog search functionality of the api. My question is, is there anyway to convert these songs to apple music urls (or ids) that does not spam api calls. I know you can batch catalog searches if you have apple music song ids, but I obviously dont have that since the song was shared from spotify. Any ideas/help is appreciated!
0
0
146
Dec ’24
Not authorized to send Apple events to Microsoft Excel
I have created swift command line project and i have added logic to executing apple script using NSAppleScript. That will launch Microsoft Excel file I am launching this swift command line executable from java using process launch. 3)This is not prompting me. It is throwing exception "Not authorized to send Apple events to Microsoft Excel." I have already tried out this option Added info.plist with NSAppleEventsUsageDescription Added entitlement with com.apple.security.automation.apple-events to true In packages i have selected this entitlement i have select the bundle identifier , team and signing certificate "Development" and automatically manage signing. can you please suggest what could i missed ?
1
0
261
Nov ’24
quit apps, launch apps from Calendar
trying to quit 2 apps and launch a 3rd. 3 individual Automator apps work by themselves fine. But can't get them to "open an app" from Calendar at a specified time. Tried building an Apple Script. Same issue. Here's the Automator app. ** tell application "Jellyfin Media Player" to quit delay 1 tell application "Jellyfin server 10.10.1" to quit delay 1 tell application "EmbyServer 4.8.10" to activate** any help on what I'm doing wrong? seems simple enough. Both Automator and Script Ed have "full disk access" and "Accessibility"
0
0
228
Nov ’24
Writing an app to help install DMGs/PKGs
Hi all I work in music production, the way the tools are set up is we use many tools (plugins) inside one larger app (a DAW), as such the process of setting up a machine to do work involves running 50-100+ different installers to get all tools installed. I'd like to write a small app that will automate the install process. I have a working approach for this where all steps work when run individually in terminal or via AppleScript, but as I create one unifying app I am running into an issue where any app I create in Xcode is not allowed to mount DMGs or give commands to terminal (even if I make a build app package and move it out of the Xcode directory, and even if I give explicit permission via settings) and if I try to have the app try to do the works via terminal it also can't seem to access terminal. I think there are some limitations I'm missing here. Any tips?
2
0
310
Nov ’24
macOS how to download previous versions
Hello, We are working on automating some processes for our mac virtual machines pool, and one of the things we are looking for is where we can download various different versions of macOS. When going to the download section of the apple dev portal, it only gives a download link of the latest macOS. Is there no way to obtain download URLs for previous macOS versions as well? For instance, we are trying to validate our automation scripts against Sonoma macOS so we are looking for the download URL , to put in our scripts , or to manually download the file ourselves. Thanks!
2
0
237
Nov ’24
Remotely Quit Remote Desktop
I often need to remotely control a Mac that has the Remote Desktop application running on it. Thus I need to create a script to kill it remotely. The following command gives me the process number (PID) on the remote machine when logged in via SSH. What I need to know is how to pass that number to kill -3 to quit it with one command, bad thing can happen if you make a typo on PID ps -ax | grep "Remote Desktop.app" | grep -v grep | awk '{print $1}'
0
0
281
Oct ’24
Missing "add transaction" shortcut
I keep seeing that there's a shortcut called "Add transaction" where whenever a card was tapped from apple wallet, you can add some automation. https://support.apple.com/en-au/guide/shortcuts/apd65c67538a/7.0/ios/17.0 However, I cannot for the life of me find this option on my iphone 13 ios 17.6.1 All I can find when I go to the shortcuts app and search for transactions or apple wallet, I get 2 options to send/receive payments which isn't what I'm looking for. Did apple remove this shortcut??
1
0
379
Oct ’24
Getting path of deleted item from Scripting Bridge SBObject in Swift
In the Swift function at the end of this post, I use Scripting Bridge to have Finder delete a path. The variable result is a SBObject returned by the delete() function. I know that result somehow contains the new path of the deleted item in the trash folder, but I don't know how to nicely extract it as a single String. If I print(String(describing: result)), I get output like: <SBObject @0x0123456789ab: <class 'appf'> "AppName.app" of <class 'cfol'> ".Trash" of <class 'cfol'> "user" of <class 'cfol'> "Users" of startupDisk of application "Finder" (822)> Is there any way to obtain the String "/Users/user/.Trash/AppName.app" from result without having to perform string parsing on the above output? The Finder* types in the code below are from https://github.com/tingraldi/SwiftScripting/blob/master/Frameworks/FinderScripting/FinderScripting/Finder.swift func trash(path: String) throws { guard let finder: FinderApplication = SBApplication(bundleIdentifier: "com.apple.finder") else { throw runtimeError("Failed to obtain Finder access: com.apple.finder does not exist") } guard let items = finder.items else { throw runtimeError("Failed to obtain Finder access: finder.items does not exist") } let object = items().object(atLocation: URL(fileURLWithPath: path)) guard let item = object as? FinderItem else { throw runtimeError( """ Failed to obtain Finder access: finder.items().object(atLocation: URL(fileURLWithPath: \ \"\(path)\") is a '\(type(of: object))' that does not conform to 'FinderItem' """ ) } guard let delete = item.delete else { throw runtimeError("Failed to obtain Finder access: FinderItem.delete does not exist") } let result = delete() }
2
0
368
Oct ’24
Stuck: Trying to Create Out of Office Shortcut
I want to create an Apple Shortcut that responds to text messages I receive while on vacation with an Out of the Office message. However, I want to exclude some people from getting this message, namely family and work colleagues. Does anyone know how to do this on iOS 18. I'm stuck on how to exclude contacts I don't want to send the message to. Does anyone know how to do this?
1
0
289
Oct ’24
Wallet "Open [Pass or Card]" Shortcut Input
Hello, There is a new shortcut recently in iOS shortcuts called "Open [Pass or Card]". It looks to take in a [Pass or Card] type, however I'd like to program it with a shortcut to dynamically select a card, and I noticed it works with strings, such as "BofA Customized Cash Rewards". Would there be a list of possible strings for supported cards and/or passes that I could pass in for this shortcut?
0
0
282
Oct ’24
AppleScript to Automate Envelope Printing
I have a VBScript routine to print envelopes by automating Word. This works just fine. Now I'm trying to do the same thing with AppleScript, also using the Word application. Here is what I have so far: set recipientAddress to text returned of (display dialog "Enter the recipient's address:" default answer "") -- Prompt for recipient city, state, and zip set recipientCityStateZip to text returned of (display dialog "Enter the recipient's city, state, and zip:" default answer "") -- Combine all address parts into a full address set fullAddress to recipientName &amp; return &amp; recipientAddress &amp; return &amp; recipientCityStateZip -- Create a new Word document and print the envelope set dialogResult to display dialog "To print envelope for:" &amp; return &amp; return &amp; recipientName &amp; return &amp; recipientAddress &amp; return &amp; recipientCityStateZip &amp; return &amp; return &amp; "Center envelope upside-down in printer with flap on left" &amp; return &amp; return &amp; "Continue?" buttons {"Yes", "No"} default button 2 with icon caution if button returned of dialogResult is "Yes" then tell application "Microsoft Word" set wdDoc to make new document -- Print the envelope with the collected recipient address and hard-coded return address -- wdDoc's print out envelope(address:fullAddress, returnAddress:returnAddress) -- Close the document without saving close wdDoc saving no end tell end if What does NOT work is the commented line near the end of the script which starts with -- wdDoc's print out envelope... Either I am doing it wrong, or Word for Mac can't be automated that way. Can anyone help with this script, or at least suggest a different method to print an envelope on demand? Thanks...
1
0
333
Oct ’24
Correctly using NSAppleScript for Mail.app plugin
Context I'm working on a Mail.app plugin. I would like to disseminate plugin via AppStore. I'm interested in exposing a functionality to user enabling user to choose if plugin should apply to all or selected email account. My intention is to use AppleScript to get a list of available email accounts and expose the list to the end-user via SwiftUI Sourcing account information Apple Script I'm using the following AppleScript tell application "Mail" set accountDict to {} repeat with acc in accounts set accName to name of acc set accEmails to email addresses of acc set accountDict's end to {accName:accEmails} end repeat return accountDict end tell The above generates expected results when executed using Script Editor. Swift Implementation This is still incomplete but shows the overall plan. // // EmailAccounts.swift import Foundation enum EmailScriptError: Error { case scriptExecutionError(String) } struct EmailAccounts { func getAccountNames() -&gt; [String]? { let appleScriptSource = """ tell application "Mail" set accountDict to {} repeat with acc in accounts set accName to name of acc set accEmails to email addresses of acc set accountDict's end to {accName:accEmails} end repeat return accountDict end tell """ var error: NSDictionary? var accountNames: [String] = [] // Create script object, exit if fails guard let scriptObject = NSAppleScript(source: appleScriptSource) else { return nil } // Execute script and store results, nil on error let scriptResult = scriptObject.executeAndReturnError(&amp;error) if error != nil { return nil } // Iterate over results for index in 0...scriptResult.numberOfItems { if let resultEntry = scriptResult.atIndex(index) { if let resultString = resultEntry.stringValue { // Process result handling // accountNames.append(resultString) } } } return accountNames } } Questions Most important one, can I deploy the App on the App Store and use NSAppleScript as shown above? If yes can I use the script in the manner shown above or will I need to store the script in User &gt; Library &gt; Application Scripts location and source it from there. This is outlined in the Scripting from a Sandbox article by Craig Hockenberry, which I cannot link due to being hosted within a not-permitted domain. If yes what entitlements I need to give to the target. I understand that I wouldn't be able to use ScriptingBridge, which feels more robust but wouldn't permit me to deploy the app on the AppStore. My key objective is to programatically identify mail accounts available to Mail.app, if there is a wiser / easier way of doing that I would be more than receptive.
2
0
439
Oct ’24