I created a new service and set it up to receive no input and run in XCode as shown below. To install this code as a service I first started up Automator. ![]() com / xcode - open - file - in - current - tab - in - external - editor - macvim / set current_document_path to "" tell application " Xcode " set last_word_in_main_window to ( word - 1 of ( get name of window 1 )) if ( last_word_in_main_window is " Edited " ) then display notification " Please save the current document and try again " - eventually we could automatically save the document when this becomes annoying else set current_document to document 1 whose name ends with last_word_in_main_window set current_document_path to path of current_document end if end tell tell application " OmniGraffle Professional " if ( current_document_path is not "" ) then activate open current_document_path end if end tell return input end run AppleScript to open the current file in an external editor on run For completeness I’m including the code that I use over here: I changed the code to use OmniGraffle Professional instead of MacVim. This script opens the current file with an external editor. Opening in an external editorĪfter a little Googling I found an elegant AppleScript written by Milan Krystek. Whenever a file is created or saved, this rule will run a script that converts the OmniGraffle file into a PDF document. The second thing I did is create a rule in Hazel that monitors the directory in which I save OmniGraffle files. This service will launch OmniGraffle and open the file that’s being displayed (as XML) in the current XCode tab. Here’s the summary of what I did: I created a service that takes no input and only runs within XCode. I wanted to be able to view the diagram, and also launch OmniGraffle from within XCode. ![]() I’ve filed a bug report with Apple, asking them to fix this. However when I did that, instead of showing me what QuickLook would show me in the Finder, I saw the raw XML contents of the OmniGraffle file. I wanted to add an OmniGraffle file to my XCode project and have XCode display it when I click on it.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |