Automation & Scripting

RSS for tag

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

Automation & Scripting Documentation

Posts under Automation & Scripting subtopic

Post

Replies

Boosts

Views

Activity

I want the "Folder" property of a folder not it's class.
I'm trying to set a boolean value to myVariable using the "Folder" property, but the Applescript editor keeps interpreting it as a class. Here is a shorted code. this is part of a bigger code to identify files dropped into a folder and create a new folder which it renames based on the date of the file that is dropped into the folder. Unfortunately, it keeps making folders every time it makes a new folder. Resalting in continuous loop of folders being created and renamed to "2025". The plan is to us an IF condition to prevent the creation of folders when a folder/s are dropped into my folder with my Folder Action. property directory : "Catalina:Users:Username:Desktop:Folder:File.pdf tell application "Finder" set pathname to POSIX path of directory set item_info to the info for directory set myVariable to Folder of item_info return myVariable end tell I noticed the following when I compile the script The color of the "Folder" is blue. I believe this means it's a class. Normally when I call a property, the color turns pink. it does it correctly when I use "set the file_name to the "name" of this_file". I also tried declaring the "Folder" property in brackets "Folder". did not help I noticed the following when I run the script: It returns ---error number -10004 "A privilege violation occurred. When it runs the "info for" command. I gave the Script Editor Full File access, Full Accessibility access and the FolderActionsDispatcher has full Finder access. Can anyone point me in the right direction! What is the cause of the privilege violation or how would I find what the cause is? How do I force the Script Editor to get the "Folder" property of a folder?
1
0
145
Jul ’25
Siri complains AppIntent is not registered
My question is similar to https://developer.apple.com/forums/thread/757298?answerId=791343022#791343022 but the solution from there did not help me. My app sends messages. I need it to do so when a user says to Siri: "Send message with ". When a user says so, Siri shows "Open button and says " hasn't added support for that with Siri". The code is pretty short and must work, but it doesn't. Could you please help and explain how to add the support mentioned above? How else I can use AppIntent and register the app as one capable to send messages when asked by Siri? import AppIntents @main struct MyAppNameApp: App { var body: some Scene { WindowGroup { ContentView() } } init() { MyAppNameShortcuts.updateAppShortcutParameters() Task { await MyAppNameShortcuts.updateAppShortcutParameters() } } } struct SendMessageWithMyAppName: AppIntent { static var title: LocalizedStringResource = "Send message" static let description = IntentDescription( "Dictate a message and have MyAppName print it to the Xcode console.") @Parameter(title: "Message", requestValueDialog: "What should I send?") var content: String static var openAppWhenRun = false func perform() async throws -> some IntentResult { print("MyAppName message: \(content)") await MainActor.run { NotificationCenter.default.post(name: .newMessageReceived, object: content) } return .result(dialog: "Message sent: \(content)") } } struct MyAppNameShortcuts: AppShortcutsProvider { static var appShortcuts: [AppShortcut] { AppShortcut( intent: SendMessageWithMyAppName(), phrases: [ "Send message with \(.applicationName)" ], shortTitle: "Send Message", systemImageName: "message" ) } }
1
0
64
Aug ’25
How to configure com.apple.security.scripting-targets in .entitlements file?
I use NSUserAppleScriptTask in my app to call Apple Script method to send Apple Events to Finder and System Events. The script has been deployed in the folder ~/Library/Application Scripts/{app bundle id}/ I have configured the com.apple.security.automation.apple-events in the .entitlements file, but how to configure com.apple.security.scripting-targets to meet the AppStore review requirements The existing official documentation is too incomplete to be of much use. If anyone has had similar experience, could you please share?
1
0
131
Aug ’25
INStartCallIntent requires unlock when device is face down with AirPods
When my Intents extension resolves an INStartCallIntent and returns .continueInApp while the device is locked, the call does not proceed unless the user unlocks the device. After unlocking, the app receives the NSUserActivity and CallKit proceeds normally. My expectation is that the native CallKit outgoing UI should appear and the call should start without requiring unlock — especially when using AirPods, where attention is not available. Steps to Reproduce Pair and connect AirPods. Lock the iPhone. Start music playback (e.g. Apple Music). Place the phone face down (or cover Face ID sensors so attention isn’t available). Say: “Hey Siri, call Tommy with DiscoMonday(My app name).” Observed Behavior Music mutes briefly. Siri says “Calling Tommy with DiscoMonday.” Lock screen shows “Require Face ID / passcode.” After several seconds, music resumes. The app is not launched, no NSUserActivity is delivered, and no CXStartCallAction occurs. With the phone face up, the same phrase launches the app, triggers CXStartCallAction, and the call proceeds via CallKit after faceID. Expected Behavior From the lock screen, Siri should hand off INStartCallIntent to the app, which immediately requests CXStartCallAction and drives the CallKit UI (reportOutgoingCall(...startedConnectingAt:) → ...connectedAt:), without requiring device unlock, regardless of orientation or attention availability when AirPods are connected.
1
0
122
2w
Can my users get siri to use my app without specifying the app name?
I have a food logging app. I want my users to be able to say something like: "Hey siri, log chicken and rice for lunch" But appshortcuts provider is forcing me to add the name of the app to the phrase so it becomes: "Hey siri, log chicken and rice for lunch in FoodLogApp". After running a quick survey, I've found that many users dislike having to say the name of the app, it makes it too cumbersome. My question is: Is there a plan from apple 2026 so the users can converse with Siri and apps more naturally without having to say the name of the app? If so, is it already in Beta and can you point me towards it? @available(iOS 17.0, *) struct LogMealIntent: AppIntent { static var title: LocalizedStringResource = "Log Meal" static var description: LocalizedStringResource = "Log a meal" func perform() async throws -> some IntentResult { return .result() } } @available(iOS 17.0, *) struct LogMealShortcutsProvider: AppShortcutsProvider { static var appShortcuts: [AppShortcut] { AppShortcut( intent: LogMealIntent(), phrases: [ "Log chicken and rice for lunch in \(.applicationName)", ], shortTitle: "Log meal", systemImageName: "mic.fill" ) } }
1
0
32
1w
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
512
Oct ’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
582
Oct ’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
491
Nov ’24
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
432
Dec ’24
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
435
Dec ’24
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
380
Dec ’24
AppleScript nd adobe indesign
I have a bunch of images sized 540px on the long side (some portrait, some landscape). The other side could be any size, but will be less than 540. There are no square images. I want to be able to choose a folder containing the images, and want the script to do the following for each image: Place it at the center of the current page of the active indesign document. Scrape the filename from the image (without the extension), apply the pre-existing Paragraph Style 'Caption' to the text, and center the text 36 points (not pixels) below the image. Group the image and the text. Then create a frame with white fill, 540x600 pixels in size, send it to back, center it with the group created above, and group them. I've been pulling my hair out. Just can't get it to work.
0
0
360
Jan ’25
Automation for message received
I would like to run an automation that sends a text message to my personal phone whenever my work phone receives a text message. In the “Message Contains” field of the message automation, an input is required. I put in a space, but that won’t work if someone sends me a one word text. Any suggestions?
0
0
278
Jan ’25
Dynamically creating and modifying shortcuts
I am needing to add/delete shortcuts in our app without using the Add to Siri button. But have been stymied at every turn. The most recent example is some code that uses an "AppShortcutCenter" call, supposedly added in iOS 17. But there is no such thing as that which I can find. What gives, and what's needed to do custom shortcuts on demand programmatically?
0
0
359
Jan ’25
Changing pad colour in Image Events
I'm trying to use Image Events instead of Photoshop to manipulate a bunch of images. I need to extend the canvas and have the padding be white. I've tried pad theImage to dimensions {545, 545} with pad color {65535, 65535, 65535} But that does nothing. If I remove the 'with pad colour...' part, it works but the pad defaults to black. I've looked everywhere, but there doesn't seem to be a solution. Is there one?
0
0
320
Feb ’25
AppleScript help
Hello everyone, I would like to use AppleScript to transform a .csv file. To make things easier to understand, I'm attaching two files: 1- The original file in csv format 2- The file as I'd like it to look after I've run it through the script. Here are the steps involved 1-Open the file in numbers (Note: the file is located in the download folder). 2-Delete the first 6 lines 3-Delete all font styles and cell colors 4-Combine all cells in the nature of operation column of the same operation belonging to the same date in the first cell of the operation, deleting all spaces in the text is not necessary for each operation. 5- Delete all empty lines. I hope I've made my request clear. If any of you have the knowledge to do this, if it can be done at all, I'd be very grateful for their help in writing the script. Thank you in advance. 1.csv 2.csv
0
0
373
Feb ’25
struggling with app automation
hi so im trying to create a simple app that has two pressable buttons that turn a spa mode on and off wishing another app so far I have the UI figured out the app works the only issue is right now when I press spa on I have setup so it opens Siri Shortcuts and enables the shortcut is there a way to make the app revert back to mine after the action is done? or is there another way to open the other app and navigate to the button within that app and enable it behind my app
0
0
306
Feb ’25
Auto Dial - 911
My app monitors users heart beats and if critical reading is noticed, it auto -dials 911 for emergency and ambulance help. I was under the impression that auto-dial may not be permitted or possible on the platform. Can anyone confirm and provide any additional guidance on if it is possible in the newer SDK/API stack or using any 3rd party service ? Thank you in advance!!
0
0
298
Feb ’25