mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	
		
			
	
	
		
			87 lines
		
	
	
	
		
			2.5 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
		
		
			
		
	
	
			87 lines
		
	
	
	
		
			2.5 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
|   | 
 | |||
|  | PythonScript | |||
|  | ------------ | |||
|  | v0.5 beta 1 24/04/98 | |||
|  | 
 | |||
|  | author: Bill Bedford, <billb@mousa.demon.co.uk> | |||
|  | 
 | |||
|  | This suite of modules is a first attempt at writing a more user friendly  | |||
|  | python/appleevent interface. The files in the suite are: | |||
|  | 
 | |||
|  | PythonScript | |||
|  | ------------ | |||
|  | 
 | |||
|  | Loads three dictionaries generated by getaete into __dict__'s of three  | |||
|  | classes and thus gives us direct assess to all the methods in the aete.   | |||
|  | Each method now contains all the information needed to build apple events. | |||
|  | 
 | |||
|  | The general usage is | |||
|  | 
 | |||
|  | >>>PythonScript.PsScript(SIGNATURE, TIMEOUT, IGNORING)  | |||
|  | 
 | |||
|  | where  | |||
|  | SIGNATURE is the target application | |||
|  | TIMEOUT is in ticks | |||
|  | and IGNORING is a boolean and determines whether the script waits for a reply  | |||
|  | from the target before going on to the next event  | |||
|  | 
 | |||
|  | >>>PythonScript.PyScript(Event, Object, keywdarg1..., keywdarg2...etc) | |||
|  | 
 | |||
|  | Object is a appleevent object specifier and is of the form | |||
|  | 
 | |||
|  | PythonScript.PsClass.Class1(arg).Class2(arg)<29>.Property() | |||
|  | 
 | |||
|  | All applescript event, class and property names are capitalised to  | |||
|  | distinguish them from python methods. | |||
|  | 
 | |||
|  | getaete | |||
|  | ------- | |||
|  | 
 | |||
|  | Reads the aete of the target application and returns it as a list of three  | |||
|  | dictionaries, which represent all the events, properties and enumeration in  | |||
|  | the aete.  (the fourth dictionary, comparisons, has never been implemented  | |||
|  | in applescript so I have not used it) It also reads the applescript aeut  | |||
|  | and adds any suites that are missing (ie where the application author has  | |||
|  | set his suite to inherit from the aeut.)  and the applescript suite, which  | |||
|  | gives the language methods | |||
|  | 
 | |||
|  | printaete | |||
|  | --------- | |||
|  | 
 | |||
|  | Produces a text file with the aete set out in a human readable form,  | |||
|  | similar to the Open Dictionary command in the applescript editor. | |||
|  | 
 | |||
|  | 
 | |||
|  | baetools, baepack, baetypes | |||
|  | --------------------------- | |||
|  | 
 | |||
|  | These are direct equivalents of aetools, aepack, aetypes in the standard  | |||
|  | distribution.  Some methods and classes have been enhanced others are  | |||
|  | redundant | |||
|  | 
 | |||
|  | PyScriptTest, testeudora | |||
|  | ------------------------ | |||
|  | 
 | |||
|  | A couple of test scripts.  Testeudora is an updated version of the one in  | |||
|  | the standard distribution. | |||
|  | 	  | |||
|  | 	  | |||
|  | 	  | |||
|  | 	  | |||
|  | 	  | |||
|  | Still To Do (in no particular order) | |||
|  | ----------- | |||
|  | 
 | |||
|  | These modules are much slower than applescript.  I believe they could be  | |||
|  | made faster by rewriting the aete parser in getaete and/or by putting in  | |||
|  | some form of persistent storage so that the class dictionaries can be cached. | |||
|  | 	  | |||
|  | The parsing of the appleevent replies need rewriting. | |||
|  | 
 | |||
|  | Support for the use of scripting additions. | |||
|  | 
 | |||
|  | A Python aeut needs to be written, much of the applescript one is redundant  | |||
|  | in python. | |||
|  | 
 | |||
|  | Probably a few other things I haven't thought of yet. |