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

HMPresenceEvent-based predicate woes
I can't find a way to create an event trigger with a presence-based predicate ideally for a particular user at home; or at least, for all users at home. Just for the record, the rationale: I need to keep the heating on in the user's private room when he is at home, off when he is not. The idea is to have a trigger based on a low temperature event (I can do that and works all right), which would then check whether the user is at home through the predicate; if so, it would open the radiator valve (the action also tested and also working all right); if not, it would do nothing. How to? Since I could find no API to create an HMPresenceEvent for a particular user, I've set it up in the Home application, and tried to use it this way (I happen to have only one such at the moment in Home, so there's no need to check the attributes): HMPresenceEvent *pevent; for (HMEventTrigger *t in home.triggers) if ([t isKindOfClass:HMEventTrigger.class]) for (HMPresenceEvent *e in t.events) if ([e isKindOfClass:HMPresenceEvent.class]) { pevent=[e copy]; break; } NSPredicate *p=[HMEventTrigger predicateForEvaluatingTriggerWithPresence:pevent]; HMEventTrigger *et=[[HMEventTrigger alloc] initWithName:@"TEST PRESENCE" events:... endEvents:nil recurrences:nil predicate:p];alas, this raises the “NSInvalidArgumentException: Invalid parameter; (user info absent)” exception. Looks like copy loses this information somehow?!? Without appropriate public APIs one can't say :( (Since I can set up these events in the Home application freely with any kinds of action, it seems to be patently absurd not to open these APIs for privacy reasons, but that's another question, not for this ticket.) Anyway, I've tried to resort to checking for “all users at home” through pevent=[[HMPresenceEvent alloc] initWithPresenceEventType:HMPresenceEventTypeAtHome presenceUserType:HMPresenceEventUserTypeHomeUsers];where HMPresenceEventUserTypeHomeUsers is documented as “Presence of all home users”. Nevertheless, when I log out the result, I get just “any user“: [Presence-Event: type: HMPresenceTypeAnyUserAtHome, mode: HMPresenceEventActivationGranularityHome]That's unusable for me. I need to check for presence of all users (if checking for a particular one is really forbidden for some inexplicable reason). Please help. How to properly set up a trigger predicate for (ideally) a given specific HMUser, or at the very least, for a presence of all registered home users. Thanks!
0
0
61
1d
Moved from macOs 15.8.1 to 27.0.1 and now my osascript runs dog slow
Years ago I used the Last.fm website to keep track of the music I played. It was great because it kept track of music that I played from iTunes and when I connected my iPhone to my computer. The Last.fm software could determine which songs I played on my phone and the software would update the last.fm website. I don't using streaming sites because I don't believe in paying to rent music. I have all my music on my phone and I want to keep track of what I played each month and hence each year. When iTunes went away my iPhone was now mounted under Finder. The Last.fm software could no longer see what songs I played on my phone. So I looked into using osascript to read the Music app and write out each song to a flat file. I would do this after connecting my phone and after playing songs from Music (on the actual computer). I would then do a diff of the two database files to create a counts file. (This is a pretty brute force way of doing things. I get that.) The thing it it took less than 2 minutes to accomplish so I was satisfied with it. A typical flat file resulted over 20,000 lines. Now that I have moved to macOs 27 this is taking too long (less than 2 minutes to hours). So, could some one help and see how I could improve this script, I would appreciate it. Also, I am open with getting the songs I played another way if it is simpler. #!/usr/bin/osascript set p to "./" set a to POSIX file p set filepath to (a as «class utf8») & "out.txt" set openfile to open for access file filepath with write permission tell application "Music" set allTracks to tracks repeat with index from 1 to the count of allTracks set theTrack to item index of allTracks get {artist, album, name, played date, played count, time, media kind} of theTrack set theArtist to artist of theTrack if (theArtist is not "NPR" and theArtist is not "") and (theArtist is not "MusicRadar.com") then set theAlbum to album of theTrack if (theAlbum is not "KEXP Video of the Week") then set mediakind to media kind of theTrack if mediakind as text is "song" then set theArtist to my makePretty(theArtist) set theName to name of theTrack set lastPlayDate to played date of theTrack set thePlayCount to played count of theTrack set theTime to time of theTrack set theLine to theArtist & " -;- " & theAlbum & " -;- " & theName & " -;- " & lastPlayDate & " -;- " & thePlayCount & " -;- " & theTime write theLine & " " to openfile end if end if end if end repeat end tell close access openfile on makePretty(theArtist) set myName to theArtist if myName is "some artist" then set myName to "some new artist" end if return myName end makePretty
2
0
517
4d
App Sandbox and Apple Events - supported alternatives for Finder and Terminal integration?
Hi, I'm developing a sandboxed macOS application intended for distribution through the Mac App Store. During TestFlight review, a build was rejected because it included the com.apple.security.temporary-exception.apple-events entitlement for interacting with Finder and Terminal. The application only needs limited, user-initiated contextual information, such as the currently selected file or folder in Finder, or the working directory in Terminal. I'm trying to understand the recommended, App Store-compliant approach rather than relying on temporary sandbox exceptions. My questions are: Is there an officially supported way for a sandboxed app to retrieve Finder's current selection when triggered by a global keyboard shortcut, without Apple Events? Is accessing Terminal's current working directory supported under App Sandbox with explicit user consent? Are Finder Sync extensions, Accessibility APIs, macOS Services, or other frameworks recommended for these use cases? Are temporary Apple Events exceptions generally unsuitable for Mac App Store distribution, even when the interaction is explicitly initiated by the user? I've already removed the entitlement from the current build, but I'd appreciate clarification on the recommended architecture for this type of integration. Any guidance from Apple engineers or developers with similar experience would be appreciated. Thanks!
2
0
95
1w
https://apps.apple.com/app/id6815765181
A Shortcuts automation with the "When I get a notification" trigger does not run for every delivered notification. There is no error or indication that a run was skipped. Repro (iPhone 16 Pro, iOS 27.0.1 (24A446)) : Create a shortcut with the "When I get a notification" trigger for Instagram and turn on its automation. Add a single "Append to Note" action that appends the notification's Title, Body, and Date. From another device, send 10 numbered DMs within about 15 seconds. Result all 10 notifications appeared in Notification Center, but only 7 entries were appended to the note (#2, #4, #6 missing). My app relies on this trigger to save notification history, and users report missing notifications. Is this trigger expected to run for every delivered notification, or is it best-effort? If anyone else sees this, filing a duplicate referencing FB25255777 would help.
0
0
285
1w
Shortcuts Automation "Always Allow" Not Persisting for Wallet "After Payment" Trigger with App Intents
Hi,I'm developing an iOS app that uses App Intents to log Wallet payment transactions via Shortcuts automation with the "After Payment" trigger. The Issue: When users set up a Personal Automation with "Run Immediately" enabled and select "Always Allow" on the permission prompt, the permission does not persist. Every subsequent Wallet transaction triggers the "Allow Once / Always Allow" dialog again. Reproduction: App exposes an App Intent (LogWalletTransactionIntent) with openAppWhenRun = false User creates Personal Automation in Shortcuts app: Trigger: Wallet → After Payment Action: Log Wallet Transaction Set automation to "Run Immediately" First Wallet payment → permission prompt appears → user selects "Always Allow" Second Wallet payment → permission prompt appears again (expected: silent execution) Observations: When the user sets up the automation manually (adds the App Intent action inline and maps fields manually), "Always Allow" works correctly — no repeated prompts The issue occurs when the action is referenced via a pre-configured .shortcut file that has variable descriptors embedded for the parameters The bundled shortcut contains Descriptor mappings for card and merchant parameters Questions: Is this a known limitation of how iOS handles permission persistence for App Intents invoked through pre-configured shortcuts vs. inline automation actions? Does the distribution method affect this behavior — will Ad Hoc (alpha), TestFlight (beta), and App Store (production) builds behave differently regarding permission persistence? Is there a recommended approach for bundling pre-configured shortcuts that avoids repeated permission prompts? Environment: iOS 18.x (also observed on earlier versions) App Intent with String and Double parameters with default:` values openAppWhenRun = false Distribution: Ad Hoc via PGY Any insights would be appreciated. Thanks!
0
0
145
3w
Unexpected Shortcut Behavior
Heya devs 👋 I am hoping that you might help me with an issue I am having with a Shortcut I have created that's behaving unexpectedly. If you'd like, you can download the Copy Obsidian Link Shortcut to test yourself. Here's a screenshot of the Shortcut: The Shortcut should create an Obsidian Markdown external link when used as a Quick Action from the Finder, e.g., right-clicking on the file Caption - Creative.png in the subfolder PNGs/ and selecting Quick Actions → Create Obsidian Link should send [Caption - Creative.png](file:///Users/user/Documents/Writing-Workspace/PNGs/Caption%20-%20Creative.png) to the paste buffer Instead, [Caption - Creative](file:///Users/user/Library/Group%20Containers/group.com.apple.shortcuts/Temporary/com.apple.WorkflowKit.BackgroundShortcutRunner/Caption%20-%20Creative.txt) is copied. Please help me debug this issue! If you can think of a better place for me to ask this question, I'd be grateful for that even. I've asked on the Obsidian forum and Discord channel already, but haven't got any response.
1
0
167
3w
Clarification on iOS restrictions for call recording access, SMS/iMessage access and background voice activation
I’m looking for clarification on what iOS currently allows third-party apps to do in these areas: Siri integration and background voice activation: Can an iOS app implement a custom voice assistant that responds to a wake phrase such as “Hey Nowa” and performs app tasks through voice commands? Could it listen while the app is terminated or the iPhone is locked, similar to Siri? Call recordings: Is there a supported way for an iOS app to access recordings of phone calls made on the user’s iPhone and make them available within the app? I couldn’t find documentation for an API that provides access to these recordings. SMS access: Is there a supported way for an iOS app to access and fetch all SMS and iMessage conversations stored in the user’s Messages app, so they can be viewed within our app? As far as I understand, iOS may not allow these capabilities for third-party apps, but I’d appreciate clarification. If any are supported, could you please point me to the relevant Apple documentation?
3
0
901
Sep ’26
Error "Run Javascript on Active Safari Tab" fails when after shortcuts logic
I'v been using a shortcut from the iOS/ipadOS share sheet in safari for several months now successfully and tried to use/port it to macOS: The "Run Javascript on Active Safari Tab" (RJOACST) action fails on MacOS if logic based on native shortcut actions is executed before / in front of it. The same shortcut does work on iOS and iPadOS. Here's the shortcut: https://www.icloud.com/shortcuts/613fe9b4464c401380159eb8160eb485 The Error on macOS reads: ''' DEV Safari Recipee 2 JS Reminders N... Unable to Run JavaScript on Web Page Make sure Allow JavaScript from Apple Events is enabled in the Develop menu in Safari. The Develop menu can be enabled in the Advanced section of Safari's Preferences. ''' BUT: simpler shortcuts with just the RJOASF Javascscript (e.g. the default script) DO work on the same machine. All settings are correct. When refactoring the initial logic from shortcuts action into Javascript code and calling the RJOACST silently lets the shortcut die. Any lead/hint appreciated. I did try to retrieve the shortcuts input shortly before the RJOACST is executed. PS: The file Recipes.json contains a list of sites to scrape recipe ingredients from - find the example here: ''' { "deli-berlin.com": { "selectorType": "xpath", "selectorExpression": "//div[contains(@class,'wprm-recipe-ingredient-group')]/ul/li", "extractionType": "text", "joinArrayString": "\n", "cleanupRules": [], "sampleUrl": "https://deli-berlin.com/rezept-vegane-lasagne/", "cachedHtml": "", "baselineIngredientsText": "", "activeVariationId": "row", "variations": [], "snapshotNote": "", "lastTestStatus": "untested", "lastTestedDate": "", "lastTestError": "", "htmlUpdatedAt": "", "baselineUpdatedAt": "", "ruleConfigUpdatedAt": "", "history": [] }, "www.allrecipes.com": { "selectorType": "xpath", "selectorExpression": "//ul[contains(@class,'mntl-structured-ingredients__list')]/li", "extractionType": "text", "joinArrayString": "\n", "cleanupRules": [ { "find": "\n{2,}", "replace": "\n", "active": true, "phase": "beforeJoin" } ], "sampleUrl": "https://www.allrecipes.com/recipe/221361/traditional-sauerbraten/", "cachedHtml": "", "baselineIngredientsText": "", "activeVariationId": "row", "variations": [], "snapshotNote": "", "lastTestStatus": "untested", "lastTestedDate": "", "lastTestError": "", "htmlUpdatedAt": "", "baselineUpdatedAt": "", "ruleConfigUpdatedAt": "", "history": [] } } '''
0
0
433
Sep ’26
Is there any public way to create a pre-filled note in Notes.app from a third-party iOS app?
I'm building a cross-platform app (.NET MAUI) on ios with a feature that lets users send a block of text to their preferred note-taking app to save for later. This works fine via their documented x-callback-url schemes (e.g. bear://x-callback-url/create?text=...). I'd like to support Apple's own Notes app the same way, but I can't find a documented mechanism to do so. Questions: Is there a URL scheme for Notes.app that a third-party app can use to open it, and if so, does it support passing in content for a new note? Is there any officially supported way — App Intents, or otherwise — to create a new note with pre-filled text in Notes.app from another app? Does the new Notes domain under App Intents (iOS 18+) apply to Apple's own Notes app, or is it purely a schema that third-party note apps can adopt for themselves? If it does apply, is there a way to invoke it directly from another app's UI rather than only via Siri/Shortcuts? If none of the above exists, is routing through the standard share sheet the intended/only supported approach for this use case going forward? Thanks in advance — wanting to make sure I'm not missing a documented mechanism before concluding this isn't possible.
1
0
567
Sep ’26
App Shortcuts Action button default parameter
Hello, I have a question about App Intents and the Action button on iPhone. I have an App Intent that opens the app and navigates to a specific entity, conforming to OpenIntent with a single AppEntity parameter. The entity conforms to EnumerableEntityQuery, and the intent is registered as an App Shortcut via the AppShortcutsProvider. When assigning this shortcut to the Action button in Settings, the system doesn’t prompt the user to select a default entity upfront. Instead, it prompts on every activation, creating friction. In contrast, shortcuts like “Open Note…” and other third-party ones prompt the user for a note to open when setting up the Action button, and its title also includes three dots, indicating a pre-configurable parameter. My shortcut’s title shows no dots. What’s required to make an App Shortcut prompt for a default parameter during Action button setup? Sincerely, Holger
4
0
1.5k
Sep ’26
AppShortcutsProvider not detected by the Shortcuts app – app built entirely with Swift Playgrounds + TestFlight
Context I built an app entirely using Swift Playgrounds on iPad (no access to a Mac / Xcode). The app is distributed via TestFlight and installed on an iPhone. Problem I implemented an AppShortcutsProvider with simple AppShortcut entries (code below), but no shortcuts show up in the Shortcuts app, in the list of apps with shortcuts, or via Siri. What I've already tried without success: Full restart of the iPhone Deleting the app's data Fully uninstalling and reinstalling the app A new TestFlight build (with incremented build number) after adding the code Confirming the phrases correctly include (.applicationName) as required Question Is the Extract AppIntentsMetadata build step (which generates the metadata.appintents file) actually executed when compiling/submitting via Swift Playgrounds on iPad, or is this a known limitation of the tool that would prevent App Shortcuts from being indexed by Shortcuts/Siri? Environment Swift Playgrounds version: [check in the app under Settings > General > About] iOS version on test iPhone: [fill in] Project deployment target: [fill in if known, otherwise note that you have no way to check this without Xcode] Provider code: import SwiftUI import AppIntents // ============================================================ // MARK: - TEST INTENT // ============================================================ struct TestExpenseIntent: AppIntent { static let title: LocalizedStringResource = "Test dépense" static let description = IntentDescription( "Teste l'intégration de l'application avec Raccourcis." ) static let isDiscoverable = true func perform() async throws -> some IntentResult { return .result(dialog: "Ça fonctionne !") } } // ============================================================ // MARK: - ADD EXPENSE INTENT // ============================================================ struct AddApplePayExpenseIntent: AppIntent { static let title: LocalizedStringResource = "Ajouter une dépense" static let description = IntentDescription( "Ajoute une dépense à un Tricount." ) static let isDiscoverable = true static let openAppWhenRun = false @Parameter(title: "Montant") var amount: Double? @Parameter(title: "Marchand") var merchant: String? func perform() async throws -> some IntentResult { let valAmount = amount ?? 0.0 let valMerchant = merchant ?? "Inconnu" print("Montant :", valAmount) print("Marchand :", valMerchant) return .result( dialog: "Dépense de \(valAmount) € chez \(valMerchant)." ) } } // ============================================================ // MARK: - SHORTCUTS // ============================================================ struct MyAppShortcuts: AppShortcutsProvider { static var shortcutTileColor: ShortcutTileColor = .blue static let appShortcuts: [AppShortcut] = [ AppShortcut( intent: TestExpenseIntent(), phrases: [ "Tester \(.applicationName)" ], shortTitle: "Test dépense", systemImageName: "plus.circle" ), AppShortcut( intent: AddApplePayExpenseIntent(), phrases: [ "Ajouter une dépense dans \(.applicationName)", "Ajouter \(\.$amount) dans \(.applicationName)" ], shortTitle: "Ajouter une dépense", systemImageName: "plus.circle" ) ] }
1
0
485
Aug ’26
AppShortcutsProvider not detected by the Shortcuts app – app built entirely with Swift Playgrounds
Context I built an app entirely using Swift Playgrounds on iPad (no access to a Mac / Xcode). The app is distributed via TestFlight and installed on an iPhone. Problem I implemented an AppShortcutsProvider with simple AppShortcut entries (code below), but no shortcuts show up in the Shortcuts app, in the list of apps with shortcuts, or via Siri. What I've already tried without success: Full restart of the iPhone Deleting the app's data Fully uninstalling and reinstalling the app A new TestFlight build (with incremented build number) after adding the code Confirming the phrases correctly include (.applicationName) as required Question Is the Extract AppIntentsMetadata build step (which generates the metadata.appintents file) actually executed when compiling/submitting via Swift Playgrounds on iPad, or is this a known limitation of the tool that would prevent App Shortcuts from being indexed by Shortcuts/Siri? Provider code: import SwiftUI import AppIntents // ============================================================ // MARK: - TEST INTENT // ============================================================ struct TestExpenseIntent: AppIntent { static let title: LocalizedStringResource = "Test dépense" static let description = IntentDescription( "Teste l'intégration de l'application avec Raccourcis." ) static let isDiscoverable = true func perform() async throws -> some IntentResult { return .result(dialog: "Ça fonctionne !") } } // ============================================================ // MARK: - ADD EXPENSE INTENT // ============================================================ struct AddApplePayExpenseIntent: AppIntent { static let title: LocalizedStringResource = "Ajouter une dépense" static let description = IntentDescription( "Ajoute une dépense à un Tricount." ) static let isDiscoverable = true static let openAppWhenRun = false @Parameter(title: "Montant") var amount: Double? @Parameter(title: "Marchand") var merchant: String? func perform() async throws -> some IntentResult { let valAmount = amount ?? 0.0 let valMerchant = merchant ?? "Inconnu" print("Montant :", valAmount) print("Marchand :", valMerchant) return .result( dialog: "Dépense de \(valAmount) € chez \(valMerchant)." ) } } // ============================================================ // MARK: - SHORTCUTS // ============================================================ struct MyAppShortcuts: AppShortcutsProvider { static var shortcutTileColor: ShortcutTileColor = .blue static let appShortcuts: [AppShortcut] = [ AppShortcut( intent: TestExpenseIntent(), phrases: [ "Tester (.applicationName)" ], shortTitle: "Test dépense", systemImageName: "plus.circle" ), AppShortcut( intent: AddApplePayExpenseIntent(), phrases: [ "Ajouter une dépense dans (.applicationName)", "Ajouter (.$amount) dans (.applicationName)" ], shortTitle: "Ajouter une dépense", systemImageName: "plus.circle" ) ] }
0
0
431
Aug ’26
iOS 26.6: “When App Is Closed” automation fires when opening Control Center / Notification Center
After updating to iOS 26.6 I noticed a regression in Shortcuts automations. I created two simple automations: When App Is Opened → Show Notification “OPEN” When App Is Closed → Show Notification “CLOSE” Steps: Open Safari (or any app). Open Control Center or Notification Center. Actual result: “CLOSE” is triggered immediately. Dismissing Control Center or Notification Center does not trigger “OPEN”. Expected: Opening system overlays should not generate an App Closed event because the foreground application remains active. Device: iPhone 13 mini iOS: 26.6 Can anyone else reproduce this?
4
2
1k
Aug ’26
Can a Mac App Store app use an Apple Events temporary exception for Notes?
Hi all, I’m building a sandboxed macOS app that, among other things, lets the user create and associate an Apple Note with a calendar meeting. The user explicitly initiates the action. The app uses AppleScript to create the note, obtain its identifier, and open it in Notes. Notes only declares the com.apple.Notes.openlocation scripting access group. Note creation is not covered, so com.apple.security.scripting-targets does not appear sufficient. The working implementation requires: com.apple.security.automation.apple-events com.apple.security.temporary-exception.apple-events for com.apple.Notes NSAppleEventsUsageDescription Has anyone successfully shipped a Mac App Store app using this temporary exception to control the built-in Notes app? Is this potentially acceptable with a clear entitlement explanation and Feedback Assistant report, or should I assume that note creation through AppleScript cannot be included in a Mac App Store build? Is there another supported API that can create an Apple Note and return an identifier or openable URL for it?
3
0
911
Aug ’26
App not showing in "Share with App" action of shortcuts
I have created a share extension for my app which supports accepting an image. However the app do not appear in the "Share with App" action of shortcuts. It only shows "Health" and "Reminders" which are default apple apps. What I found though is that if I open some other app like Photos and share an image from it, then go to end of app's list and click more. And in the list if I toggle my app off and on again. And then come back to shourtcuts app, the app then appears. Step 1: Open share sheet, click more Step 2: Toggle the app off and on again and save. And then it switching to shortcuts app, it appear now. I am unable to find a way on how to make this app's share extension support the "Share with app" action of shortcuts by default. This looks like a bug. I did not find any proper documentation as well for this. Can anyone point me to correct way / resource to add my app as supported app here out of the box. Minimal reproducible example: ZIP file of xcode project
0
1
1.1k
Jul ’26
Move image into folder "year" and folder "month".
I made an apple script to move images into folders based on it's Year and Month. I use it to archive raw images when I'm done with it. Though it could help others out there. Using the "Folder Actions Setup". It will get the year and month of the file. Create a folder and set the filename to its year, then create another folder in the year folder and set the filename to it's month and move the file into it. property month_index : {"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"} on adding folder items to this_folder after receiving these_items #set this_year to the year of (current date) try tell application "Finder" repeat with i from 1 to number of items in these_items set this_item to item i of these_items as alias set item_type to the kind of this_item as string if item_type is not "Folder" then set file_date to the creation date of this_item set file_year to the year of file_date as string set j to the month of file_date as integer set file_month to item j of month_index as string set Done to my move_file(this_folder, file_year, file_month, this_item) else if item_type is "Folder" then exit repeat end if end repeat end tell on error error_message number error_number if error_number is not -128 then display dialog error_message & error_number buttons {"Cancel"} default button 1 giving up after 120 end if end try end adding folder items to on move_file(main_folder, year_foldername, month_foldername, this_item) try tell application "Finder" set year_folder to my create_folder(main_folder, year_foldername) set month_folder to my create_folder(year_folder, month_foldername) move this_item to the month_folder without replacing end tell on error error_message number error_number if error_number is -15267 then rename_file(month_folder, this_item) else if error_number is not -128 then display dialog error_message & " move file " & error_number buttons {"Cancel"} default button 1 giving up after 120 end if end try end move_file on create_folder(directory, foldername) try tell application "Finder" if not (exists folder foldername of directory) then make new folder of directory with properties {name:foldername} end if set the sub_folder to (folder foldername of directory) as alias return sub_folder end tell on error error_message number error_number if error_number is not -128 then display dialog error_message & " create_folder " & error_number buttons {"Cancel"} default button 1 giving up after 120 end if end try end create_folder on rename_file(sub_folder, this_item) try tell application "Finder" set increment to 1 set file_name to the name of this_item set file_extension to the name extension of this_item set old_file to the (file (name of this_item) of folder sub_folder) as alias repeat set trimmed_name to text 1 thru -((length of file_extension) + 2) of the file_name set new_name to (the trimmed_name & " " & (increment as string) & "." & file_extension) as string if not (exists document file new_name of the sub_folder) then set name of (document file file_name of sub_folder) to the new_name move document file this_item to the sub_folder exit repeat else set the increment to the increment + 1 end if end repeat end tell on error error_message number error_number if error_number is not -128 then display dialog error_message & " archive_file " & error_number buttons {"Cancel"} default button 1 giving up after 120 end if end try end rename_file
0
0
1.3k
Jun ’26
NSUserActivity-based Shortcuts Integration Not Working on iOS 18+
Previously, we used NSUserActivity to enable invoking specific in-app features from the Shortcuts app. This worked as expected up to iOS 17, but it no longer works on iOS 18 and later. We’ve confirmed that the same functionality can be achieved by using App Intents as an alternative. Question. Is the change in iOS 18—where NSUserActivity-based Shortcuts integration no longer works (or is restricted)—an intentional behavior change? If so, could you point us to any relevant documentation or release notes describing this change? We’ve tried to find information ourselves but haven’t found any clear references. Request. In cases like this where an OS update impacts existing implementations, it would be very helpful if such changes were clearly documented in release notes or API change logs in advance.
0
0
1.2k
Jun ’26
Shortcut caching
Hi! I used the shortcuts app to customize my iPhone with custom icons that I put through the launch app command in shortcuts. Now when I scroll they refresh every time and it's super annoying. How do I make them cache and not refresh just like normal icons? Thank you!
0
0
1.3k
Jun ’26
HMPresenceEvent-based predicate woes
I can't find a way to create an event trigger with a presence-based predicate ideally for a particular user at home; or at least, for all users at home. Just for the record, the rationale: I need to keep the heating on in the user's private room when he is at home, off when he is not. The idea is to have a trigger based on a low temperature event (I can do that and works all right), which would then check whether the user is at home through the predicate; if so, it would open the radiator valve (the action also tested and also working all right); if not, it would do nothing. How to? Since I could find no API to create an HMPresenceEvent for a particular user, I've set it up in the Home application, and tried to use it this way (I happen to have only one such at the moment in Home, so there's no need to check the attributes): HMPresenceEvent *pevent; for (HMEventTrigger *t in home.triggers) if ([t isKindOfClass:HMEventTrigger.class]) for (HMPresenceEvent *e in t.events) if ([e isKindOfClass:HMPresenceEvent.class]) { pevent=[e copy]; break; } NSPredicate *p=[HMEventTrigger predicateForEvaluatingTriggerWithPresence:pevent]; HMEventTrigger *et=[[HMEventTrigger alloc] initWithName:@"TEST PRESENCE" events:... endEvents:nil recurrences:nil predicate:p];alas, this raises the “NSInvalidArgumentException: Invalid parameter; (user info absent)” exception. Looks like copy loses this information somehow?!? Without appropriate public APIs one can't say :( (Since I can set up these events in the Home application freely with any kinds of action, it seems to be patently absurd not to open these APIs for privacy reasons, but that's another question, not for this ticket.) Anyway, I've tried to resort to checking for “all users at home” through pevent=[[HMPresenceEvent alloc] initWithPresenceEventType:HMPresenceEventTypeAtHome presenceUserType:HMPresenceEventUserTypeHomeUsers];where HMPresenceEventUserTypeHomeUsers is documented as “Presence of all home users”. Nevertheless, when I log out the result, I get just “any user“: [Presence-Event: type: HMPresenceTypeAnyUserAtHome, mode: HMPresenceEventActivationGranularityHome]That's unusable for me. I need to check for presence of all users (if checking for a particular one is really forbidden for some inexplicable reason). Please help. How to properly set up a trigger predicate for (ideally) a given specific HMUser, or at the very least, for a presence of all registered home users. Thanks!
Replies
0
Boosts
0
Views
61
Activity
1d
Moved from macOs 15.8.1 to 27.0.1 and now my osascript runs dog slow
Years ago I used the Last.fm website to keep track of the music I played. It was great because it kept track of music that I played from iTunes and when I connected my iPhone to my computer. The Last.fm software could determine which songs I played on my phone and the software would update the last.fm website. I don't using streaming sites because I don't believe in paying to rent music. I have all my music on my phone and I want to keep track of what I played each month and hence each year. When iTunes went away my iPhone was now mounted under Finder. The Last.fm software could no longer see what songs I played on my phone. So I looked into using osascript to read the Music app and write out each song to a flat file. I would do this after connecting my phone and after playing songs from Music (on the actual computer). I would then do a diff of the two database files to create a counts file. (This is a pretty brute force way of doing things. I get that.) The thing it it took less than 2 minutes to accomplish so I was satisfied with it. A typical flat file resulted over 20,000 lines. Now that I have moved to macOs 27 this is taking too long (less than 2 minutes to hours). So, could some one help and see how I could improve this script, I would appreciate it. Also, I am open with getting the songs I played another way if it is simpler. #!/usr/bin/osascript set p to "./" set a to POSIX file p set filepath to (a as «class utf8») & "out.txt" set openfile to open for access file filepath with write permission tell application "Music" set allTracks to tracks repeat with index from 1 to the count of allTracks set theTrack to item index of allTracks get {artist, album, name, played date, played count, time, media kind} of theTrack set theArtist to artist of theTrack if (theArtist is not "NPR" and theArtist is not "") and (theArtist is not "MusicRadar.com") then set theAlbum to album of theTrack if (theAlbum is not "KEXP Video of the Week") then set mediakind to media kind of theTrack if mediakind as text is "song" then set theArtist to my makePretty(theArtist) set theName to name of theTrack set lastPlayDate to played date of theTrack set thePlayCount to played count of theTrack set theTime to time of theTrack set theLine to theArtist & " -;- " & theAlbum & " -;- " & theName & " -;- " & lastPlayDate & " -;- " & thePlayCount & " -;- " & theTime write theLine & " " to openfile end if end if end if end repeat end tell close access openfile on makePretty(theArtist) set myName to theArtist if myName is "some artist" then set myName to "some new artist" end if return myName end makePretty
Replies
2
Boosts
0
Views
517
Activity
4d
App Sandbox and Apple Events - supported alternatives for Finder and Terminal integration?
Hi, I'm developing a sandboxed macOS application intended for distribution through the Mac App Store. During TestFlight review, a build was rejected because it included the com.apple.security.temporary-exception.apple-events entitlement for interacting with Finder and Terminal. The application only needs limited, user-initiated contextual information, such as the currently selected file or folder in Finder, or the working directory in Terminal. I'm trying to understand the recommended, App Store-compliant approach rather than relying on temporary sandbox exceptions. My questions are: Is there an officially supported way for a sandboxed app to retrieve Finder's current selection when triggered by a global keyboard shortcut, without Apple Events? Is accessing Terminal's current working directory supported under App Sandbox with explicit user consent? Are Finder Sync extensions, Accessibility APIs, macOS Services, or other frameworks recommended for these use cases? Are temporary Apple Events exceptions generally unsuitable for Mac App Store distribution, even when the interaction is explicitly initiated by the user? I've already removed the entitlement from the current build, but I'd appreciate clarification on the recommended architecture for this type of integration. Any guidance from Apple engineers or developers with similar experience would be appreciated. Thanks!
Replies
2
Boosts
0
Views
95
Activity
1w
https://apps.apple.com/app/id6815765181
A Shortcuts automation with the "When I get a notification" trigger does not run for every delivered notification. There is no error or indication that a run was skipped. Repro (iPhone 16 Pro, iOS 27.0.1 (24A446)) : Create a shortcut with the "When I get a notification" trigger for Instagram and turn on its automation. Add a single "Append to Note" action that appends the notification's Title, Body, and Date. From another device, send 10 numbered DMs within about 15 seconds. Result all 10 notifications appeared in Notification Center, but only 7 entries were appended to the note (#2, #4, #6 missing). My app relies on this trigger to save notification history, and users report missing notifications. Is this trigger expected to run for every delivered notification, or is it best-effort? If anyone else sees this, filing a duplicate referencing FB25255777 would help.
Replies
0
Boosts
0
Views
285
Activity
1w
Shortcuts Automation "Always Allow" Not Persisting for Wallet "After Payment" Trigger with App Intents
Hi,I'm developing an iOS app that uses App Intents to log Wallet payment transactions via Shortcuts automation with the "After Payment" trigger. The Issue: When users set up a Personal Automation with "Run Immediately" enabled and select "Always Allow" on the permission prompt, the permission does not persist. Every subsequent Wallet transaction triggers the "Allow Once / Always Allow" dialog again. Reproduction: App exposes an App Intent (LogWalletTransactionIntent) with openAppWhenRun = false User creates Personal Automation in Shortcuts app: Trigger: Wallet → After Payment Action: Log Wallet Transaction Set automation to "Run Immediately" First Wallet payment → permission prompt appears → user selects "Always Allow" Second Wallet payment → permission prompt appears again (expected: silent execution) Observations: When the user sets up the automation manually (adds the App Intent action inline and maps fields manually), "Always Allow" works correctly — no repeated prompts The issue occurs when the action is referenced via a pre-configured .shortcut file that has variable descriptors embedded for the parameters The bundled shortcut contains Descriptor mappings for card and merchant parameters Questions: Is this a known limitation of how iOS handles permission persistence for App Intents invoked through pre-configured shortcuts vs. inline automation actions? Does the distribution method affect this behavior — will Ad Hoc (alpha), TestFlight (beta), and App Store (production) builds behave differently regarding permission persistence? Is there a recommended approach for bundling pre-configured shortcuts that avoids repeated permission prompts? Environment: iOS 18.x (also observed on earlier versions) App Intent with String and Double parameters with default:` values openAppWhenRun = false Distribution: Ad Hoc via PGY Any insights would be appreciated. Thanks!
Replies
0
Boosts
0
Views
145
Activity
3w
Unexpected Shortcut Behavior
Heya devs 👋 I am hoping that you might help me with an issue I am having with a Shortcut I have created that's behaving unexpectedly. If you'd like, you can download the Copy Obsidian Link Shortcut to test yourself. Here's a screenshot of the Shortcut: The Shortcut should create an Obsidian Markdown external link when used as a Quick Action from the Finder, e.g., right-clicking on the file Caption - Creative.png in the subfolder PNGs/ and selecting Quick Actions → Create Obsidian Link should send [Caption - Creative.png](file:///Users/user/Documents/Writing-Workspace/PNGs/Caption%20-%20Creative.png) to the paste buffer Instead, [Caption - Creative](file:///Users/user/Library/Group%20Containers/group.com.apple.shortcuts/Temporary/com.apple.WorkflowKit.BackgroundShortcutRunner/Caption%20-%20Creative.txt) is copied. Please help me debug this issue! If you can think of a better place for me to ask this question, I'd be grateful for that even. I've asked on the Obsidian forum and Discord channel already, but haven't got any response.
Replies
1
Boosts
0
Views
167
Activity
3w
Clarification on iOS restrictions for call recording access, SMS/iMessage access and background voice activation
I’m looking for clarification on what iOS currently allows third-party apps to do in these areas: Siri integration and background voice activation: Can an iOS app implement a custom voice assistant that responds to a wake phrase such as “Hey Nowa” and performs app tasks through voice commands? Could it listen while the app is terminated or the iPhone is locked, similar to Siri? Call recordings: Is there a supported way for an iOS app to access recordings of phone calls made on the user’s iPhone and make them available within the app? I couldn’t find documentation for an API that provides access to these recordings. SMS access: Is there a supported way for an iOS app to access and fetch all SMS and iMessage conversations stored in the user’s Messages app, so they can be viewed within our app? As far as I understand, iOS may not allow these capabilities for third-party apps, but I’d appreciate clarification. If any are supported, could you please point me to the relevant Apple documentation?
Replies
3
Boosts
0
Views
901
Activity
Sep ’26
Error "Run Javascript on Active Safari Tab" fails when after shortcuts logic
I'v been using a shortcut from the iOS/ipadOS share sheet in safari for several months now successfully and tried to use/port it to macOS: The "Run Javascript on Active Safari Tab" (RJOACST) action fails on MacOS if logic based on native shortcut actions is executed before / in front of it. The same shortcut does work on iOS and iPadOS. Here's the shortcut: https://www.icloud.com/shortcuts/613fe9b4464c401380159eb8160eb485 The Error on macOS reads: ''' DEV Safari Recipee 2 JS Reminders N... Unable to Run JavaScript on Web Page Make sure Allow JavaScript from Apple Events is enabled in the Develop menu in Safari. The Develop menu can be enabled in the Advanced section of Safari's Preferences. ''' BUT: simpler shortcuts with just the RJOASF Javascscript (e.g. the default script) DO work on the same machine. All settings are correct. When refactoring the initial logic from shortcuts action into Javascript code and calling the RJOACST silently lets the shortcut die. Any lead/hint appreciated. I did try to retrieve the shortcuts input shortly before the RJOACST is executed. PS: The file Recipes.json contains a list of sites to scrape recipe ingredients from - find the example here: ''' { "deli-berlin.com": { "selectorType": "xpath", "selectorExpression": "//div[contains(@class,'wprm-recipe-ingredient-group')]/ul/li", "extractionType": "text", "joinArrayString": "\n", "cleanupRules": [], "sampleUrl": "https://deli-berlin.com/rezept-vegane-lasagne/", "cachedHtml": "", "baselineIngredientsText": "", "activeVariationId": "row", "variations": [], "snapshotNote": "", "lastTestStatus": "untested", "lastTestedDate": "", "lastTestError": "", "htmlUpdatedAt": "", "baselineUpdatedAt": "", "ruleConfigUpdatedAt": "", "history": [] }, "www.allrecipes.com": { "selectorType": "xpath", "selectorExpression": "//ul[contains(@class,'mntl-structured-ingredients__list')]/li", "extractionType": "text", "joinArrayString": "\n", "cleanupRules": [ { "find": "\n{2,}", "replace": "\n", "active": true, "phase": "beforeJoin" } ], "sampleUrl": "https://www.allrecipes.com/recipe/221361/traditional-sauerbraten/", "cachedHtml": "", "baselineIngredientsText": "", "activeVariationId": "row", "variations": [], "snapshotNote": "", "lastTestStatus": "untested", "lastTestedDate": "", "lastTestError": "", "htmlUpdatedAt": "", "baselineUpdatedAt": "", "ruleConfigUpdatedAt": "", "history": [] } } '''
Replies
0
Boosts
0
Views
433
Activity
Sep ’26
Is there any public way to create a pre-filled note in Notes.app from a third-party iOS app?
I'm building a cross-platform app (.NET MAUI) on ios with a feature that lets users send a block of text to their preferred note-taking app to save for later. This works fine via their documented x-callback-url schemes (e.g. bear://x-callback-url/create?text=...). I'd like to support Apple's own Notes app the same way, but I can't find a documented mechanism to do so. Questions: Is there a URL scheme for Notes.app that a third-party app can use to open it, and if so, does it support passing in content for a new note? Is there any officially supported way — App Intents, or otherwise — to create a new note with pre-filled text in Notes.app from another app? Does the new Notes domain under App Intents (iOS 18+) apply to Apple's own Notes app, or is it purely a schema that third-party note apps can adopt for themselves? If it does apply, is there a way to invoke it directly from another app's UI rather than only via Siri/Shortcuts? If none of the above exists, is routing through the standard share sheet the intended/only supported approach for this use case going forward? Thanks in advance — wanting to make sure I'm not missing a documented mechanism before concluding this isn't possible.
Replies
1
Boosts
0
Views
567
Activity
Sep ’26
App Shortcuts Action button default parameter
Hello, I have a question about App Intents and the Action button on iPhone. I have an App Intent that opens the app and navigates to a specific entity, conforming to OpenIntent with a single AppEntity parameter. The entity conforms to EnumerableEntityQuery, and the intent is registered as an App Shortcut via the AppShortcutsProvider. When assigning this shortcut to the Action button in Settings, the system doesn’t prompt the user to select a default entity upfront. Instead, it prompts on every activation, creating friction. In contrast, shortcuts like “Open Note…” and other third-party ones prompt the user for a note to open when setting up the Action button, and its title also includes three dots, indicating a pre-configurable parameter. My shortcut’s title shows no dots. What’s required to make an App Shortcut prompt for a default parameter during Action button setup? Sincerely, Holger
Replies
4
Boosts
0
Views
1.5k
Activity
Sep ’26
AppShortcutsProvider not detected by the Shortcuts app – app built entirely with Swift Playgrounds + TestFlight
Context I built an app entirely using Swift Playgrounds on iPad (no access to a Mac / Xcode). The app is distributed via TestFlight and installed on an iPhone. Problem I implemented an AppShortcutsProvider with simple AppShortcut entries (code below), but no shortcuts show up in the Shortcuts app, in the list of apps with shortcuts, or via Siri. What I've already tried without success: Full restart of the iPhone Deleting the app's data Fully uninstalling and reinstalling the app A new TestFlight build (with incremented build number) after adding the code Confirming the phrases correctly include (.applicationName) as required Question Is the Extract AppIntentsMetadata build step (which generates the metadata.appintents file) actually executed when compiling/submitting via Swift Playgrounds on iPad, or is this a known limitation of the tool that would prevent App Shortcuts from being indexed by Shortcuts/Siri? Environment Swift Playgrounds version: [check in the app under Settings > General > About] iOS version on test iPhone: [fill in] Project deployment target: [fill in if known, otherwise note that you have no way to check this without Xcode] Provider code: import SwiftUI import AppIntents // ============================================================ // MARK: - TEST INTENT // ============================================================ struct TestExpenseIntent: AppIntent { static let title: LocalizedStringResource = "Test dépense" static let description = IntentDescription( "Teste l'intégration de l'application avec Raccourcis." ) static let isDiscoverable = true func perform() async throws -> some IntentResult { return .result(dialog: "Ça fonctionne !") } } // ============================================================ // MARK: - ADD EXPENSE INTENT // ============================================================ struct AddApplePayExpenseIntent: AppIntent { static let title: LocalizedStringResource = "Ajouter une dépense" static let description = IntentDescription( "Ajoute une dépense à un Tricount." ) static let isDiscoverable = true static let openAppWhenRun = false @Parameter(title: "Montant") var amount: Double? @Parameter(title: "Marchand") var merchant: String? func perform() async throws -> some IntentResult { let valAmount = amount ?? 0.0 let valMerchant = merchant ?? "Inconnu" print("Montant :", valAmount) print("Marchand :", valMerchant) return .result( dialog: "Dépense de \(valAmount) € chez \(valMerchant)." ) } } // ============================================================ // MARK: - SHORTCUTS // ============================================================ struct MyAppShortcuts: AppShortcutsProvider { static var shortcutTileColor: ShortcutTileColor = .blue static let appShortcuts: [AppShortcut] = [ AppShortcut( intent: TestExpenseIntent(), phrases: [ "Tester \(.applicationName)" ], shortTitle: "Test dépense", systemImageName: "plus.circle" ), AppShortcut( intent: AddApplePayExpenseIntent(), phrases: [ "Ajouter une dépense dans \(.applicationName)", "Ajouter \(\.$amount) dans \(.applicationName)" ], shortTitle: "Ajouter une dépense", systemImageName: "plus.circle" ) ] }
Replies
1
Boosts
0
Views
485
Activity
Aug ’26
AppShortcutsProvider not detected by the Shortcuts app – app built entirely with Swift Playgrounds
Context I built an app entirely using Swift Playgrounds on iPad (no access to a Mac / Xcode). The app is distributed via TestFlight and installed on an iPhone. Problem I implemented an AppShortcutsProvider with simple AppShortcut entries (code below), but no shortcuts show up in the Shortcuts app, in the list of apps with shortcuts, or via Siri. What I've already tried without success: Full restart of the iPhone Deleting the app's data Fully uninstalling and reinstalling the app A new TestFlight build (with incremented build number) after adding the code Confirming the phrases correctly include (.applicationName) as required Question Is the Extract AppIntentsMetadata build step (which generates the metadata.appintents file) actually executed when compiling/submitting via Swift Playgrounds on iPad, or is this a known limitation of the tool that would prevent App Shortcuts from being indexed by Shortcuts/Siri? Provider code: import SwiftUI import AppIntents // ============================================================ // MARK: - TEST INTENT // ============================================================ struct TestExpenseIntent: AppIntent { static let title: LocalizedStringResource = "Test dépense" static let description = IntentDescription( "Teste l'intégration de l'application avec Raccourcis." ) static let isDiscoverable = true func perform() async throws -> some IntentResult { return .result(dialog: "Ça fonctionne !") } } // ============================================================ // MARK: - ADD EXPENSE INTENT // ============================================================ struct AddApplePayExpenseIntent: AppIntent { static let title: LocalizedStringResource = "Ajouter une dépense" static let description = IntentDescription( "Ajoute une dépense à un Tricount." ) static let isDiscoverable = true static let openAppWhenRun = false @Parameter(title: "Montant") var amount: Double? @Parameter(title: "Marchand") var merchant: String? func perform() async throws -> some IntentResult { let valAmount = amount ?? 0.0 let valMerchant = merchant ?? "Inconnu" print("Montant :", valAmount) print("Marchand :", valMerchant) return .result( dialog: "Dépense de \(valAmount) € chez \(valMerchant)." ) } } // ============================================================ // MARK: - SHORTCUTS // ============================================================ struct MyAppShortcuts: AppShortcutsProvider { static var shortcutTileColor: ShortcutTileColor = .blue static let appShortcuts: [AppShortcut] = [ AppShortcut( intent: TestExpenseIntent(), phrases: [ "Tester (.applicationName)" ], shortTitle: "Test dépense", systemImageName: "plus.circle" ), AppShortcut( intent: AddApplePayExpenseIntent(), phrases: [ "Ajouter une dépense dans (.applicationName)", "Ajouter (.$amount) dans (.applicationName)" ], shortTitle: "Ajouter une dépense", systemImageName: "plus.circle" ) ] }
Replies
0
Boosts
0
Views
431
Activity
Aug ’26
iOS 26.6: “When App Is Closed” automation fires when opening Control Center / Notification Center
After updating to iOS 26.6 I noticed a regression in Shortcuts automations. I created two simple automations: When App Is Opened → Show Notification “OPEN” When App Is Closed → Show Notification “CLOSE” Steps: Open Safari (or any app). Open Control Center or Notification Center. Actual result: “CLOSE” is triggered immediately. Dismissing Control Center or Notification Center does not trigger “OPEN”. Expected: Opening system overlays should not generate an App Closed event because the foreground application remains active. Device: iPhone 13 mini iOS: 26.6 Can anyone else reproduce this?
Replies
4
Boosts
2
Views
1k
Activity
Aug ’26
Can a Mac App Store app use an Apple Events temporary exception for Notes?
Hi all, I’m building a sandboxed macOS app that, among other things, lets the user create and associate an Apple Note with a calendar meeting. The user explicitly initiates the action. The app uses AppleScript to create the note, obtain its identifier, and open it in Notes. Notes only declares the com.apple.Notes.openlocation scripting access group. Note creation is not covered, so com.apple.security.scripting-targets does not appear sufficient. The working implementation requires: com.apple.security.automation.apple-events com.apple.security.temporary-exception.apple-events for com.apple.Notes NSAppleEventsUsageDescription Has anyone successfully shipped a Mac App Store app using this temporary exception to control the built-in Notes app? Is this potentially acceptable with a clear entitlement explanation and Feedback Assistant report, or should I assume that note creation through AppleScript cannot be included in a Mac App Store build? Is there another supported API that can create an Apple Note and return an identifier or openable URL for it?
Replies
3
Boosts
0
Views
911
Activity
Aug ’26
How. to save a file to a folder
I am new to Mac and. shortcuts. I am trying to. keep track of a date so that the shortcut knows the last time the shoiortcut was used. I tried using the action 'File' but having trouble figuring how to use it. Does a file need to be created first? Please. if anything point me where to find info. Thanks
Replies
0
Boosts
0
Views
764
Activity
Aug ’26
App not showing in "Share with App" action of shortcuts
I have created a share extension for my app which supports accepting an image. However the app do not appear in the "Share with App" action of shortcuts. It only shows "Health" and "Reminders" which are default apple apps. What I found though is that if I open some other app like Photos and share an image from it, then go to end of app's list and click more. And in the list if I toggle my app off and on again. And then come back to shourtcuts app, the app then appears. Step 1: Open share sheet, click more Step 2: Toggle the app off and on again and save. And then it switching to shortcuts app, it appear now. I am unable to find a way on how to make this app's share extension support the "Share with app" action of shortcuts by default. This looks like a bug. I did not find any proper documentation as well for this. Can anyone point me to correct way / resource to add my app as supported app here out of the box. Minimal reproducible example: ZIP file of xcode project
Replies
0
Boosts
1
Views
1.1k
Activity
Jul ’26
Move image into folder "year" and folder "month".
I made an apple script to move images into folders based on it's Year and Month. I use it to archive raw images when I'm done with it. Though it could help others out there. Using the "Folder Actions Setup". It will get the year and month of the file. Create a folder and set the filename to its year, then create another folder in the year folder and set the filename to it's month and move the file into it. property month_index : {"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"} on adding folder items to this_folder after receiving these_items #set this_year to the year of (current date) try tell application "Finder" repeat with i from 1 to number of items in these_items set this_item to item i of these_items as alias set item_type to the kind of this_item as string if item_type is not "Folder" then set file_date to the creation date of this_item set file_year to the year of file_date as string set j to the month of file_date as integer set file_month to item j of month_index as string set Done to my move_file(this_folder, file_year, file_month, this_item) else if item_type is "Folder" then exit repeat end if end repeat end tell on error error_message number error_number if error_number is not -128 then display dialog error_message & error_number buttons {"Cancel"} default button 1 giving up after 120 end if end try end adding folder items to on move_file(main_folder, year_foldername, month_foldername, this_item) try tell application "Finder" set year_folder to my create_folder(main_folder, year_foldername) set month_folder to my create_folder(year_folder, month_foldername) move this_item to the month_folder without replacing end tell on error error_message number error_number if error_number is -15267 then rename_file(month_folder, this_item) else if error_number is not -128 then display dialog error_message & " move file " & error_number buttons {"Cancel"} default button 1 giving up after 120 end if end try end move_file on create_folder(directory, foldername) try tell application "Finder" if not (exists folder foldername of directory) then make new folder of directory with properties {name:foldername} end if set the sub_folder to (folder foldername of directory) as alias return sub_folder end tell on error error_message number error_number if error_number is not -128 then display dialog error_message & " create_folder " & error_number buttons {"Cancel"} default button 1 giving up after 120 end if end try end create_folder on rename_file(sub_folder, this_item) try tell application "Finder" set increment to 1 set file_name to the name of this_item set file_extension to the name extension of this_item set old_file to the (file (name of this_item) of folder sub_folder) as alias repeat set trimmed_name to text 1 thru -((length of file_extension) + 2) of the file_name set new_name to (the trimmed_name & " " & (increment as string) & "." & file_extension) as string if not (exists document file new_name of the sub_folder) then set name of (document file file_name of sub_folder) to the new_name move document file this_item to the sub_folder exit repeat else set the increment to the increment + 1 end if end repeat end tell on error error_message number error_number if error_number is not -128 then display dialog error_message & " archive_file " & error_number buttons {"Cancel"} default button 1 giving up after 120 end if end try end rename_file
Replies
0
Boosts
0
Views
1.3k
Activity
Jun ’26
NSUserActivity-based Shortcuts Integration Not Working on iOS 18+
Previously, we used NSUserActivity to enable invoking specific in-app features from the Shortcuts app. This worked as expected up to iOS 17, but it no longer works on iOS 18 and later. We’ve confirmed that the same functionality can be achieved by using App Intents as an alternative. Question. Is the change in iOS 18—where NSUserActivity-based Shortcuts integration no longer works (or is restricted)—an intentional behavior change? If so, could you point us to any relevant documentation or release notes describing this change? We’ve tried to find information ourselves but haven’t found any clear references. Request. In cases like this where an OS update impacts existing implementations, it would be very helpful if such changes were clearly documented in release notes or API change logs in advance.
Replies
0
Boosts
0
Views
1.2k
Activity
Jun ’26
Shortcut caching
Hi! I used the shortcuts app to customize my iPhone with custom icons that I put through the launch app command in shortcuts. Now when I scroll they refresh every time and it's super annoying. How do I make them cache and not refresh just like normal icons? Thank you!
Replies
0
Boosts
0
Views
1.3k
Activity
Jun ’26