Post

Replies

Boosts

Views

Activity

Application "help" menu does not open main help book page
Following the official documentation, I'm trying to create a set of three localised Help Books. The Help Books should be available in Spanish, English and Polish. Presently, I'm trying to complete English version. App Structure This is the plugin application consisting of main app and the plugin. The main app structure would looks as follows: Files . <XcodeProject Top> ├── Localizable.xcstrings ├── MyAppExtension │   ├── MyAppExtension.swift │   └── <other swift files>.swift ├──MyApp │ ├── Info.plist │   ├── +Array.swift │   ├── +ButtonStyle.swift │   ├── <other app swift files>.swift ├── Resources     └── MyApp.help └── MyApp.help └── Contents ├── Info.plist └── Resources ├── English.lproj │   ├── ExactMatch.plist │   ├── InfoPlist.strings │   ├── MyApp.helpindex │   ├── MyApp.html │   └── pgs └── shrd MyApp / MyApp.help / Info.plist file Consists the following values: Bundle name: MyApp HPDBookAccessPath: MyApp.html HPDBookTitle: My App Help Default localization: en_gb MyApp / Info.plist file Contains the following entries: Help Book directory name: MyApp.help Help Book Identifier: MyApp Help Build phase The Copy Bundle Resources copies MyApp.help in MyApp/Resources. Questions Is the provided folder structure valid for creating a localised help books Is there anything that is missing from across Info.plist files or is in the wrong places? Why the MyApp -> Help opens the main help menu, not the app help
3
0
147
5d
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
372
Oct ’24