Troubleshooting/Local Files/MacChromeAutomator

From Jmol
Jump to navigation Jump to search

To start up MacOS Chrome so that JSmol runs from local files, there are two ways to avoid the terminal. You need some familiarity with the Apple Automator.

Open Automator. Choose Application. Select Utilities. Drag Run AppleScript to the Automator window. Copy/paste one of the following scripts into the resulting text window. Save the app to desktop.

It is most important that Chrome is closed when you do this. If Chrome is open, neither script will work properly.

Then, either double-click or drag-and-drop the htm file depending on the approach you selected.

Double-clickable App

on run {input, parameters}
do shell script "open -a /Applications/Google\\ --args --allow-file-access-from-files"
end run

Drag and drop App

on run {input, parameters}
tell application "Finder"
set filename to input as text
set filepath to POSIX path of filename
end tell
do shell script "open /Applications/Google\\ --args --allow-file-access-from-files file:///" & filepath
end run

Scripts provided by Otis Rothenberger