Keyboard shortcut in finder to launch >share via>airdrop
You can go to System prefrensces --> Keyboard --> Choose shortcuts from the menu above --> Choose "App shortcuts" from the side menu and click the + button. After that choose Finder and you will get a box with two text boxes.
Fill the first with exactly "AirDrop" (notice the A and D are capital) and fill the other box with the shortcut you wish the assign with this action and thats it.
This AppleScript code works for me using the latest version of macOS Mojave.
Here is a solution that may work for you. You can customize your Finder toolbar and add the “Share” Icon to the toolbar.
Next create a new Automator Quick Service document and add a new run AppleScript command to the workflow. Next, paste this following code into that new AppleScript command (overwriting the placeholder text)
tell application "Finder" to activate
tell application "System Events"
tell application process "Finder"
repeat until UI element "Share" of toolbar 1 of window 1 exists
delay 0.01
end repeat
click UI element "Share" of toolbar 1 of window 1
repeat until menu item "AirDrop" of menu 1 of UI element ¬
"Share" of toolbar 1 of window 1 exists
delay 0.01
end repeat
click menu item "AirDrop" of menu 1 of UI element ¬
"Share" of toolbar 1 of window 1
end tell
end tell
After you save and name your Automator Quick Action / Service document, you can assign it a keyboard shortcut in System Preferences.
Now with any file that you have selected in Finder, using your new keyboard shortcut will add that selected file to a new AirDrop pop-up window.
For reasons which I do not understand… in the AppleScript code after it clicks the “Share” Icon in the Finder toolbar, for some reason, there is about a 4 second lag before it clicks the “AirDrop” menu item. I've spent over an hour trying to figure out why there is a delay between the two commands… but to no avail. Maybe someone else can find a solution for that. Otherwise I think my solution accomplishes what you need.