create new document shortcut on mac

Опубликовано: 18 Май 2026
на канале: Asher's Club
66
2

Here is how to create an automation on mac to allow you to create a new document within the finder window, including dropbox etc.

Here is the script for you to copy and paste into the automation. Remove the old script before pasting:

on run {input, parameters}
tell application "Finder"
try
set sel to selection
if sel ≠ {} then
set targetFolder to item 1 of sel
if class of targetFolder is file then set targetFolder to (container of targetFolder)
else
set targetFolder to (target of front Finder window) as alias
end if
on error
set targetFolder to (path to desktop folder) as alias
end try
set newName to text returned of (display dialog "New document name" default answer "Untitled")
set newExt to text returned of (display dialog "Extension" default answer "txt")
set finalName to newName & "." & newExt
set newFile to make new file at targetFolder with properties {name:finalName}
open newFile
end tell
return input
end run

----------
To create a right-click (context menu) option in Finder on your MacBook Air that runs your AppleScript to create a new document “here” (including in Dropbox folders), and also optionally assign a keyboard shortcut, you can do the following:
1. Save your AppleScript as a Quick Action (formerly Service):
• Open the Automator app.
• Choose “Quick Action” as the document type.
• Set “Workflow receives” to “no input” in “Finder”.
• Add a “Run AppleScript” action and paste your script inside.
• Save it with a name like “Create Document Here”.
1. This Quick Action will automatically appear in Finder’s right-click context menu under “Quick Actions”.
2. To assign a keyboard shortcut:
• Open System Settings - Keyboard - Keyboard Shortcuts.
• Go to “Services” or “Quick Actions” section.
• Find your saved Quick Action “Create Document Here”.
• Assign a keyboard shortcut (e.g., Control+Option+Command+N).
Now, in Finder (and Dropbox Finder folders), you can right-click any file or folder or empty space, select your new “Create Document Here” action to run the AppleScript and create a new file at that location without manually opening Automator and pressing play.
This approach integrates AppleScript with Finder context menus and shortcuts seamlessly for your use case. You can further tweak your AppleScript for error handling or file extension defaults if desired.
This method is supported natively in macOS and is the recommended way to add custom scripts accessible by right-click and shortcuts in Finder, including within Dropbox folders that show as Finder windows.