Created
October 1, 2012 05:57
-
-
Save DinisCruz/3809710 to your computer and use it in GitHub Desktop.
O2Script - VisualStudio API - Example of GUI Scripting
This file contains hidden or 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
| //get a reference to the VisualStudio API | |
| var visualStudio = new VisualStudio_2010(); | |
| //write an Error and Warning messages to the 'Error List' VisualStudio Window | |
| visualStudio.errorList().add_Error("I'm an Error"); | |
| visualStudio.errorList().add_Warning("I'm an Warning"); | |
| //open a text file | |
| visualStudio.open_Document("a text file".saveWithExtension(".exe")); | |
| //open a C# file | |
| visualStudio.open_Document(@"VS_Scripts\O2_Platform_Gui.cs".local()); | |
| //open a WebBrowser | |
| visualStudio.open_WebBrowser(@"http://diniscruz.blogspot.co.uk/search/label/O2%20Platform"); | |
| //add a top Menu | |
| visualStudio.dte().add_TopMenu("A new Menu") | |
| .add_Menu_Button("Ask me a question", ()=> "Hi {0}".alert("What is your name?".askUser())); | |
| //change the main title | |
| visualStudio.mainWindow().title(visualStudio.mainWindow().title() + " - Now with REPL"); | |
| //change the status bar | |
| visualStudio.statusBar("C# script example complete"); | |
| //return the EnvDTE object | |
| return visualStudio.dte(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment