반응형
애플 스크립트 (AppleScript) 사용하여 AirDrop을 통제하는 방법은 아래와 같습니다.
#!/usr/bin/osascript
# Copyright (c) 2023 ChangYeop-Yang. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
on run parameters
set type to item 1 of parameters
if type is "SET" then
# AirDrop을 활성화 또는 비활성화 합니다.
set status to item 2 of parameters
do shell script "/usr/bin/defaults write com.apple.NetworkBrowser DisableAirDrop -bool " & status
else if type is "GET" then
# 현재 AirDrop 상태 여부를 확인합니다.
set result to do shell script "/usr/bin/defaults read com.apple.NetworkBrowser DisableAirDrop"
return result
end if
end run
🚀 REFERENCE
반응형
'# 애플 [Apple] > macOS' 카테고리의 다른 글
[🍎 macOS] 파일 공유 폴더 목록 가져오는 방법 (How to get list of shared folders) (0) | 2023.10.31 |
---|---|
[🍎 macOS] 터미널을 통한 파일 공유 (File Sharing) 설정 방법 (0) | 2023.10.23 |
[🍎 macOS] DistributedNotificationCenter (0) | 2023.08.30 |
[🍎 macOS] CFMessagePort (0) | 2023.05.16 |
[🍎 macOS] DispatchIO를 통하여 파일 읽기 또는 쓰기 작업 (0) | 2023.04.11 |
댓글