Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
iPyNbViewer: Standalone App for IPython Notebook v2 (outdated; use v3 instead)
on open this_item
tell application "iTerm"
activate
set iPyNbViewer to (make new terminal)
tell iPyNbViewer
activate current session
launch session "Default Session"
tell the last session
set name to "IPython Notebook"
write text "ipython notebook " & (quoted form of POSIX path of this_item)
end tell
end tell
end tell
end open
on run
set choice to display dialog ("Shall we select a file or folder?") ¬
buttons {"Cancel", "File", "Folder"} with icon note ¬
cancel button 1 default button 2
if button returned of choice is "File" then
set ipynb to choose file
tell application "iTerm"
activate
set iPyNbViewer to (make new terminal)
tell iPyNbViewer
activate current session
launch session "Default Session"
tell the last session
set name to "IPython Notebook"
write text "ipython notebook " & (quoted form of POSIX path of ipynb)
end tell
end tell
end tell
else
set ipynbf to choose folder
tell application "iTerm"
activate
set iPyNbViewer to (make new terminal)
tell iPyNbViewer
activate current session
launch session "Default Session"
tell the last session
set name to "IPython Notebook"
write text "cd " & (quoted form of POSIX path of ipynbf)
write text "ipython notebook"
end tell
end tell
end tell
end if
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.