These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

 User Name Remember Me? Password
 FAQ Members List Calendar Search Today's Posts Mark Forums Read

 Any new applescript features? Thread Tools Search this Thread Display Modes
 stephenll Member 2014-01-09, 11:16 AM Hello, I would love to be able to replace my latex workflow with omnioutliner. I have outlines in latex littered with equations. While I could use latexit and link back to do this manually, I found that the zoom feature in 4.0 does not resize images that are in the outlines. I would like the ability to loop over all cells in the outline and take the latex code out of the notes field and insert the image of the equation into the parent cell. This way I can run it and automatically change the font size of the equations when I want to zoom in. I think the only piece that is missing is the ability to take image attachments on the hard drive into a outliner document via applescript. Can applescript do this in omnioutliner 4.0? Thanks. Stephen Post 1
 Carlos Member 2014-01-22, 10:48 PM Hi Stephen, I would be also very interested in a nice way to bring back latex equations into OO4! Previously this was possible with some script called oo3eq, which was broken at some point. There has been a thread with no real solution (http://forums.omnigroup.com/showthre...ighlight=latex). Post 2
 DerekM Omni 2014-01-23, 02:46 PM Sorry, there is not yet support for attachments in OO4's AppleScript. Post 3
 stephenll Member 2014-01-28, 08:46 AM Right now my current solution is using the outlines package in LaTeX with some fancy scripting in the sublime text editor to manipulate my outlines similar to the way you can promote demote and reorder the outlines in omnioutliner. I really want a way to better use equations in omnioutliner. I find latexit very fragile. It hangs all too often to be reliable. I have to take notes on thousands of pages with math in them and my career depends on me studying/using these notes. I think my ideal workflow would be to put the text representation of the equation in the notes section for a particular cell, then loop over all cells, see if there is an equation in the notes, render it as a picture, then place it in the cell. This way I can always be sure to have the equation as text if anything goes wrong. I haven't given up yet and I will be sure to post anything I come up with. Post 4
Quote:
 Originally Posted by stephenll I think the only piece that is missing is the ability to take image attachments on the hard drive into a outliner document via applescript. Can applescript do this in omnioutliner 4.0?
You bet! Try something like this:

Code:
-- Set this path to whatever you like
set MyPath to "/Applications/OmniOutliner.app/Contents/Resources/HelpImages/oo4mac_aboutbox.png"

tell application id "com.omnigroup.OmniOutliner4"
set MyDoc to (make new document with properties {writes wrapper:false})
make new row at end of rows of MyDoc
set MyRow to row 1 of MyDoc
set MyCell to cell 2 of MyRow

tell text of MyCell
make new file attachment with properties {file name:POSIX file MyPath, embedded:true} at before character 1
end tell
end tell
We've posted a new support article describing the AppleScript Changes in OmniOutliner 4.

 Carlos Member 2014-02-02, 12:01 PM Hi Ken, thanks for sharing that code! It is wonderful for pasting the attachment! I am trying follow the previous ideas and am parsing the content of a note and pass that content as command line argument to a python script (create_latex_pdf.py). This seems to work. The goal of the python script is to generate a pdf file which can then be used as an attachment in the cell of the selected row. Part 1: Applescript Code: set lstNote to {} tell application id "OOut" to set lstNote to note of selected rows of front document set strNote to lstNote as text tell application "Finder" to get folder of (path to me) as Unicode text set presentDir to POSIX path of result set py to "create_latex_pdf.py" set calldir to "python " & quoted form of presentDir & py & " " & strNote do shell script calldir When I do this, I get no error, a temp.ps file is created, but it has 0 bytes. Part 2: Python script See the python code below. When I run it from the terminal, it works and generates a pdf file as it should. However, when called from applescript I can't see what it is doing or where / why it stops. I'd appreciate pointers. Code: str_latex_note = sys.argv[1] preamble = """\documentclass{article} \usepackage{amsmath,amssymb} \pagestyle{empty} \\begin{document} {\huge $%s$ } \end{document}"""% (str_latex_note) cur_path = r'/Users/myfolder/Library/Scripts/OO_latex' cur_file = "temp.tex" fobj = open(os.path.join(cur_path, cur_file), 'w') fobj.writelines(preamble) os.chdir(cur_path) cmd = 'latex temp.tex' print cmd os.system(cmd) cmd2 = 'dvips -E -f -X 1200 -Y 1200 temp.dvi > temp.ps' os.system(cmd2) cmd3 = 'epstopdf temp.ps' os.system(cmd3) Post 6
 stephenll Member 2014-02-06, 03:54 PM I am learning applescript for the first time, so I am going slow. I did pick up on what I think one problem: I think you need to close the file after writing to it. Post 7
 Carlos Member 2014-02-12, 01:20 AM I hacked a version together, that works for me. It involves an applescript and a python script. Feel free to check it out here I'd be happy about feedback -- and thanks for the help on this forum! One thing: is there a more omni-like-way of calling scripts in omnioutliner (and not via quicksilver)? -- I remember that there used to be a toolbar icon for applescripts, but I can't seem to find this option anymore. Post 8
Quote:
 Originally Posted by Carlos I hacked a version together, that works for me.
Wonderful! Congrats!

Quote:
 One thing: is there a more omni-like-way of calling scripts in omnioutliner (and not via quicksilver)? -- I remember that there used to be a toolbar icon for applescripts, but I can't seem to find this option anymore.
We used to search several places, but sandboxing rules now limit us to a specific blessed folder which is based on our app id. (OmniOutliner isn't allowed to write from this folder, only to scan it and run scripts from it.)

If you're using a copy of OmniOutliner from our store, that blessed folder is:
~/Library/Application Scripts/com.omnigroup.OmniOutliner4
For the Mac App Store editions, try one of these paths (based on whether you purchased Pro using the in-app purchase or as your initial purchase):
~/Library/Application Scripts/com.omnigroup.OmniOutliner.MacAppStore
~/Library/Application Scripts/com.omnigroup.OmniOutlinerPro.MacAppStore
For a future update, I'd like to add a menu item somewhere that will automatically open this script folder in the Finder for you, so you don't have to find it yourself. (Sandboxing rules do allow apps to do that much.)

 stephenll Member 2014-02-13, 08:35 AM This works really well. I need to figure out how to convert to a format where the attachment will be in a compatible format to the iPad app. I don't think omnioutliner for iPad will render pdfs that are attached in line. Post 10

 Thread Tools Search this Thread Search this Thread: Advanced Search Display Modes Linear Mode

All times are GMT -8. The time now is 06:25 PM.

 -- Omni Style -- Lithographica Contact Us - The Omni Group Forums - Archive - Privacy Statement - Top