macOS 15/26にて、AirDropをAppleScriptから利用するAirSharing Libを、スクリプトメニューに入れたAppleScriptから呼び出せないという現象に直面しています。
スクリプトエディタ上で動かすと動作するのですが、スクリプトメニューから動かすとまったく動作しません。一般ユーザー向けのAppleScript実行環境であるスクリプトメニューで動作しないのはかなり問題です。
AirSharing LibはもともとSal Soghoianが書いたプログラムにWiFi制御系のコードを追加して書いたものですが、現状のmacOS 15上で動作する最低限の記述だとこんな感じ(↓)です。
スクリプトメニュー上で動作するために、何かの「おまじない」が必要なのか、そもそもスクリプトメニューの仕様上それが禁止されるようになったのか? なかなか不思議なところです。
動作確認できたAppleScript実行環境:
スクリプトエディタ、Script Debugger、Switch Control、Automator、Claris FileMaker Pro 2025、FastScript 3、Xojo 2025
AppleScript名:AirDropTest.scptd |
— – Created by: Takaaki Naganoya – Created on: 2025/09/23 — – Copyright © 2025 Piyomaru Software, All Rights Reserved — use AppleScript version "2.8" use framework "Foundation" use framework "AppKit" use scripting additions property airDropService : missing value set theFile to POSIX path of (choose file with prompt "AirDropで共有するファイルを選んでください:") my performSelectorOnMainThread:"shareWithAir:" withObject:(theFile) waitUntilDone:true –my shareWithAir:theFile–for debug on shareWithAir:thePOSIXFile set theFile to thePOSIXFile as string set fileURL to current application’s NSURL’s fileURLWithPath:(theFile) — AirDrop用の共有サービスを取得 set airDropService to current application’s NSSharingService’s sharingServiceNamed:(current application’s NSSharingServiceNameSendViaAirDrop) if airDropService ≠ missing value then airDropService’s performSelectorOnMainThread:"performWithItems:" withObject:{fileURL} waitUntilDone:true else display dialog "AirDrop共有サービスが利用できません。" buttons {"OK"} default button 1 end if end shareWithAir: |
(Visited 8 times, 8 visits today)