content: -- override library
  
  on overridetext(myLabel, myPage, myText)
  	tell application "Adobe InDesign CC 2017"
  		set myMasterItem to item 1 of (all page items of applied master of myPage) whose label is myLabel
  		
  		try
  			tell myMasterItem
  				set myItem to override destination page myPage
  			end tell
  		on error eStr number eNum partial result rList from badObj to expectedType
  			error "Couldn't override " & myLabel & ": " & eStr number eNum partial result rList from badObj to expectedType
  		end try
  		set contents of myItem to myText
  	end tell
  	return
  end overridetext
  
  on overridegraphic(myLabel, myPage, myFile)
  	tell application "Adobe InDesign CC 2017"
  		
  		set myMasterItem to item 1 of (all page items of applied master of myPage) whose label is myLabel
  		tell myMasterItem
  			set myItem to override destination page myPage
  		end tell
  		tell myItem to place file myFile
  		return
  	end tell
  end overridegraphic
  
  on override_graphic_if_exists(myLabel, myPage, myFile)
  	tell application "Adobe InDesign CC 2017"
  		set myMasterItems to (every item of all page items of applied master of myPage where label is myLabel)
  		
  		if ((count of myMasterItems) = 0) then
  			
  			--tell me to display notification "No items with label '" & myLabel & "' found." with title "Applescript"
  		else
  			set myMasterItem to item 1 of myMasterItems
  			
  			tell application "System Events"
  				set ItExists to exists file (myFile)
  			end tell
  			if ItExists then
  				
  				my overridegraphic(myLabel, myPage, myFile)
  				
  			else
  				tell me to display notification "File '" & myFile & "' not found." with title ((name of me))
  				
  			end if
  			
  			
  		end if
  		
  	end tell
  	
  end override_graphic_if_exists
  
  
  (*
  
  =head1 NAME
  
  <name> - <brief description>
  
  =head1 VERSION
  
  This documentation refers to version 0.003
  
  =head1 DESCRIPTION
  
  A full description of the module and its features.
  
  =head1 DIAGNOSTICS
  
  A list of every error and warning message that the application can
  generate (even the ones that will "never happen"), with a full
  explanation of each problem, one or more likely causes, and any
  suggested remedies. If the application generates exit status codes,
  then list the exit status associated with each error.
  
  =head1 CONFIGURATION AND ENVIRONMENT
  
  A full explanation of any configuration system(s) used by the
  application, including the names and locations of any configuration
  files, and the meaning of any environment variables or properties
  that can be se. These descriptions must also include details of any
  configuration language used.
  
  =head1 DEPENDENCIES
  
  List its dependencies.
  
  =head1 AUTHOR
  
  Aaron Priven <apriven@actransit.org>
  
  =head1 COPYRIGHT & LICENSE
  
  Copyright 2017
  
  This program is free software; you can redistribute it and/or
  modify it under the terms of either:
  
  =over 4
  
  =item * the GNU General Public License as published by the Free
  Software Foundation; either version 1, or (at your option) any
  later version, or
  
  =item * the Artistic License version 2.0.
  
  =back
  
  This program is distributed in the hope that it will be useful, but WITHOUT 
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
  FITNESS FOR A PARTICULAR PURPOSE.
  
  *)
  