{"id":26498758,"url":"https://github.com/jo-tools/applescript-automation","last_synced_at":"2025-03-20T14:39:57.300Z","repository":{"id":200205636,"uuid":"704924326","full_name":"jo-tools/applescript-automation","owner":"jo-tools","description":"Using AppleScript for Automation with Xojo","archived":false,"fork":false,"pushed_at":"2025-03-09T16:32:15.000Z","size":4768,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-09T17:25:27.198Z","etag":null,"topics":["applescript","automation","macos","xojo"],"latest_commit_sha":null,"homepage":"https://www.jo-tools.ch","language":"Xojo","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jo-tools.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":["https://paypal.me/jotools"]}},"created_at":"2023-10-14T14:19:23.000Z","updated_at":"2025-03-04T13:30:03.000Z","dependencies_parsed_at":"2023-10-16T04:07:59.637Z","dependency_job_id":"926de1d8-ee02-4397-9a98-0e691334557d","html_url":"https://github.com/jo-tools/applescript-automation","commit_stats":null,"previous_names":["jo-tools/applescript-automation"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jo-tools%2Fapplescript-automation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jo-tools%2Fapplescript-automation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jo-tools%2Fapplescript-automation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jo-tools%2Fapplescript-automation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jo-tools","download_url":"https://codeload.github.com/jo-tools/applescript-automation/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244631866,"owners_count":20484645,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["applescript","automation","macos","xojo"],"created_at":"2025-03-20T14:39:56.658Z","updated_at":"2025-03-20T14:39:57.294Z","avatar_url":"https://github.com/jo-tools.png","language":"Xojo","funding_links":["https://paypal.me/jotools"],"categories":[],"sub_categories":[],"readme":"# AppleScript-Automation\nXojo example project\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)\n\n## Description\nThere used to be a time where any application just could execute AppleScripts to Automate other applications such as: `tell application X to do Y`.  \nThat's no longer the case starting with `macOS 10.14`. It's become a bit trickier to do that with a Xojo built application, since not everything is built in.\n\nThis example project shows:\n- How to use AppleScript for Automation in a Xojo built application by providing an `Info.plist` with `NSAppleEventsUsageDescription`.  \n  *Without that, nothing will work at all.*\n- How to determine if the application has permission for AppleEvents / Automation (`AEDeterminePermissionToAutomateTarget`).\n- Explains how to deal with the permission results.\n- In case you determine the application has no permission:  \n  How to open System Preferences at Privacy - Automation *(so that the user can allow the app)*.\n\nAdditionally:\n- Check if an Application is running *(find .app by BundleIdentifier )*  \n  and if not: launch it.\n\n### ScreenShots\nAutomate `Terminal.app` by executing a Shell command in `Terminal.app`  \n![ScreenShot: AppleScript-Automation - Automate Terminal.app](screenshots/automate-terminal-app.png?raw=true)\n\nDetermine Permission to automate `Terminal.app`  \n![ScreenShot: AppleScript-Automation - Determine Permission to automate Terminal.app](screenshots/determine-permission.png?raw=true)\n\n\n## Xojo\n### Requirements\n[Xojo](https://www.xojo.com/) is a rapid application development for Desktop, Web, Mobile \u0026 Raspberry Pi.  \n\nThe Desktop application Xojo example project ```applescript-automation.xojo_project``` is using:\n- Xojo 2024r4.2\n- API 2\n\n### How to use in your own Xojo project?\n1. Drag the example `Info.plist` into your project.  \n   Edit it and change the `NSAppleEventsUsageDescription` to fit your app's purpose.\n2. To determine Automation-Permission and opening System Preferences at Privacy - Automation\n   - copy-and-paste the Module `modAppleScriptUtils` into your project.  \n\n   If you want to check for an .app running *(and launching it if required)* then additionally\n   - copy-and-paste the Module `modMacOsApplications` into your project.\n\n3. Use the provided Methods in the Modules in a similar way to this example project.\n4. [Codesign](https://github.com/jo-tools/xojo2dmg) *(with hardened Runtime)* and/or [Notarize](https://github.com/jo-tools/xojo2dmg) your application:  \n   Make sure to have the `Entitlement` enabled: `com.apple.security.automation.apple-events`\n   - set Xojo Build Settings: macOS -\u003e Sign\n   - or use [Xojo2DMG](https://github.com/jo-tools/xojo2dmg)\n\n\n## About\nJuerg Otter is a long term user of Xojo and working for [CM Informatik AG](https://cmiag.ch/). Their Application [CMI LehrerOffice](https://cmi-bildung.ch/) is a Xojo Design Award Winner 2018. In his leisure time Juerg provides some [bits and pieces for Xojo Developers](https://www.jo-tools.ch/).\n\n### Contact\n[![E-Mail](https://img.shields.io/static/v1?style=social\u0026label=E-Mail\u0026message=xojo@jo-tools.ch)](mailto:xojo@jo-tools.ch)\n\u0026emsp;\u0026emsp;\n[![Follow on Facebook](https://img.shields.io/static/v1?style=social\u0026logo=facebook\u0026label=Facebook\u0026message=juerg.otter)](https://www.facebook.com/juerg.otter)\n\u0026emsp;\u0026emsp;\n[![Follow on Twitter](https://img.shields.io/twitter/follow/juergotter?style=social)](https://twitter.com/juergotter)\n\n### Donation\nDo you like this project? Does it help you? Has it saved you time and money?  \nYou're welcome - it's free... If you want to say thanks I'd appreciate a [message](mailto:xojo@jo-tools.ch) or a small [donation via PayPal](https://paypal.me/jotools).  \n\n[![PayPal Dontation to jotools](https://img.shields.io/static/v1?style=social\u0026logo=paypal\u0026label=PayPal\u0026message=jotools)](https://paypal.me/jotools)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjo-tools%2Fapplescript-automation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjo-tools%2Fapplescript-automation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjo-tools%2Fapplescript-automation/lists"}