from WikiPlugin import * from AppData import * def getName(): # # This is the name that appears on the 'plugin' menu. # It should be unique # return "Lesson 02 - Books" def getVendorName(): # # The name of the person who developed the plugin # return "Dogmelon" def getVendorVersionString(): # # A version string for this plugin # return "1.0" def getDescription(): # # A brief, helpful description of the plugin # return "Lesson 02 - Browse Note Studio Data and List All Books." def preExecute(): # # Do anything you need to do before running the plugin. # This could include popping up a dialog to collect parameters. # returns a list of parameters, which will be passed to the execute() method # STAGE_NAME = "preExecute" return [] def execute( parameterList ): # # Here is where you actually do the plugin tasks. # # If anything goes wrong, you can throw a WikiPluginException # as follows: # STAGE_NAME = "execute" bThrowException = False outputFile = open( "C:/lesson02.txt", "w" ) outputFile.write( "Lesson 02\n\n" ) numBooks = theAppData.library.getNumBooks() outputFile.write( "Number of Books: %d\n\n"%numBooks ) outputFile.write( "#, Book Name:\n" ) for i in range( numBooks ): book = theAppData.library.getBook( i ) bookName = book.getDisplayName() outputFile.write( "%d, '%s'\n"%(i, bookName) ) outputFile.close() if bThrowException: raise WikiPluginException( STAGE_NAME, "Some error string describing the problem" ) def postExecute(): # # Do anything you need to clean up after running the plugin. # STAGE_NAME = "postExecute" pass