I just started using BTT and I was wondering if anybody can show me a step-by-step on how to set up a gesture/keyboard shortcut to bring up the airdrop menu. Thank you for your help in advance!
Hi there,
Not if I fully understand your question.
To open Aidrop you can us Shift+Command+R and it brings up the Airdrop Window.
This short cut you can execute with BTT gesture.
I had it set to open a new finder window and in that open the airdrop feature.
Hope that helps.
I also don't really understand the question, but here is an AppleScript which:
- Check in the active Finder window if files are selected
- If nothing selected, then opens a choose file dialog for selection
- Then AirDrop will open when a selection is made
You can run the script in the Script Editor or as a BTT AppleScript Action.
set selectedItems to missing value
-- CHECK FINDER SELECTION
tell application "Finder"
if get selection ≠ {} then
set selectedItems to {}
repeat with s in (get selection)
set end of selectedItems to s as alias
end repeat
end if
end tell
-- CHOSSE FILE IF SELECTION IS NULL
if selectedItems is missing value then
set selectedItems to choose file with prompt "Select File(s) to send via AirDrop" with multiple selections allowed
end if
-- START AIRDROP IF SELECTION IS NOT NULL
if selectedItems ≠ missing value then
StartAirDrop(selectedItems)
end if
on StartAirDrop(inputItems)
script theScript
use framework "Foundation"
use framework "AppKit"
property NSSharingService : a reference to current application's NSSharingService
property NSArray : a reference to current application's NSArray
property NSString : a reference to current application's NSString
property NSRunLoop : a reference to current application's NSRunLoop
property NSDate : a reference to current application's NSDate
property NSURL : a reference to current application's NSURL
on StartAirDrop(inputItems)
-- CHECK INPUT
set itemsList to {}
if the class of inputItems is not list then
if (inputItems as string) begins with "~" then
set abbreviatedItemPath to NSString's stringWithString:inputItems
set posixFilePath to abbreviatedItemPath's stringByExpandingTildeInPath()
else
set posixFilePath to the POSIX path of inputItems
end if
set itemURL to NSURL's fileURLWithPath:posixFilePath
set the end of the itemsList to itemURL
else
repeat with i from 1 to the count of inputItems
set thisItem to item i of inputItems
if (thisItem as string) begins with "~" then
set abbreviatedItemPath to (NSString's stringWithString:thisItem)
set posixFilePath to abbreviatedItemPath's stringByExpandingTildeInPath()
else
set posixFilePath to the POSIX path of thisItem
end if
set thisItemURL to (NSURL's fileURLWithPath:posixFilePath)
set the end of the itemsList to thisItemURL
end repeat
end if
-- CREATE ARRAY AND SHOW AIRDROP
set the AirDropArrray to NSArray's arrayWithArray:itemsList
if current application's NSThread's isMainThread() then
my showAirDrop:(AirDropArrray)
else
its performSelectorOnMainThread:"showAirDrop:" withObject:(AirDropArrray) waitUntilDone:true
end if
end StartAirDrop
on showAirDrop:AirDropArrray
-- CREATE NEW SHARING SERVICE INSTANCE
set AirDropSharingService to ¬
NSSharingService's sharingServiceNamed:(current application's NSSharingServiceNameSendViaAirDrop)
-- CALL SHARING SERVICE
tell AirDropSharingService to performWithItems:AirDropArrray
-- work-around added to trigger Sharing frameworks
NSRunLoop's currentRunLoop's runUntilDate:(NSDate's |date|)
end showAirDrop:
end script
return theScript's StartAirDrop(inputItems)
end StartAirDrop