Created
July 19, 2023 19:35
-
-
Save CtrliPhones/272f523b2729be24800342ace872dde5 to your computer and use it in GitHub Desktop.
CotEditor Preview for HTML
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
(* | |
A kinda hacky preview for CotEditor when working with HTML. Requires that you save your file before opening, and only supports using Safari for the preview at this time. | |
Designed by CtrliPhones in Script Editor | |
*) | |
tell application "CotEditor" | |
set currentFile to file of front document | |
end tell | |
if currentFile is missing value then | |
tell application "CotEditor" to display alert "Save document" message "Please save this file to an accessible directory first." as warning | |
end if | |
set fileLocation to (currentFile's POSIX path) | |
set fullURL to "file://" & fileLocation | |
tell application "Safari" | |
open location fullURL | |
activate | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment