Skip to content

Instantly share code, notes, and snippets.

@zhangshine
Last active May 7, 2023 02:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhangshine/06295913414f60c4f0db9ab87db623fc to your computer and use it in GitHub Desktop.
Save zhangshine/06295913414f60c4f0db9ab87db623fc to your computer and use it in GitHub Desktop.
macOSX - Automator - Quick Action - Run AppleScript - To start a static server on folder and open it with the default browser
tell application "Finder"
set currentFolder to (folder of the front window) as alias
end tell
set posixPath to POSIX path of currentFolder
tell application "Terminal"
activate
do script "cd " & quoted form of posixPath & "; python3 -m http.server"
end tell
delay 1
set serverURL to "http://127.0.0.1:8000"
open location serverURL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment