Last active
May 7, 2023 02:10
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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