mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Updated the applescript documentation for te new framework, and replaced the Eudora example with one that uses Disk Copy (which everyone running MacOS 8 or
higher should have).
This commit is contained in:
		
							parent
							
								
									e743c6e27e
								
							
						
					
					
						commit
						c15ab036df
					
				
					 9 changed files with 1250 additions and 961 deletions
				
			
		|  | @ -3,8 +3,7 @@ | ||||||
| <H1>Using Open Scripting Extension from Python</H1> | <H1>Using Open Scripting Extension from Python</H1> | ||||||
| <HR> | <HR> | ||||||
| 
 | 
 | ||||||
| OSA support in Python is still far from complete, and what | OSA support in Python is still not 100% complete, but | ||||||
| support there is is likely to change in the forseeable future. Still, |  | ||||||
| there is already enough in place to allow you to do some nifty things | there is already enough in place to allow you to do some nifty things | ||||||
| to other programs from your python program.  <P> | to other programs from your python program.  <P> | ||||||
| 
 | 
 | ||||||
|  | @ -20,11 +19,27 @@ <H1>Using Open Scripting Extension from Python</H1> | ||||||
| to concentrate on the OSA details we don't bother with a real | to concentrate on the OSA details we don't bother with a real | ||||||
| user-interface for our application. <p> | user-interface for our application. <p> | ||||||
| 
 | 
 | ||||||
| The application we are going to script is Eudora Light, a free mail | The application we are going to script is Disk Copy, Apple's standard | ||||||
| program from <A HREF="http://www.qualcomm.com">QualComm</A>. This is a | utility for making copies of floppies, creating files that are mountable | ||||||
| very versatile mail-reader, and QualComm has an accompanying | as disk images, etc. <p> | ||||||
| commercial version once your needs outgrow Eudora Light. Our program | 
 | ||||||
| will tell Eudora to send queued mail, retrieve mail or quit. <p> | <H2>Python OSA architecture</H2> | ||||||
|  | 
 | ||||||
|  | Open Scripting suites and inheritance can be modelled rather nicely with | ||||||
|  | with Python packages, so for each application we want to script we generate | ||||||
|  | a package. Each suite defined in the application becomes a module in the | ||||||
|  | package, and the package main module imports everything from all the | ||||||
|  | submodules and glues all the classes (Python terminology, OSA terminology is | ||||||
|  | events, AppleScript terminology is verbs) together. <p> | ||||||
|  | 
 | ||||||
|  | A suite in an OSA application can extend the functionality of a standard | ||||||
|  | suite, and this is implemented in Python by importing everything from the | ||||||
|  | module that implements the standard suite and overriding anything that has | ||||||
|  | been extended. The standard suites live in the StdSuite package. <p> | ||||||
|  | 
 | ||||||
|  | This all sounds complicated, and you can do strange and wondrous things | ||||||
|  | with it once you fully understand it, but the good news is that simple | ||||||
|  | scripting is actually pretty simple. <p> | ||||||
| 
 | 
 | ||||||
| <H2>Creating the Python interface module</H2> | <H2>Creating the Python interface module</H2> | ||||||
| 
 | 
 | ||||||
|  | @ -33,51 +48,60 @@ <H2>Creating the Python interface module</H2> | ||||||
| AppleScript dictionary. This tool is called | AppleScript dictionary. This tool is called | ||||||
| <CODE>gensuitemodule.py</CODE>, and lives in <CODE>Mac:scripts</CODE>. | <CODE>gensuitemodule.py</CODE>, and lives in <CODE>Mac:scripts</CODE>. | ||||||
| When we start it, it asks us for an input file and we point it to the | When we start it, it asks us for an input file and we point it to the | ||||||
| Eudora Light executable. It starts parsing the AETE resource, and for | Disk Copy executable. <p> | ||||||
|  | 
 | ||||||
|  | Next it wants a folder where it will store the package it is going to generate. | ||||||
|  | Note that this is the package folder, not the parent folder, so we | ||||||
|  | navigate to <code>Python:Mac:Demo:applescript</code>, create a folder | ||||||
|  | <code>Disk_Copy</code> and select that. <p> | ||||||
|  | 
 | ||||||
|  | Next it wants the folder from which it should import the standard suites. Here | ||||||
|  | you always select <code>Python:Mac:Lib:lib-scriptpackages</code>. (There is | ||||||
|  | one exception to this rule: when you are generating <code>StdSuites</code> itself | ||||||
|  | you select <code>cancel</code>, for obvious reasons). <p> | ||||||
|  | 
 | ||||||
|  | It starts parsing the AETE resource, and for | ||||||
| each AppleEvent suite it finds it prompts us for the filename of the | each AppleEvent suite it finds it prompts us for the filename of the | ||||||
| resulting python module. Remember to change folders for the first | resulting python module. Remember to change folders for the first | ||||||
| module, you don't want to clutter up the Eudora folder with your python | module, you don't want to clutter up the Eudora folder with your python | ||||||
| interfaces. If you want to skip a suite you press cancel and the process | interfaces. If you want to skip a suite you press cancel and the process | ||||||
| continues with the next suite. In the case of Eudora, you do | continues with the next suite. <p> | ||||||
| <EM>not</EM> want to generate the Required and Standard suites, because |  | ||||||
| they are identical to the standard ones which are pregenerated (and |  | ||||||
| empty in the eudora binary). AppleScript understands that an empty suite |  | ||||||
| means "incorporate the whole standard suite by this name", |  | ||||||
| gensuitemodule does not currently understand this. Creating the empty |  | ||||||
| <CODE>Required_Suite.py</CODE> would hide the correct module of that |  | ||||||
| name from our application. <p> |  | ||||||
| 
 | 
 | ||||||
| Gensuitemodule may ask you questions like "Where is enum 'xyz ' declared?". | Gensuitemodule may ask you questions like "Where is enum 'xyz ' declared?". | ||||||
| For the first time, cancel out of this dialog after taking down the | This is either due to a misunderstanding on my part or (rather too common) | ||||||
| enum (or class or prop) name. After you've created all the suites look | bugs in the AETE resources. Pressing <code>cancel</code> is usually the | ||||||
| for these codes, in the suites generated here and in the standard suites. | right option, it will cause the specific enum not to be treated as an enum | ||||||
| If you've found them all run gensuitemodule again and point it to the right | but as a "normal" type. As things like fsspecs and TEXT strings clearly are | ||||||
| file for each declaration. Gensuitemodule will generate the imports to make the | not enumerators this is correct. If someone understands what is really going on | ||||||
| reference work. <p> | here please let me know. <p> | ||||||
| 
 | 
 | ||||||
| <BLOCKQUOTE> | <BLOCKQUOTE> | ||||||
| Time for a sidebar. If you want to re-create | Time for a sidebar. If you want to re-create the StdSuite modules | ||||||
| <CODE>Required_Suite.py</CODE> or one of the other standard modules | you should look in one of two places. On older systems you will find the | ||||||
| you should look in <CODE>System Folder:Extensions:Scripting | AEUT resources in <CODE>System Folder:Extensions:Scripting | ||||||
| Additions:Dialects:English Dialect</CODE>, that is where the core | Additions:Dialects:English Dialect</CODE>. On newer systems you will | ||||||
| AppleEvent dictionaries live. Also, if you are looking for the | find them in <code>System Folder:Extensions:Applescript</code>. <p> | ||||||
| <CODE>Finder_Suite</CODE> interface: don't look in the finder (it has |  | ||||||
| an old System 7.0 scripting suite), look at the extension <CODE>Finder |  | ||||||
| Scripting Extension</CODE>. <p> |  | ||||||
| </BLOCKQUOTE> | </BLOCKQUOTE> | ||||||
| 
 | 
 | ||||||
| Let's glance at the <A | Let's glance at the <A | ||||||
| HREF="scripting/Eudora_Suite.py">Eudora_Suite.py</A> just created. You | HREF="applescript/Disk_Copy">Disk_Copy</A> package just created. You | ||||||
| may want to open Script Editor alongside, and have a look at how it | may want to open Script Editor alongside, and have a look at how it | ||||||
| interprets the dictionary. EudoraSuite.py starts with some | interprets the dictionary. The main package module is in <code>__init__.py</code> | ||||||
| boilerplate, then a big class definition with methods for each | and the only interesting bit is the <code>Disk_Copy</code> class, which | ||||||
| AppleScript Verb, then some small class definitions and then some dictionary | includes the event handling classes from the individual suites. It also | ||||||
| initializations. <p> | inherits <code>aetools.TalkTo</code>, which is a base class that handles all | ||||||
|  | details on how to start the program and talk to it, and a class variable | ||||||
|  | <code>_signature</code> which is the default application this class will talk | ||||||
|  | to (you can override this in various when you instantiate your class, see | ||||||
|  | <code>aetools.py</code> for details). | ||||||
|  |  <p> | ||||||
| 
 | 
 | ||||||
| The <CODE>Eudora_Suite</CODE> class is the bulk of the code | The <a href="applescript/Disk_Copy/Special_Events.py">Special_Events</a> | ||||||
|  | module is a nice example of a suite module. | ||||||
|  | The <CODE>Special_Events_Events</CODE> class is the bulk of the code | ||||||
| generated. For each verb it contains a method. Each method knows what | generated. For each verb it contains a method. Each method knows what | ||||||
| arguments the verb expects, and it makes handy use of the keyword | arguments the verb expects, and it makes handy use of keyword | ||||||
| argument scheme introduced in Python 1.3 to present a palatable | arguments to present a palatable | ||||||
| interface to the python programmer. You will see that each method | interface to the python programmer. You will see that each method | ||||||
| calls some routines from <CODE>aetools</CODE>, an auxiliary module | calls some routines from <CODE>aetools</CODE>, an auxiliary module | ||||||
| living in <CODE>Lib:toolbox</CODE> which contains some other nifty | living in <CODE>Lib:toolbox</CODE> which contains some other nifty | ||||||
|  | @ -85,9 +109,7 @@ <H2>Creating the Python interface module</H2> | ||||||
| course) no documentation yet. <p> | course) no documentation yet. <p> | ||||||
| 
 | 
 | ||||||
| The other thing you notice is that each method calls | The other thing you notice is that each method calls | ||||||
| <CODE>self.send</CODE>, but no such method is defined. You will have | <CODE>self.send</CODE>, this comes from the <code>aetools.TalkTo</code> baseclass. <p> | ||||||
| to provide it by subclassing or multiple inheritance, as we shall see |  | ||||||
| later. <p> |  | ||||||
| 
 | 
 | ||||||
| After the big class we get a number of little class declarations. These | After the big class we get a number of little class declarations. These | ||||||
| declarations are for the (appleevent) classes and properties in the suite. | declarations are for the (appleevent) classes and properties in the suite. | ||||||
|  | @ -95,7 +117,7 @@ <H2>Creating the Python interface module</H2> | ||||||
| For instance, to get the name of the sender of the first message in mailbox | For instance, to get the name of the sender of the first message in mailbox | ||||||
| inbox you would use <code>mailbox("inbox").message(1).sender</code>. It is | inbox you would use <code>mailbox("inbox").message(1).sender</code>. It is | ||||||
| also possible to specify this as <code>sender(message(1, mailbox("inbox")))</code>, | also possible to specify this as <code>sender(message(1, mailbox("inbox")))</code>, | ||||||
| which is sometimes needed because these classes don't inherit correctly | which is sometimes needed because these classes don't always inherit correctly | ||||||
| from baseclasses, so you may have to use a class or property from another suite. <p> | from baseclasses, so you may have to use a class or property from another suite. <p> | ||||||
| 
 | 
 | ||||||
| <blockquote> | <blockquote> | ||||||
|  | @ -112,11 +134,11 @@ <H2>Creating the Python interface module</H2> | ||||||
| english names as arguments to verbs, so you don't have to bother with the 4-letter | english names as arguments to verbs, so you don't have to bother with the 4-letter | ||||||
| type code. So, you can say | type code. So, you can say | ||||||
| <CODE><PRE> | <CODE><PRE> | ||||||
| 	eudora.notice(occurrence="mail_arrives") | 	diskcopy.create(..., filesystem="Mac OS Standard") | ||||||
| </PRE></CODE> | </PRE></CODE> | ||||||
| instead of the rather more cryptic | as it is called in Script Editor, in stead of the cryptic lowlevel | ||||||
| <CODE><PRE> | <CODE><PRE> | ||||||
| 	eudora.notice(occurrence="wArv") | 	diskcopy.create(..., filesystem="Fhfs") | ||||||
| </PRE></CODE><p> | </PRE></CODE><p> | ||||||
| 
 | 
 | ||||||
| Finally, we get the "table of contents" of the module, listing all classes and such | Finally, we get the "table of contents" of the module, listing all classes and such | ||||||
|  | @ -124,54 +146,25 @@ <H2>Creating the Python interface module</H2> | ||||||
| 
 | 
 | ||||||
| <H2>Using a Python suite module</H2> | <H2>Using a Python suite module</H2> | ||||||
| 
 | 
 | ||||||
| Now that we have created the suite module we can use it in an | Now that we have created the suite module we can use it in a Python script. | ||||||
| application. We do this by creating a class that inherits |  | ||||||
| <CODE>Eudora_Suite</CODE> and the <CODE>TalkTo</CODE> class from |  | ||||||
| <CODE>aetools</CODE>. The <CODE>TalkTo</CODE> class is basically a |  | ||||||
| container for the <CODE>send</CODE> method used by the methods from |  | ||||||
| the suite classes. <p> |  | ||||||
| 
 | 
 | ||||||
| Actually, our class will also inherit <CODE>Required_Suite</CODE>, | In older MacPython distributions this used to be a rather | ||||||
| because we also need functionality from that suite: the quit | complicated affair, but with the package scheme and with the application signature | ||||||
| command. Gensuitemodule could have created this completely derived | known by the package it is very simple: you import the package and instantiate | ||||||
| class for us, since it has access to all information needed to build | the class, as | ||||||
| the class but unfortunately it does not do so at the moment. All in |  | ||||||
| all, the heart of our program looks like this: |  | ||||||
| <CODE><PRE> | <CODE><PRE> | ||||||
| 	import Eudora_Suite, Required_Suite, aetools | 	talker = Disk_Copy.Disk_Copy(start=1) | ||||||
| 	 |  | ||||||
| 	class Eudora(Eudora_Suite.Eudora_Suite, Required_Suite.Required_Suite, \ |  | ||||||
| 				aetools.TalkTo): |  | ||||||
| 		pass |  | ||||||
| </PRE></CODE> | </PRE></CODE> | ||||||
| 
 | You will usually specify the start=1: it will run the application if it is | ||||||
| Yes, our class body is <CODE>pass</CODE>, all functionality is already | not already running. You may want to omit it if you want to talk to the application | ||||||
| provided by the base classes, the only thing we have to do is glue it | only if it is already running, or if the application is something like the Finder. <p> | ||||||
| together in the right way. <p> |  | ||||||
| 
 | 
 | ||||||
| Looking at the sourcefile <A | Looking at the sourcefile <A | ||||||
| HREF="scripting/testeudora.py">testeudora.py</A> we see that it starts | HREF="applescript/makedisk.py">makedisk.py</A> we see that it starts | ||||||
| with some imports. Then we get the class definition | with some imports.  | ||||||
| for our main object and a constant giving the signature of Eudora. <p> |  | ||||||
| 
 |  | ||||||
| This, again, needs a little explanation. There are various ways to |  | ||||||
| describe to AppleScript which program we want to talk to, but the |  | ||||||
| easiest one to use (from Python, at least) is creator |  | ||||||
| signature. Application name would be much nicer, but Python currently |  | ||||||
| does not have a module that interfaces to the Finder database (which |  | ||||||
| would allow us to map names to signatures). The other alternative, |  | ||||||
| <CODE>ChooseApplication</CODE> from the program-to-program toolbox, is |  | ||||||
| also not available from Python at the moment. <p> |  | ||||||
| 
 |  | ||||||
| If you specify the application by creator you can specify an optional |  | ||||||
| <CODE>start</CODE> parameter, which will cause the application to be |  | ||||||
| started if it is not running.  <P> |  | ||||||
| 
 | 
 | ||||||
| The main program itself is a wonder of simplicity. We create the | The main program itself is a wonder of simplicity. We create the | ||||||
| object that talks to Eudora (passing the signature as argument), ask | object that talks to Disk Copy, creates a disk and mounts it. <p> | ||||||
| the user what she wants and call the appropriate method of the talker |  | ||||||
| object. The use of keyword arguments with the same names as used by |  | ||||||
| AppleScript make passing the parameters a breeze. <p> |  | ||||||
| 
 | 
 | ||||||
| The exception handling does need a few comments, though. Since | The exception handling does need a few comments, though. Since | ||||||
| AppleScript is basically a connectionless RPC protocol nothing happens | AppleScript is basically a connectionless RPC protocol nothing happens | ||||||
|  | @ -188,8 +181,7 @@ <H2>Scripting Additions</H2> | ||||||
| everyday speech) from a Python program you can use the same method | everyday speech) from a Python program you can use the same method | ||||||
| as for applications, i.e. run <CODE>gensuitemodule</CODE> on the | as for applications, i.e. run <CODE>gensuitemodule</CODE> on the | ||||||
| OSAX (commonly found in <CODE>System Folder:Extensions:Scripting Additions</CODE> | OSAX (commonly found in <CODE>System Folder:Extensions:Scripting Additions</CODE> | ||||||
| or something similar), define a class which inherits the generated | or something similar). There is one minor gotcha: the application | ||||||
| class and <CODE>aetools.TalkTo</CODE> and instantiate it. The application |  | ||||||
| signature to use is <CODE>'MACS'</CODE>. <P> | signature to use is <CODE>'MACS'</CODE>. <P> | ||||||
| 
 | 
 | ||||||
| There are two minor points to watch out for when using gensuitemodule | There are two minor points to watch out for when using gensuitemodule | ||||||
|  | @ -199,11 +191,8 @@ <H2>Scripting Additions</H2> | ||||||
| (some of the non-english dialects cause gensuitemodule to generate incorrect | (some of the non-english dialects cause gensuitemodule to generate incorrect | ||||||
| Python code). <P> | Python code). <P> | ||||||
| 
 | 
 | ||||||
| That concludes our simple example. Again, let me emphasize that | <H2>Further Reading</H2> | ||||||
| scripting support in Python is not very complete at the moment, and | 
 | ||||||
| the details of how to use AppleEvents will definitely change in the | If you want to look at more involved examples of applescripting look at the standard | ||||||
| near future. This will not only fix all the ideosyncracies noted in | modules <code>findertools</code> and <code>nsremote</code>, or (possibly better, as it | ||||||
| this document but also break existing programs, since the current | is more involved) <code>fullbuild</code> from the Mac:scripts folder. | ||||||
| suite organization will have to change to fix some of the problems. |  | ||||||
| Still, if you want to experiment with AppleEvents right now: go ahead! |  | ||||||
| <p> |  | ||||||
|  |  | ||||||
							
								
								
									
										424
									
								
								Mac/Demo/applescript/Disk_Copy/Special_Events.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										424
									
								
								Mac/Demo/applescript/Disk_Copy/Special_Events.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,424 @@ | ||||||
|  | """Suite Special Events: Commands for mounting Disk Copy images | ||||||
|  | Level 1, version 1 | ||||||
|  | 
 | ||||||
|  | Generated from Macintosh HD:Hulpprogramma's:Disk Copy | ||||||
|  | AETE/AEUT resource version 1/0, language 0, script 0 | ||||||
|  | """ | ||||||
|  | 
 | ||||||
|  | import aetools | ||||||
|  | import MacOS | ||||||
|  | 
 | ||||||
|  | _code = 'ddsk' | ||||||
|  | 
 | ||||||
|  | class Special_Events_Events: | ||||||
|  | 
 | ||||||
|  | 	_argmap_mount = { | ||||||
|  | 		'access_mode' : 'Acss', | ||||||
|  | 		'checksum_verification' : 'VChk', | ||||||
|  | 		'signature_verification' : 'VSig', | ||||||
|  | 		'RAM_caching' : 'Cach', | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	def mount(self, _object, _attributes={}, **_arguments): | ||||||
|  | 		"""mount: Mounts an Disk Copy image as a disk volume | ||||||
|  | 		Required argument: a reference to the disk image to be mounted | ||||||
|  | 		Keyword argument access_mode: the access mode for mounted volume (default is "any", i.e. best possible) | ||||||
|  | 		Keyword argument checksum_verification: Verify the checksum before mounting? | ||||||
|  | 		Keyword argument signature_verification: Verify the DigiSign<EFBFBD> signature before mounting? | ||||||
|  | 		Keyword argument RAM_caching: Cache the disk image in RAM? (if omitted, don't cache) | ||||||
|  | 		Keyword argument _attributes: AppleEvent attribute dictionary | ||||||
|  | 		Returns: a reference to mounted disk | ||||||
|  | 		""" | ||||||
|  | 		_code = 'ddsk' | ||||||
|  | 		_subcode = 'Moun' | ||||||
|  | 
 | ||||||
|  | 		aetools.keysubst(_arguments, self._argmap_mount) | ||||||
|  | 		_arguments['----'] = _object | ||||||
|  | 
 | ||||||
|  | 		aetools.enumsubst(_arguments, 'Acss', _Enum_Acss) | ||||||
|  | 		aetools.enumsubst(_arguments, 'VChk', _Enum_bool) | ||||||
|  | 		aetools.enumsubst(_arguments, 'VSig', _Enum_bool) | ||||||
|  | 		aetools.enumsubst(_arguments, 'Cach', _Enum_bool) | ||||||
|  | 
 | ||||||
|  | 		_reply, _arguments, _attributes = self.send(_code, _subcode, | ||||||
|  | 				_arguments, _attributes) | ||||||
|  | 		if _arguments.has_key('errn'): | ||||||
|  | 			raise aetools.Error, aetools.decodeerror(_arguments) | ||||||
|  | 		# XXXX Optionally decode result | ||||||
|  | 		if _arguments.has_key('----'): | ||||||
|  | 			return _arguments['----'] | ||||||
|  | 
 | ||||||
|  | 	_argmap_execute_DiskScript = { | ||||||
|  | 		'checksum_verification' : 'VChk', | ||||||
|  | 		'signature_verification' : 'VSig', | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	def execute_DiskScript(self, _object, _attributes={}, **_arguments): | ||||||
|  | 		"""execute DiskScript: Executes a Disk Copy-specific DiskScript | ||||||
|  | 		Required argument: a reference to the DiskScript to execute | ||||||
|  | 		Keyword argument checksum_verification: Should checksums be verified when mounting images referenced in the DiskScript? | ||||||
|  | 		Keyword argument signature_verification: Should the DigiSign<EFBFBD> signature of the DiskScript and the images it references be verified? | ||||||
|  | 		Keyword argument _attributes: AppleEvent attribute dictionary | ||||||
|  | 		""" | ||||||
|  | 		_code = 'ddsk' | ||||||
|  | 		_subcode = 'XEQd' | ||||||
|  | 
 | ||||||
|  | 		aetools.keysubst(_arguments, self._argmap_execute_DiskScript) | ||||||
|  | 		_arguments['----'] = _object | ||||||
|  | 
 | ||||||
|  | 		aetools.enumsubst(_arguments, 'VChk', _Enum_bool) | ||||||
|  | 		aetools.enumsubst(_arguments, 'VSig', _Enum_bool) | ||||||
|  | 
 | ||||||
|  | 		_reply, _arguments, _attributes = self.send(_code, _subcode, | ||||||
|  | 				_arguments, _attributes) | ||||||
|  | 		if _arguments.has_key('errn'): | ||||||
|  | 			raise aetools.Error, aetools.decodeerror(_arguments) | ||||||
|  | 		# XXXX Optionally decode result | ||||||
|  | 		if _arguments.has_key('----'): | ||||||
|  | 			return _arguments['----'] | ||||||
|  | 
 | ||||||
|  | 	def unmount(self, _object, _attributes={}, **_arguments): | ||||||
|  | 		"""unmount: Unmount and eject (if necessary) a volume | ||||||
|  | 		Required argument: a reference to disk to be unmounted (and ejected) | ||||||
|  | 		Keyword argument _attributes: AppleEvent attribute dictionary | ||||||
|  | 		""" | ||||||
|  | 		_code = 'ddsk' | ||||||
|  | 		_subcode = 'Umnt' | ||||||
|  | 
 | ||||||
|  | 		if _arguments: raise TypeError, 'No optional args expected' | ||||||
|  | 		_arguments['----'] = _object | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 		_reply, _arguments, _attributes = self.send(_code, _subcode, | ||||||
|  | 				_arguments, _attributes) | ||||||
|  | 		if _arguments.has_key('errn'): | ||||||
|  | 			raise aetools.Error, aetools.decodeerror(_arguments) | ||||||
|  | 		# XXXX Optionally decode result | ||||||
|  | 		if _arguments.has_key('----'): | ||||||
|  | 			return _arguments['----'] | ||||||
|  | 
 | ||||||
|  | 	_argmap_create = { | ||||||
|  | 		'saving_as' : 'SvAs', | ||||||
|  | 		'logical_blocks' : 'Blks', | ||||||
|  | 		'zeroing' : 'Zero', | ||||||
|  | 		'leave_image_mounted' : 'Moun', | ||||||
|  | 		'filesystem' : 'Fsys', | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	def create(self, _object, _attributes={}, **_arguments): | ||||||
|  | 		"""create: Create a new Disk Copy document | ||||||
|  | 		Required argument: the name of the volume to create | ||||||
|  | 		Keyword argument saving_as: the disk image to be created | ||||||
|  | 		Keyword argument logical_blocks: the number of logical blocks | ||||||
|  | 		Keyword argument zeroing: Should all blocks on the disk be set to zero? | ||||||
|  | 		Keyword argument leave_image_mounted: Should the image be mounted after it is created? | ||||||
|  | 		Keyword argument filesystem: file system to use (Mac OS Standard/compatible, Mac OS Enhanced) | ||||||
|  | 		Keyword argument _attributes: AppleEvent attribute dictionary | ||||||
|  | 		Returns: a reference to newly created disk image (or newly mounted disk) | ||||||
|  | 		""" | ||||||
|  | 		_code = 'ddsk' | ||||||
|  | 		_subcode = 'Crea' | ||||||
|  | 
 | ||||||
|  | 		aetools.keysubst(_arguments, self._argmap_create) | ||||||
|  | 		_arguments['----'] = _object | ||||||
|  | 
 | ||||||
|  | 		aetools.enumsubst(_arguments, 'SvAs', _Enum_fss_) | ||||||
|  | 		aetools.enumsubst(_arguments, 'Blks', _Enum_long) | ||||||
|  | 		aetools.enumsubst(_arguments, 'Zero', _Enum_bool) | ||||||
|  | 		aetools.enumsubst(_arguments, 'Moun', _Enum_bool) | ||||||
|  | 		aetools.enumsubst(_arguments, 'Fsys', _Enum_Fsys) | ||||||
|  | 
 | ||||||
|  | 		_reply, _arguments, _attributes = self.send(_code, _subcode, | ||||||
|  | 				_arguments, _attributes) | ||||||
|  | 		if _arguments.has_key('errn'): | ||||||
|  | 			raise aetools.Error, aetools.decodeerror(_arguments) | ||||||
|  | 		# XXXX Optionally decode result | ||||||
|  | 		if _arguments.has_key('----'): | ||||||
|  | 			return _arguments['----'] | ||||||
|  | 
 | ||||||
|  | 	def verify_checksum(self, _object, _attributes={}, **_arguments): | ||||||
|  | 		"""verify checksum: Verify the checksum of a Disk Copy 4.2 or a Disk Copy 6.0 read-only document | ||||||
|  | 		Required argument: the disk image to be verified | ||||||
|  | 		Keyword argument _attributes: AppleEvent attribute dictionary | ||||||
|  | 		Returns: the result of the checksum verification | ||||||
|  | 		""" | ||||||
|  | 		_code = 'ddsk' | ||||||
|  | 		_subcode = 'Vcrc' | ||||||
|  | 
 | ||||||
|  | 		if _arguments: raise TypeError, 'No optional args expected' | ||||||
|  | 		_arguments['----'] = _object | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 		_reply, _arguments, _attributes = self.send(_code, _subcode, | ||||||
|  | 				_arguments, _attributes) | ||||||
|  | 		if _arguments.has_key('errn'): | ||||||
|  | 			raise aetools.Error, aetools.decodeerror(_arguments) | ||||||
|  | 		# XXXX Optionally decode result | ||||||
|  | 		if _arguments.has_key('----'): | ||||||
|  | 			return _arguments['----'] | ||||||
|  | 
 | ||||||
|  | 	def verify_signature(self, _object, _attributes={}, **_arguments): | ||||||
|  | 		"""verify signature: Verify the DigiSign<67> signature for a Disk Copy document | ||||||
|  | 		Required argument: the disk image to be verified | ||||||
|  | 		Keyword argument _attributes: AppleEvent attribute dictionary | ||||||
|  | 		Returns: Is the DigiSign<EFBFBD> signature valid? | ||||||
|  | 		""" | ||||||
|  | 		_code = 'ddsk' | ||||||
|  | 		_subcode = 'Vsig' | ||||||
|  | 
 | ||||||
|  | 		if _arguments: raise TypeError, 'No optional args expected' | ||||||
|  | 		_arguments['----'] = _object | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 		_reply, _arguments, _attributes = self.send(_code, _subcode, | ||||||
|  | 				_arguments, _attributes) | ||||||
|  | 		if _arguments.has_key('errn'): | ||||||
|  | 			raise aetools.Error, aetools.decodeerror(_arguments) | ||||||
|  | 		# XXXX Optionally decode result | ||||||
|  | 		if _arguments.has_key('----'): | ||||||
|  | 			return _arguments['----'] | ||||||
|  | 
 | ||||||
|  | 	_argmap_sign_image = { | ||||||
|  | 		'using_signer' : 'Sinr', | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	def sign_image(self, _object, _attributes={}, **_arguments): | ||||||
|  | 		"""sign image: Add a DigiSign<67> signature to a Disk Copy document | ||||||
|  | 		Required argument: the disk image to be signed | ||||||
|  | 		Keyword argument using_signer: a reference to signer file to use | ||||||
|  | 		Keyword argument _attributes: AppleEvent attribute dictionary | ||||||
|  | 		""" | ||||||
|  | 		_code = 'ddsk' | ||||||
|  | 		_subcode = 'Asig' | ||||||
|  | 
 | ||||||
|  | 		aetools.keysubst(_arguments, self._argmap_sign_image) | ||||||
|  | 		_arguments['----'] = _object | ||||||
|  | 
 | ||||||
|  | 		aetools.enumsubst(_arguments, 'Sinr', _Enum_alis) | ||||||
|  | 
 | ||||||
|  | 		_reply, _arguments, _attributes = self.send(_code, _subcode, | ||||||
|  | 				_arguments, _attributes) | ||||||
|  | 		if _arguments.has_key('errn'): | ||||||
|  | 			raise aetools.Error, aetools.decodeerror(_arguments) | ||||||
|  | 		# XXXX Optionally decode result | ||||||
|  | 		if _arguments.has_key('----'): | ||||||
|  | 			return _arguments['----'] | ||||||
|  | 
 | ||||||
|  | 	_argmap_create_a_floppy_from = { | ||||||
|  | 		'signature_verification' : 'VSig', | ||||||
|  | 		'erase_confirmation' : 'Cfrm', | ||||||
|  | 		'make_multiple_floppies' : 'Mult', | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	def create_a_floppy_from(self, _object, _attributes={}, **_arguments): | ||||||
|  | 		"""create a floppy from: create a floppy disk from a Disk Copy document | ||||||
|  | 		Required argument: the disk image to make a floppy from | ||||||
|  | 		Keyword argument signature_verification: Should the DigiSign<EFBFBD> signature be verified before creating a floppy disk? | ||||||
|  | 		Keyword argument erase_confirmation: Should the user be asked to confirm the erasure of the previous contents of floppy disks? | ||||||
|  | 		Keyword argument make_multiple_floppies: Should the user be prompted to create multiple floppy disks? | ||||||
|  | 		Keyword argument _attributes: AppleEvent attribute dictionary | ||||||
|  | 		""" | ||||||
|  | 		_code = 'ddsk' | ||||||
|  | 		_subcode = 'Bfpy' | ||||||
|  | 
 | ||||||
|  | 		aetools.keysubst(_arguments, self._argmap_create_a_floppy_from) | ||||||
|  | 		_arguments['----'] = _object | ||||||
|  | 
 | ||||||
|  | 		aetools.enumsubst(_arguments, 'VSig', _Enum_bool) | ||||||
|  | 		aetools.enumsubst(_arguments, 'Cfrm', _Enum_bool) | ||||||
|  | 		aetools.enumsubst(_arguments, 'Mult', _Enum_bool) | ||||||
|  | 
 | ||||||
|  | 		_reply, _arguments, _attributes = self.send(_code, _subcode, | ||||||
|  | 				_arguments, _attributes) | ||||||
|  | 		if _arguments.has_key('errn'): | ||||||
|  | 			raise aetools.Error, aetools.decodeerror(_arguments) | ||||||
|  | 		# XXXX Optionally decode result | ||||||
|  | 		if _arguments.has_key('----'): | ||||||
|  | 			return _arguments['----'] | ||||||
|  | 
 | ||||||
|  | 	_argmap_check_image = { | ||||||
|  | 		'details' : 'ChDe', | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	def check_image(self, _object, _attributes={}, **_arguments): | ||||||
|  | 		"""check image: Check the disk image¹s internal data structures for any inconsistencies.  Works on NDIF, Disk Copy 4.2, DART<52>, or DiskSet images. | ||||||
|  | 		Required argument: the disk image to be verified | ||||||
|  | 		Keyword argument details: Should the disk image details be displayed? | ||||||
|  | 		Keyword argument _attributes: AppleEvent attribute dictionary | ||||||
|  | 		Returns: a record containing a boolean (true/false) value if the image passes consistency tests, and the numbers of warnings and errors | ||||||
|  | 		""" | ||||||
|  | 		_code = 'ddsk' | ||||||
|  | 		_subcode = 'Chek' | ||||||
|  | 
 | ||||||
|  | 		aetools.keysubst(_arguments, self._argmap_check_image) | ||||||
|  | 		_arguments['----'] = _object | ||||||
|  | 
 | ||||||
|  | 		aetools.enumsubst(_arguments, 'ChDe', _Enum_bool) | ||||||
|  | 
 | ||||||
|  | 		_reply, _arguments, _attributes = self.send(_code, _subcode, | ||||||
|  | 				_arguments, _attributes) | ||||||
|  | 		if _arguments.has_key('errn'): | ||||||
|  | 			raise aetools.Error, aetools.decodeerror(_arguments) | ||||||
|  | 		# XXXX Optionally decode result | ||||||
|  | 		if _arguments.has_key('----'): | ||||||
|  | 			return _arguments['----'] | ||||||
|  | 
 | ||||||
|  | 	_argmap_segment_image = { | ||||||
|  | 		'segment_count' : 'SGCT', | ||||||
|  | 		'segment_size' : 'SGSZ', | ||||||
|  | 		'segment_name' : 'SGNM', | ||||||
|  | 		'image_ID' : 'SGID', | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	def segment_image(self, _object, _attributes={}, **_arguments): | ||||||
|  | 		"""segment image: Segment a NDIF R/W or R/O image into smaller pieces | ||||||
|  | 		Required argument: the disk image to be segmented | ||||||
|  | 		Keyword argument segment_count: the number of image segments to create | ||||||
|  | 		Keyword argument segment_size: the size of image segments (in blocks) to create | ||||||
|  | 		Keyword argument segment_name: the root name for each image segment file | ||||||
|  | 		Keyword argument image_ID: string used to generate a unique image ID to group the segments | ||||||
|  | 		Keyword argument _attributes: AppleEvent attribute dictionary | ||||||
|  | 		Returns: a list of references to the image segments created | ||||||
|  | 		""" | ||||||
|  | 		_code = 'ddsk' | ||||||
|  | 		_subcode = 'SGMT' | ||||||
|  | 
 | ||||||
|  | 		aetools.keysubst(_arguments, self._argmap_segment_image) | ||||||
|  | 		_arguments['----'] = _object | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 		_reply, _arguments, _attributes = self.send(_code, _subcode, | ||||||
|  | 				_arguments, _attributes) | ||||||
|  | 		if _arguments.has_key('errn'): | ||||||
|  | 			raise aetools.Error, aetools.decodeerror(_arguments) | ||||||
|  | 		# XXXX Optionally decode result | ||||||
|  | 		if _arguments.has_key('----'): | ||||||
|  | 			return _arguments['----'] | ||||||
|  | 
 | ||||||
|  | 	_argmap_create_SMI = { | ||||||
|  | 		'source_images' : 'SMI1', | ||||||
|  | 		'launching_application' : 'SMI2', | ||||||
|  | 		'launching_document' : 'SMI3', | ||||||
|  | 		'version_string' : 'SMI4', | ||||||
|  | 		'checksum_verification' : 'VChk', | ||||||
|  | 		'signature_verification' : 'VSig', | ||||||
|  | 		'image_signing' : 'SImg', | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	def create_SMI(self, _object, _attributes={}, **_arguments): | ||||||
|  | 		"""create SMI: Creates a self-mounting image (SMI) from a list of NDIF disk images | ||||||
|  | 		Required argument: the self-mounting image to create | ||||||
|  | 		Keyword argument source_images: a list of references to sources images | ||||||
|  | 		Keyword argument launching_application: the path to an application to launch | ||||||
|  | 		Keyword argument launching_document: the path to a document to open | ||||||
|  | 		Keyword argument version_string: sets the 'vers' 1 resource of the self-mounting image | ||||||
|  | 		Keyword argument checksum_verification: Should the checksum of the source images be verified before creating the SMI? | ||||||
|  | 		Keyword argument signature_verification: Should the DigiSign<EFBFBD> signature of the source images be verified before creating the SMI? | ||||||
|  | 		Keyword argument image_signing: Should the SMI be given a digital signature when it is created? | ||||||
|  | 		Keyword argument _attributes: AppleEvent attribute dictionary | ||||||
|  | 		Returns: a reference to the self-mounting image created | ||||||
|  | 		""" | ||||||
|  | 		_code = 'ddsk' | ||||||
|  | 		_subcode = 'MSMI' | ||||||
|  | 
 | ||||||
|  | 		aetools.keysubst(_arguments, self._argmap_create_SMI) | ||||||
|  | 		_arguments['----'] = _object | ||||||
|  | 
 | ||||||
|  | 		aetools.enumsubst(_arguments, 'VChk', _Enum_bool) | ||||||
|  | 		aetools.enumsubst(_arguments, 'VSig', _Enum_bool) | ||||||
|  | 		aetools.enumsubst(_arguments, 'SImg', _Enum_bool) | ||||||
|  | 
 | ||||||
|  | 		_reply, _arguments, _attributes = self.send(_code, _subcode, | ||||||
|  | 				_arguments, _attributes) | ||||||
|  | 		if _arguments.has_key('errn'): | ||||||
|  | 			raise aetools.Error, aetools.decodeerror(_arguments) | ||||||
|  | 		# XXXX Optionally decode result | ||||||
|  | 		if _arguments.has_key('----'): | ||||||
|  | 			return _arguments['----'] | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | class Verify_Checksum_reply_record(aetools.ComponentItem): | ||||||
|  | 	"""Verify Checksum reply record -  """ | ||||||
|  | 	want = 'Rcrc' | ||||||
|  | class validity(aetools.NProperty): | ||||||
|  | 	"""validity - true if checksum is valid """ | ||||||
|  | 	which = 'Vlid' | ||||||
|  | 	want = 'bool' | ||||||
|  | class expected_checksum(aetools.NProperty): | ||||||
|  | 	"""expected checksum - checksum value stored in the image header (in hexadecimal) """ | ||||||
|  | 	which = 'crcE' | ||||||
|  | 	want = 'TEXT' | ||||||
|  | class calculated_checksum(aetools.NProperty): | ||||||
|  | 	"""calculated checksum - checksum value actually calculated (in hexadecimal) """ | ||||||
|  | 	which = 'crcA' | ||||||
|  | 	want = 'TEXT' | ||||||
|  | 
 | ||||||
|  | class Check_Image_reply_record(aetools.ComponentItem): | ||||||
|  | 	"""Check Image reply record -  """ | ||||||
|  | 	want = 'Rchk' | ||||||
|  | class consistency(aetools.NProperty): | ||||||
|  | 	"""consistency - Does the image pass consistency checks? """ | ||||||
|  | 	which = 'Rch1' | ||||||
|  | 	want = 'bool' | ||||||
|  | class error_count(aetools.NProperty): | ||||||
|  | 	"""error count - the number of errors recorded """ | ||||||
|  | 	which = 'Rch2' | ||||||
|  | 	want = 'long' | ||||||
|  | class warning_count(aetools.NProperty): | ||||||
|  | 	"""warning count - the number of warnings recorded """ | ||||||
|  | 	which = 'Rch3' | ||||||
|  | 	want = 'long' | ||||||
|  | Verify_Checksum_reply_record._propdict = { | ||||||
|  | 	'validity' : validity, | ||||||
|  | 	'expected_checksum' : expected_checksum, | ||||||
|  | 	'calculated_checksum' : calculated_checksum, | ||||||
|  | } | ||||||
|  | Verify_Checksum_reply_record._elemdict = { | ||||||
|  | } | ||||||
|  | Check_Image_reply_record._propdict = { | ||||||
|  | 	'consistency' : consistency, | ||||||
|  | 	'error_count' : error_count, | ||||||
|  | 	'warning_count' : warning_count, | ||||||
|  | } | ||||||
|  | Check_Image_reply_record._elemdict = { | ||||||
|  | } | ||||||
|  | _Enum_Acss = { | ||||||
|  | 	'read_and_write' : 'RdWr',	# read/write access | ||||||
|  | 	'read_only' : 'Rdxx',	# read-only access | ||||||
|  | 	'any' : 'Anyx',	# best possible access | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | _Enum_Fsys = { | ||||||
|  | 	'Mac_OS_Standard' : 'Fhfs',	# classic HFS file system | ||||||
|  | 	'compatible_Mac_OS_Extended' : 'Fhf+',	# new HFS+ file system | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | _Enum_alis = None # XXXX enum alis not found!! | ||||||
|  | _Enum_fss_ = None # XXXX enum fss  not found!! | ||||||
|  | _Enum_long = None # XXXX enum long not found!! | ||||||
|  | _Enum_bool = None # XXXX enum bool not found!! | ||||||
|  | 
 | ||||||
|  | # | ||||||
|  | # Indices of types declared in this module | ||||||
|  | # | ||||||
|  | _classdeclarations = { | ||||||
|  | 	'Rchk' : Check_Image_reply_record, | ||||||
|  | 	'Rcrc' : Verify_Checksum_reply_record, | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | _propdeclarations = { | ||||||
|  | 	'crcE' : expected_checksum, | ||||||
|  | 	'Rch2' : error_count, | ||||||
|  | 	'crcA' : calculated_checksum, | ||||||
|  | 	'Rch3' : warning_count, | ||||||
|  | 	'Vlid' : validity, | ||||||
|  | 	'Rch1' : consistency, | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | _compdeclarations = { | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | _enumdeclarations = { | ||||||
|  | 	'Acss' : _Enum_Acss, | ||||||
|  | 	'Fsys' : _Enum_Fsys, | ||||||
|  | } | ||||||
							
								
								
									
										477
									
								
								Mac/Demo/applescript/Disk_Copy/Standard_Suite.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										477
									
								
								Mac/Demo/applescript/Disk_Copy/Standard_Suite.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,477 @@ | ||||||
|  | """Suite Standard Suite: Common terms for most applications | ||||||
|  | Level 1, version 1 | ||||||
|  | 
 | ||||||
|  | Generated from Macintosh HD:Hulpprogramma's:Disk Copy | ||||||
|  | AETE/AEUT resource version 1/0, language 0, script 0 | ||||||
|  | """ | ||||||
|  | 
 | ||||||
|  | import aetools | ||||||
|  | import MacOS | ||||||
|  | 
 | ||||||
|  | _code = 'Core' | ||||||
|  | 
 | ||||||
|  | class Standard_Suite_Events: | ||||||
|  | 
 | ||||||
|  | 	_argmap_save = { | ||||||
|  | 		'_in' : 'kfil', | ||||||
|  | 		'using_format' : 'SvAs', | ||||||
|  | 		'checksum_verification' : 'VChk', | ||||||
|  | 		'signature_verification' : 'VSig', | ||||||
|  | 		'image_signing' : 'SImg', | ||||||
|  | 		'leave_image_mounted' : 'Moun', | ||||||
|  | 		'percent_free_space' : 'Slop', | ||||||
|  | 		'logical_blocks' : 'Blks', | ||||||
|  | 		'zeroing' : 'Zero', | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	def save(self, _object, _attributes={}, **_arguments): | ||||||
|  | 		"""save: Save an object | ||||||
|  | 		Required argument: the source object | ||||||
|  | 		Keyword argument _in: the target object | ||||||
|  | 		Keyword argument using_format: the format for the target | ||||||
|  | 		Keyword argument checksum_verification: Should the checksum be verified before saving? | ||||||
|  | 		Keyword argument signature_verification: Should the DigiSign<EFBFBD> signature be verified before saving? | ||||||
|  | 		Keyword argument image_signing: Should the image be signed? | ||||||
|  | 		Keyword argument leave_image_mounted: Should the image be mounted after saving? | ||||||
|  | 		Keyword argument percent_free_space: percent free space to reserve (for image folder operation, 0-255%) | ||||||
|  | 		Keyword argument logical_blocks: number of logical blocks in the image (for image folder operation) | ||||||
|  | 		Keyword argument zeroing: Should all the blocks in the image be set to zeros? (for image folder operation) | ||||||
|  | 		Keyword argument _attributes: AppleEvent attribute dictionary | ||||||
|  | 		Returns: the result of the save operation | ||||||
|  | 		""" | ||||||
|  | 		_code = 'core' | ||||||
|  | 		_subcode = 'save' | ||||||
|  | 
 | ||||||
|  | 		aetools.keysubst(_arguments, self._argmap_save) | ||||||
|  | 		_arguments['----'] = _object | ||||||
|  | 
 | ||||||
|  | 		aetools.enumsubst(_arguments, 'kfil', _Enum_obj_) | ||||||
|  | 		aetools.enumsubst(_arguments, 'SvAs', _Enum_SvAs) | ||||||
|  | 		aetools.enumsubst(_arguments, 'VChk', _Enum_bool) | ||||||
|  | 		aetools.enumsubst(_arguments, 'VSig', _Enum_bool) | ||||||
|  | 		aetools.enumsubst(_arguments, 'SImg', _Enum_bool) | ||||||
|  | 		aetools.enumsubst(_arguments, 'Moun', _Enum_bool) | ||||||
|  | 		aetools.enumsubst(_arguments, 'Slop', _Enum_long) | ||||||
|  | 		aetools.enumsubst(_arguments, 'Blks', _Enum_long) | ||||||
|  | 		aetools.enumsubst(_arguments, 'Zero', _Enum_bool) | ||||||
|  | 
 | ||||||
|  | 		_reply, _arguments, _attributes = self.send(_code, _subcode, | ||||||
|  | 				_arguments, _attributes) | ||||||
|  | 		if _arguments.has_key('errn'): | ||||||
|  | 			raise aetools.Error, aetools.decodeerror(_arguments) | ||||||
|  | 		# XXXX Optionally decode result | ||||||
|  | 		if _arguments.has_key('----'): | ||||||
|  | 			return _arguments['----'] | ||||||
|  | 
 | ||||||
|  | 	def do_script(self, _object, _attributes={}, **_arguments): | ||||||
|  | 		"""do script: Execute an attached script located in the folder "Scripts" | ||||||
|  | 		Required argument: the script to be executed | ||||||
|  | 		Keyword argument _attributes: AppleEvent attribute dictionary | ||||||
|  | 		""" | ||||||
|  | 		_code = 'core' | ||||||
|  | 		_subcode = 'dosc' | ||||||
|  | 
 | ||||||
|  | 		if _arguments: raise TypeError, 'No optional args expected' | ||||||
|  | 		_arguments['----'] = _object | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 		_reply, _arguments, _attributes = self.send(_code, _subcode, | ||||||
|  | 				_arguments, _attributes) | ||||||
|  | 		if _arguments.has_key('errn'): | ||||||
|  | 			raise aetools.Error, aetools.decodeerror(_arguments) | ||||||
|  | 		# XXXX Optionally decode result | ||||||
|  | 		if _arguments.has_key('----'): | ||||||
|  | 			return _arguments['----'] | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | class application(aetools.ComponentItem): | ||||||
|  | 	"""application - The Disk Copy application """ | ||||||
|  | 	want = 'capp' | ||||||
|  | class version(aetools.NProperty): | ||||||
|  | 	"""version - the version of this application """ | ||||||
|  | 	which = 'vers' | ||||||
|  | 	want = 'vers' | ||||||
|  | class name(aetools.NProperty): | ||||||
|  | 	"""name - the name of this application """ | ||||||
|  | 	which = 'pnam' | ||||||
|  | 	want = 'TEXT' | ||||||
|  | class comment(aetools.NProperty): | ||||||
|  | 	"""comment - the comment associated with the application """ | ||||||
|  | 	which = 'comt' | ||||||
|  | 	want = 'TEXT' | ||||||
|  | class driver_version(aetools.NProperty): | ||||||
|  | 	"""driver version - the version of the disk image driver """ | ||||||
|  | 	which = 'dVer' | ||||||
|  | 	want = 'vers' | ||||||
|  | class nonejectable_mode(aetools.NProperty): | ||||||
|  | 	"""nonejectable mode - Should mounted images be non-ejectable? """ | ||||||
|  | 	which = 'otto' | ||||||
|  | 	want = 'bool' | ||||||
|  | class save_log_file(aetools.NProperty): | ||||||
|  | 	"""save log file - Should the log file be saved on disk? """ | ||||||
|  | 	which = 'PSaL' | ||||||
|  | 	want = 'bool' | ||||||
|  | class use_speech(aetools.NProperty): | ||||||
|  | 	"""use speech - Should Disk Copy use spoken feedback? """ | ||||||
|  | 	which = 'PTlk' | ||||||
|  | 	want = 'bool' | ||||||
|  | class smart_Save_As(aetools.NProperty): | ||||||
|  | 	"""smart Save As - Should the Save As... dialog box automatically go to the right folder? """ | ||||||
|  | 	which = 'PSSP' | ||||||
|  | 	want = 'bool' | ||||||
|  | class checksum_verification(aetools.NProperty): | ||||||
|  | 	"""checksum verification - Should image checksums be verified? """ | ||||||
|  | 	which = 'PVeC' | ||||||
|  | 	want = 'bool' | ||||||
|  | class signature_verification(aetools.NProperty): | ||||||
|  | 	"""signature verification - Should digital signatures be verified? """ | ||||||
|  | 	which = 'PVeS' | ||||||
|  | 	want = 'bool' | ||||||
|  | class exclude_DiskScripts(aetools.NProperty): | ||||||
|  | 	"""exclude DiskScripts - Should images referenced in DiskScripts/DiskSets be excluded from verification? """ | ||||||
|  | 	which = 'PExD' | ||||||
|  | 	want = 'bool' | ||||||
|  | class exclude_remote_images(aetools.NProperty): | ||||||
|  | 	"""exclude remote images - Should images that are located on network volumes be excluded from verification? """ | ||||||
|  | 	which = 'PExR' | ||||||
|  | 	want = 'bool' | ||||||
|  | class image_signing(aetools.NProperty): | ||||||
|  | 	"""image signing - Should images be signed with a digital signature? """ | ||||||
|  | 	which = 'PSiI' | ||||||
|  | 	want = 'bool' | ||||||
|  | class leave_image_mounted(aetools.NProperty): | ||||||
|  | 	"""leave image mounted - Should images be mounted after they are created? """ | ||||||
|  | 	which = 'PMoA' | ||||||
|  | 	want = 'bool' | ||||||
|  | class erase_confirmation(aetools.NProperty): | ||||||
|  | 	"""erase confirmation - Should the user be required to confirm commands that erase disks? """ | ||||||
|  | 	which = 'PCoE' | ||||||
|  | 	want = 'bool' | ||||||
|  | class zeroing(aetools.NProperty): | ||||||
|  | 	"""zeroing - Should all blocks of a new image be set to zero? """ | ||||||
|  | 	which = 'PZeB' | ||||||
|  | 	want = 'bool' | ||||||
|  | class default_create_size(aetools.NProperty): | ||||||
|  | 	"""default create size - the default size for a new image, in blocks (512 bytes per block) """ | ||||||
|  | 	which = 'PDeS' | ||||||
|  | 	want = 'long' | ||||||
|  | class default_create_name(aetools.NProperty): | ||||||
|  | 	"""default create name - the default volume name for a new image """ | ||||||
|  | 	which = 'PDeN' | ||||||
|  | 	want = 'TEXT' | ||||||
|  | class make_multiple_floppies(aetools.NProperty): | ||||||
|  | 	"""make multiple floppies - Should the user be prompted to make multiple floppy disk images at a time? """ | ||||||
|  | 	which = 'PBuM' | ||||||
|  | 	want = 'bool' | ||||||
|  | class auto_image_upon_insert(aetools.NProperty): | ||||||
|  | 	"""auto image upon insert - Should a newly-inserted disk automatically be processed into an image? """ | ||||||
|  | 	which = 'Paim' | ||||||
|  | 	want = 'bool' | ||||||
|  | class eject_after_auto_image(aetools.NProperty): | ||||||
|  | 	"""eject after auto image - Should auto-imaged disks be ejected afterwards? """ | ||||||
|  | 	which = 'Pejc' | ||||||
|  | 	want = 'bool' | ||||||
|  | class auto_copy_upon_floppy_insert(aetools.NProperty): | ||||||
|  | 	"""auto copy upon floppy insert - Instead of auto-imaging, should newly-inserted floppy disks be copied? """ | ||||||
|  | 	which = 'Pcpf' | ||||||
|  | 	want = 'bool' | ||||||
|  | class volume_suffix(aetools.NProperty): | ||||||
|  | 	"""volume suffix - the default volume name suffix """ | ||||||
|  | 	which = 'PDiE' | ||||||
|  | 	want = 'TEXT' | ||||||
|  | class image_suffix(aetools.NProperty): | ||||||
|  | 	"""image suffix - the default image name suffix """ | ||||||
|  | 	which = 'PImE' | ||||||
|  | 	want = 'TEXT' | ||||||
|  | class default_file_system(aetools.NProperty): | ||||||
|  | 	"""default file system - the default file system type for new blank images """ | ||||||
|  | 	which = 'Pfsy' | ||||||
|  | 	want = 'Fsys' | ||||||
|  | class default_image_format(aetools.NProperty): | ||||||
|  | 	"""default image format - the default image file format """ | ||||||
|  | 	which = 'Pdfm' | ||||||
|  | 	want = 'SvAs' | ||||||
|  | 
 | ||||||
|  | class disk(aetools.ComponentItem): | ||||||
|  | 	"""disk - A mounted volume """ | ||||||
|  | 	want = 'Disk' | ||||||
|  | 
 | ||||||
|  | name = name | ||||||
|  | 
 | ||||||
|  | comment = comment | ||||||
|  | class locked(aetools.NProperty): | ||||||
|  | 	"""locked - Is the disk locked? """ | ||||||
|  | 	which = 'islk' | ||||||
|  | 	want = 'bool' | ||||||
|  | class creation_date(aetools.NProperty): | ||||||
|  | 	"""creation date - the creation date of disk """ | ||||||
|  | 	which = 'ascd' | ||||||
|  | 	want = 'ldt ' | ||||||
|  | class modification_date(aetools.NProperty): | ||||||
|  | 	"""modification date - the modification date of disk """ | ||||||
|  | 	which = 'asmo' | ||||||
|  | 	want = 'ldt ' | ||||||
|  | class crc32_checksum(aetools.NProperty): | ||||||
|  | 	"""crc32 checksum - the crc-32 checksum of the disk """ | ||||||
|  | 	which = 'Xcrc' | ||||||
|  | 	want = 'TEXT' | ||||||
|  | class disk_copy_4_2e_2_checksum(aetools.NProperty): | ||||||
|  | 	"""disk copy 4.2 checksum - the Disk Copy 4.2 checksum of the disk """ | ||||||
|  | 	which = 'Xc42' | ||||||
|  | 	want = 'TEXT' | ||||||
|  | class block_count(aetools.NProperty): | ||||||
|  | 	"""block count - the number of blocks on disk """ | ||||||
|  | 	which = 'Xblk' | ||||||
|  | 	want = 'long' | ||||||
|  | class file_system(aetools.NProperty): | ||||||
|  | 	"""file system - the file system used on disk """ | ||||||
|  | 	which = 'Xfsi' | ||||||
|  | 	want = 'TEXT' | ||||||
|  | 
 | ||||||
|  | class folder(aetools.ComponentItem): | ||||||
|  | 	"""folder - A folder or directory on a disk """ | ||||||
|  | 	want = 'Fold' | ||||||
|  | 
 | ||||||
|  | name = name | ||||||
|  | 
 | ||||||
|  | comment = comment | ||||||
|  | 
 | ||||||
|  | creation_date = creation_date | ||||||
|  | 
 | ||||||
|  | modification_date = modification_date | ||||||
|  | 
 | ||||||
|  | class disk_image(aetools.ComponentItem): | ||||||
|  | 	"""disk image - A disk image file """ | ||||||
|  | 	want = 'DImg' | ||||||
|  | 
 | ||||||
|  | name = name | ||||||
|  | 
 | ||||||
|  | comment = comment | ||||||
|  | 
 | ||||||
|  | locked = locked | ||||||
|  | 
 | ||||||
|  | creation_date = creation_date | ||||||
|  | 
 | ||||||
|  | modification_date = modification_date | ||||||
|  | class file_format(aetools.NProperty): | ||||||
|  | 	"""file format - the format of the disk image file """ | ||||||
|  | 	which = 'Ifmt' | ||||||
|  | 	want = 'TEXT' | ||||||
|  | class signed(aetools.NProperty): | ||||||
|  | 	"""signed - Does the disk image have a DigiSign<67> signature? """ | ||||||
|  | 	which = 'Isin' | ||||||
|  | 	want = 'bool' | ||||||
|  | class compressed(aetools.NProperty): | ||||||
|  | 	"""compressed - Is the disk image compressed? """ | ||||||
|  | 	which = 'Icom' | ||||||
|  | 	want = 'bool' | ||||||
|  | class segmented(aetools.NProperty): | ||||||
|  | 	"""segmented - Is the disk image segmented? """ | ||||||
|  | 	which = 'Iseg' | ||||||
|  | 	want = 'bool' | ||||||
|  | class segments(aetools.NProperty): | ||||||
|  | 	"""segments - a list of references to other segments that make up a complete image """ | ||||||
|  | 	which = 'Isg#' | ||||||
|  | 	want = 'fss ' | ||||||
|  | class disk_name(aetools.NProperty): | ||||||
|  | 	"""disk name - the name of the disk this image represents """ | ||||||
|  | 	which = 'Idnm' | ||||||
|  | 	want = 'TEXT' | ||||||
|  | 
 | ||||||
|  | crc32_checksum = crc32_checksum | ||||||
|  | 
 | ||||||
|  | disk_copy_4_2e_2_checksum = disk_copy_4_2e_2_checksum | ||||||
|  | 
 | ||||||
|  | block_count = block_count | ||||||
|  | 
 | ||||||
|  | file_system = file_system | ||||||
|  | class data_fork_size(aetools.NProperty): | ||||||
|  | 	"""data fork size - the size (in bytes) of the data fork of the disk image """ | ||||||
|  | 	which = 'Idfk' | ||||||
|  | 	want = 'long' | ||||||
|  | class resource_fork_size(aetools.NProperty): | ||||||
|  | 	"""resource fork size - the size (in bytes) of the resource fork of the disk image """ | ||||||
|  | 	which = 'Irfk' | ||||||
|  | 	want = 'long' | ||||||
|  | 
 | ||||||
|  | class Save_reply_record(aetools.ComponentItem): | ||||||
|  | 	"""Save reply record - Result from the save operation """ | ||||||
|  | 	want = 'cpyR' | ||||||
|  | class resulting_target_object(aetools.NProperty): | ||||||
|  | 	"""resulting target object - a reference to the target object after it has been saved """ | ||||||
|  | 	which = 'rcpO' | ||||||
|  | 	want = 'obj ' | ||||||
|  | class copy_type(aetools.NProperty): | ||||||
|  | 	"""copy type - the way in which the target object was saved """ | ||||||
|  | 	which = 'rcpT' | ||||||
|  | 	want = 'rcpT' | ||||||
|  | application._propdict = { | ||||||
|  | 	'version' : version, | ||||||
|  | 	'name' : name, | ||||||
|  | 	'comment' : comment, | ||||||
|  | 	'driver_version' : driver_version, | ||||||
|  | 	'nonejectable_mode' : nonejectable_mode, | ||||||
|  | 	'save_log_file' : save_log_file, | ||||||
|  | 	'use_speech' : use_speech, | ||||||
|  | 	'smart_Save_As' : smart_Save_As, | ||||||
|  | 	'checksum_verification' : checksum_verification, | ||||||
|  | 	'signature_verification' : signature_verification, | ||||||
|  | 	'exclude_DiskScripts' : exclude_DiskScripts, | ||||||
|  | 	'exclude_remote_images' : exclude_remote_images, | ||||||
|  | 	'image_signing' : image_signing, | ||||||
|  | 	'leave_image_mounted' : leave_image_mounted, | ||||||
|  | 	'erase_confirmation' : erase_confirmation, | ||||||
|  | 	'zeroing' : zeroing, | ||||||
|  | 	'default_create_size' : default_create_size, | ||||||
|  | 	'default_create_name' : default_create_name, | ||||||
|  | 	'make_multiple_floppies' : make_multiple_floppies, | ||||||
|  | 	'auto_image_upon_insert' : auto_image_upon_insert, | ||||||
|  | 	'eject_after_auto_image' : eject_after_auto_image, | ||||||
|  | 	'auto_copy_upon_floppy_insert' : auto_copy_upon_floppy_insert, | ||||||
|  | 	'volume_suffix' : volume_suffix, | ||||||
|  | 	'image_suffix' : image_suffix, | ||||||
|  | 	'default_file_system' : default_file_system, | ||||||
|  | 	'default_image_format' : default_image_format, | ||||||
|  | } | ||||||
|  | application._elemdict = { | ||||||
|  | } | ||||||
|  | disk._propdict = { | ||||||
|  | 	'name' : name, | ||||||
|  | 	'comment' : comment, | ||||||
|  | 	'locked' : locked, | ||||||
|  | 	'creation_date' : creation_date, | ||||||
|  | 	'modification_date' : modification_date, | ||||||
|  | 	'crc32_checksum' : crc32_checksum, | ||||||
|  | 	'disk_copy_4_2e_2_checksum' : disk_copy_4_2e_2_checksum, | ||||||
|  | 	'block_count' : block_count, | ||||||
|  | 	'file_system' : file_system, | ||||||
|  | } | ||||||
|  | disk._elemdict = { | ||||||
|  | } | ||||||
|  | folder._propdict = { | ||||||
|  | 	'name' : name, | ||||||
|  | 	'comment' : comment, | ||||||
|  | 	'creation_date' : creation_date, | ||||||
|  | 	'modification_date' : modification_date, | ||||||
|  | } | ||||||
|  | folder._elemdict = { | ||||||
|  | } | ||||||
|  | disk_image._propdict = { | ||||||
|  | 	'name' : name, | ||||||
|  | 	'comment' : comment, | ||||||
|  | 	'locked' : locked, | ||||||
|  | 	'creation_date' : creation_date, | ||||||
|  | 	'modification_date' : modification_date, | ||||||
|  | 	'file_format' : file_format, | ||||||
|  | 	'signed' : signed, | ||||||
|  | 	'compressed' : compressed, | ||||||
|  | 	'segmented' : segmented, | ||||||
|  | 	'segments' : segments, | ||||||
|  | 	'disk_name' : disk_name, | ||||||
|  | 	'crc32_checksum' : crc32_checksum, | ||||||
|  | 	'disk_copy_4_2e_2_checksum' : disk_copy_4_2e_2_checksum, | ||||||
|  | 	'block_count' : block_count, | ||||||
|  | 	'file_system' : file_system, | ||||||
|  | 	'data_fork_size' : data_fork_size, | ||||||
|  | 	'resource_fork_size' : resource_fork_size, | ||||||
|  | } | ||||||
|  | disk_image._elemdict = { | ||||||
|  | } | ||||||
|  | Save_reply_record._propdict = { | ||||||
|  | 	'resulting_target_object' : resulting_target_object, | ||||||
|  | 	'copy_type' : copy_type, | ||||||
|  | } | ||||||
|  | Save_reply_record._elemdict = { | ||||||
|  | } | ||||||
|  | _Enum_UIAc = { | ||||||
|  | 	'never_interact' : 'eNvr',	# Don¹t allow any interaction at all | ||||||
|  | 	'interact_with_self' : 'eInS',	# Only allow interaction from internal events | ||||||
|  | 	'interact_with_local' : 'eInL',	# Allow interaction from any event originating on this machine | ||||||
|  | 	'interact_with_all' : 'eInA',	# Allow interaction from network events | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | _Enum_SvAs = { | ||||||
|  | 	'NDIF_RW' : 'RdWr',	# read/write NDIF disk image | ||||||
|  | 	'NDIF_RO' : 'Rdxx',	# read-only NDIF disk image | ||||||
|  | 	'NDIF_Compressed' : 'ROCo',	# compressed NDIF disk image | ||||||
|  | 	'Disk_Copy_4_2e_2' : 'DC42',	# Disk Copy 4.2 disk image | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | _Enum_rcpT = { | ||||||
|  | 	'block_disk_copy' : 'cpBl',	# block-by-block disk-level copy | ||||||
|  | 	'files_and_file_ID_copy' : 'cpID',	# all files including desktop databases and file ID¹s | ||||||
|  | 	'files_and_desktop_info' : 'cpDT',	# all files and most desktop information | ||||||
|  | 	'files_only' : 'cpFI',	# all files but no desktop information | ||||||
|  | 	'disk_image_conversion' : 'cpCV',	# disk image format conversion | ||||||
|  | 	'disk_image_creation' : 'cpCR',	# disk image creation | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | _Enum_long = None # XXXX enum long not found!! | ||||||
|  | _Enum_bool = None # XXXX enum bool not found!! | ||||||
|  | _Enum_obj_ = None # XXXX enum obj  not found!! | ||||||
|  | 
 | ||||||
|  | # | ||||||
|  | # Indices of types declared in this module | ||||||
|  | # | ||||||
|  | _classdeclarations = { | ||||||
|  | 	'DImg' : disk_image, | ||||||
|  | 	'capp' : application, | ||||||
|  | 	'Disk' : disk, | ||||||
|  | 	'Fold' : folder, | ||||||
|  | 	'cpyR' : Save_reply_record, | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | _propdeclarations = { | ||||||
|  | 	'Xcrc' : crc32_checksum, | ||||||
|  | 	'PDeS' : default_create_size, | ||||||
|  | 	'Idnm' : disk_name, | ||||||
|  | 	'PSSP' : smart_Save_As, | ||||||
|  | 	'Pcpf' : auto_copy_upon_floppy_insert, | ||||||
|  | 	'pnam' : name, | ||||||
|  | 	'Isin' : signed, | ||||||
|  | 	'otto' : nonejectable_mode, | ||||||
|  | 	'PExD' : exclude_DiskScripts, | ||||||
|  | 	'Iseg' : segmented, | ||||||
|  | 	'islk' : locked, | ||||||
|  | 	'asmo' : modification_date, | ||||||
|  | 	'PTlk' : use_speech, | ||||||
|  | 	'Pfsy' : default_file_system, | ||||||
|  | 	'PVeC' : checksum_verification, | ||||||
|  | 	'Xc42' : disk_copy_4_2e_2_checksum, | ||||||
|  | 	'rcpO' : resulting_target_object, | ||||||
|  | 	'Paim' : auto_image_upon_insert, | ||||||
|  | 	'comt' : comment, | ||||||
|  | 	'PCoE' : erase_confirmation, | ||||||
|  | 	'dVer' : driver_version, | ||||||
|  | 	'PDeN' : default_create_name, | ||||||
|  | 	'PBuM' : make_multiple_floppies, | ||||||
|  | 	'rcpT' : copy_type, | ||||||
|  | 	'PDiE' : volume_suffix, | ||||||
|  | 	'Ifmt' : file_format, | ||||||
|  | 	'Pdfm' : default_image_format, | ||||||
|  | 	'ascd' : creation_date, | ||||||
|  | 	'Pejc' : eject_after_auto_image, | ||||||
|  | 	'PZeB' : zeroing, | ||||||
|  | 	'PExR' : exclude_remote_images, | ||||||
|  | 	'PImE' : image_suffix, | ||||||
|  | 	'PVeS' : signature_verification, | ||||||
|  | 	'PSaL' : save_log_file, | ||||||
|  | 	'Xblk' : block_count, | ||||||
|  | 	'PMoA' : leave_image_mounted, | ||||||
|  | 	'Isg#' : segments, | ||||||
|  | 	'Irfk' : resource_fork_size, | ||||||
|  | 	'Icom' : compressed, | ||||||
|  | 	'Xfsi' : file_system, | ||||||
|  | 	'Idfk' : data_fork_size, | ||||||
|  | 	'vers' : version, | ||||||
|  | 	'PSiI' : image_signing, | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | _compdeclarations = { | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | _enumdeclarations = { | ||||||
|  | 	'SvAs' : _Enum_SvAs, | ||||||
|  | 	'UIAc' : _Enum_UIAc, | ||||||
|  | 	'rcpT' : _Enum_rcpT, | ||||||
|  | } | ||||||
							
								
								
									
										213
									
								
								Mac/Demo/applescript/Disk_Copy/Utility_Events.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										213
									
								
								Mac/Demo/applescript/Disk_Copy/Utility_Events.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,213 @@ | ||||||
|  | """Suite Utility Events: Commands that allow the user to select Disk Copy files | ||||||
|  | Level 1, version 1 | ||||||
|  | 
 | ||||||
|  | Generated from Macintosh HD:Hulpprogramma's:Disk Copy | ||||||
|  | AETE/AEUT resource version 1/0, language 0, script 0 | ||||||
|  | """ | ||||||
|  | 
 | ||||||
|  | import aetools | ||||||
|  | import MacOS | ||||||
|  | 
 | ||||||
|  | _code = 'ddsk' | ||||||
|  | 
 | ||||||
|  | class Utility_Events_Events: | ||||||
|  | 
 | ||||||
|  | 	_argmap_select_disk_image = { | ||||||
|  | 		'with_prompt' : 'SELp', | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	def select_disk_image(self, _no_object=None, _attributes={}, **_arguments): | ||||||
|  | 		"""select disk image: Prompt the user to select a disk image | ||||||
|  | 		Keyword argument with_prompt: the prompt string to be displayed | ||||||
|  | 		Keyword argument _attributes: AppleEvent attribute dictionary | ||||||
|  | 		Returns: a reference to a disk image | ||||||
|  | 		""" | ||||||
|  | 		_code = 'UTIL' | ||||||
|  | 		_subcode = 'SEL1' | ||||||
|  | 
 | ||||||
|  | 		aetools.keysubst(_arguments, self._argmap_select_disk_image) | ||||||
|  | 		if _no_object != None: raise TypeError, 'No direct arg expected' | ||||||
|  | 
 | ||||||
|  | 		aetools.enumsubst(_arguments, 'SELp', _Enum_TEXT) | ||||||
|  | 
 | ||||||
|  | 		_reply, _arguments, _attributes = self.send(_code, _subcode, | ||||||
|  | 				_arguments, _attributes) | ||||||
|  | 		if _arguments.has_key('errn'): | ||||||
|  | 			raise aetools.Error, aetools.decodeerror(_arguments) | ||||||
|  | 		# XXXX Optionally decode result | ||||||
|  | 		if _arguments.has_key('----'): | ||||||
|  | 			return _arguments['----'] | ||||||
|  | 
 | ||||||
|  | 	_argmap_select_DiskScript = { | ||||||
|  | 		'with_prompt' : 'SELp', | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	def select_DiskScript(self, _no_object=None, _attributes={}, **_arguments): | ||||||
|  | 		"""select DiskScript: Prompt the user to select a DiskScript | ||||||
|  | 		Keyword argument with_prompt: the prompt string to be displayed | ||||||
|  | 		Keyword argument _attributes: AppleEvent attribute dictionary | ||||||
|  | 		Returns: a reference to a DiskScript | ||||||
|  | 		""" | ||||||
|  | 		_code = 'UTIL' | ||||||
|  | 		_subcode = 'SEL2' | ||||||
|  | 
 | ||||||
|  | 		aetools.keysubst(_arguments, self._argmap_select_DiskScript) | ||||||
|  | 		if _no_object != None: raise TypeError, 'No direct arg expected' | ||||||
|  | 
 | ||||||
|  | 		aetools.enumsubst(_arguments, 'SELp', _Enum_TEXT) | ||||||
|  | 
 | ||||||
|  | 		_reply, _arguments, _attributes = self.send(_code, _subcode, | ||||||
|  | 				_arguments, _attributes) | ||||||
|  | 		if _arguments.has_key('errn'): | ||||||
|  | 			raise aetools.Error, aetools.decodeerror(_arguments) | ||||||
|  | 		# XXXX Optionally decode result | ||||||
|  | 		if _arguments.has_key('----'): | ||||||
|  | 			return _arguments['----'] | ||||||
|  | 
 | ||||||
|  | 	_argmap_select_disk_image_or_DiskScript = { | ||||||
|  | 		'with_prompt' : 'SELp', | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	def select_disk_image_or_DiskScript(self, _no_object=None, _attributes={}, **_arguments): | ||||||
|  | 		"""select disk image or DiskScript: Prompt the user to select a disk image or DiskScript | ||||||
|  | 		Keyword argument with_prompt: the prompt string to be displayed | ||||||
|  | 		Keyword argument _attributes: AppleEvent attribute dictionary | ||||||
|  | 		Returns: a reference to disk image or a DiskScript | ||||||
|  | 		""" | ||||||
|  | 		_code = 'UTIL' | ||||||
|  | 		_subcode = 'SEL3' | ||||||
|  | 
 | ||||||
|  | 		aetools.keysubst(_arguments, self._argmap_select_disk_image_or_DiskScript) | ||||||
|  | 		if _no_object != None: raise TypeError, 'No direct arg expected' | ||||||
|  | 
 | ||||||
|  | 		aetools.enumsubst(_arguments, 'SELp', _Enum_TEXT) | ||||||
|  | 
 | ||||||
|  | 		_reply, _arguments, _attributes = self.send(_code, _subcode, | ||||||
|  | 				_arguments, _attributes) | ||||||
|  | 		if _arguments.has_key('errn'): | ||||||
|  | 			raise aetools.Error, aetools.decodeerror(_arguments) | ||||||
|  | 		# XXXX Optionally decode result | ||||||
|  | 		if _arguments.has_key('----'): | ||||||
|  | 			return _arguments['----'] | ||||||
|  | 
 | ||||||
|  | 	_argmap_select_floppy_disk_image = { | ||||||
|  | 		'with_prompt' : 'SELp', | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	def select_floppy_disk_image(self, _no_object=None, _attributes={}, **_arguments): | ||||||
|  | 		"""select floppy disk image: Prompt the user to select a floppy disk image | ||||||
|  | 		Keyword argument with_prompt: the prompt string to be displayed | ||||||
|  | 		Keyword argument _attributes: AppleEvent attribute dictionary | ||||||
|  | 		Returns: a reference to a floppy disk image | ||||||
|  | 		""" | ||||||
|  | 		_code = 'UTIL' | ||||||
|  | 		_subcode = 'SEL4' | ||||||
|  | 
 | ||||||
|  | 		aetools.keysubst(_arguments, self._argmap_select_floppy_disk_image) | ||||||
|  | 		if _no_object != None: raise TypeError, 'No direct arg expected' | ||||||
|  | 
 | ||||||
|  | 		aetools.enumsubst(_arguments, 'SELp', _Enum_TEXT) | ||||||
|  | 
 | ||||||
|  | 		_reply, _arguments, _attributes = self.send(_code, _subcode, | ||||||
|  | 				_arguments, _attributes) | ||||||
|  | 		if _arguments.has_key('errn'): | ||||||
|  | 			raise aetools.Error, aetools.decodeerror(_arguments) | ||||||
|  | 		# XXXX Optionally decode result | ||||||
|  | 		if _arguments.has_key('----'): | ||||||
|  | 			return _arguments['----'] | ||||||
|  | 
 | ||||||
|  | 	_argmap_select_disk = { | ||||||
|  | 		'with_prompt' : 'SELp', | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	def select_disk(self, _no_object=None, _attributes={}, **_arguments): | ||||||
|  | 		"""select disk: Prompt the user to select a disk volume | ||||||
|  | 		Keyword argument with_prompt: the prompt string to be displayed | ||||||
|  | 		Keyword argument _attributes: AppleEvent attribute dictionary | ||||||
|  | 		Returns: a reference to the disk | ||||||
|  | 		""" | ||||||
|  | 		_code = 'UTIL' | ||||||
|  | 		_subcode = 'SEL5' | ||||||
|  | 
 | ||||||
|  | 		aetools.keysubst(_arguments, self._argmap_select_disk) | ||||||
|  | 		if _no_object != None: raise TypeError, 'No direct arg expected' | ||||||
|  | 
 | ||||||
|  | 		aetools.enumsubst(_arguments, 'SELp', _Enum_TEXT) | ||||||
|  | 
 | ||||||
|  | 		_reply, _arguments, _attributes = self.send(_code, _subcode, | ||||||
|  | 				_arguments, _attributes) | ||||||
|  | 		if _arguments.has_key('errn'): | ||||||
|  | 			raise aetools.Error, aetools.decodeerror(_arguments) | ||||||
|  | 		# XXXX Optionally decode result | ||||||
|  | 		if _arguments.has_key('----'): | ||||||
|  | 			return _arguments['----'] | ||||||
|  | 
 | ||||||
|  | 	_argmap_select_folder = { | ||||||
|  | 		'with_prompt' : 'SELp', | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	def select_folder(self, _no_object=None, _attributes={}, **_arguments): | ||||||
|  | 		"""select folder: Prompt the user to select a folder | ||||||
|  | 		Keyword argument with_prompt: the prompt string to be displayed | ||||||
|  | 		Keyword argument _attributes: AppleEvent attribute dictionary | ||||||
|  | 		Returns: a reference to the folder | ||||||
|  | 		""" | ||||||
|  | 		_code = 'UTIL' | ||||||
|  | 		_subcode = 'SEL6' | ||||||
|  | 
 | ||||||
|  | 		aetools.keysubst(_arguments, self._argmap_select_folder) | ||||||
|  | 		if _no_object != None: raise TypeError, 'No direct arg expected' | ||||||
|  | 
 | ||||||
|  | 		aetools.enumsubst(_arguments, 'SELp', _Enum_TEXT) | ||||||
|  | 
 | ||||||
|  | 		_reply, _arguments, _attributes = self.send(_code, _subcode, | ||||||
|  | 				_arguments, _attributes) | ||||||
|  | 		if _arguments.has_key('errn'): | ||||||
|  | 			raise aetools.Error, aetools.decodeerror(_arguments) | ||||||
|  | 		# XXXX Optionally decode result | ||||||
|  | 		if _arguments.has_key('----'): | ||||||
|  | 			return _arguments['----'] | ||||||
|  | 
 | ||||||
|  | 	_argmap_log = { | ||||||
|  | 		'time_stamp' : 'TSMP', | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	def log(self, _object, _attributes={}, **_arguments): | ||||||
|  | 		"""log: Add a string to the log window | ||||||
|  | 		Required argument: the string to add to the log window | ||||||
|  | 		Keyword argument time_stamp: Should the log entry be time-stamped? (false if not supplied) | ||||||
|  | 		Keyword argument _attributes: AppleEvent attribute dictionary | ||||||
|  | 		""" | ||||||
|  | 		_code = 'UTIL' | ||||||
|  | 		_subcode = 'LOG ' | ||||||
|  | 
 | ||||||
|  | 		aetools.keysubst(_arguments, self._argmap_log) | ||||||
|  | 		_arguments['----'] = _object | ||||||
|  | 
 | ||||||
|  | 		aetools.enumsubst(_arguments, 'TSMP', _Enum_bool) | ||||||
|  | 
 | ||||||
|  | 		_reply, _arguments, _attributes = self.send(_code, _subcode, | ||||||
|  | 				_arguments, _attributes) | ||||||
|  | 		if _arguments.has_key('errn'): | ||||||
|  | 			raise aetools.Error, aetools.decodeerror(_arguments) | ||||||
|  | 		# XXXX Optionally decode result | ||||||
|  | 		if _arguments.has_key('----'): | ||||||
|  | 			return _arguments['----'] | ||||||
|  | 
 | ||||||
|  | _Enum_TEXT = None # XXXX enum TEXT not found!! | ||||||
|  | _Enum_bool = None # XXXX enum bool not found!! | ||||||
|  | 
 | ||||||
|  | # | ||||||
|  | # Indices of types declared in this module | ||||||
|  | # | ||||||
|  | _classdeclarations = { | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | _propdeclarations = { | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | _compdeclarations = { | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | _enumdeclarations = { | ||||||
|  | } | ||||||
							
								
								
									
										36
									
								
								Mac/Demo/applescript/Disk_Copy/__init__.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								Mac/Demo/applescript/Disk_Copy/__init__.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,36 @@ | ||||||
|  | """ | ||||||
|  | Package generated from Macintosh HD:Hulpprogramma's:Disk Copy | ||||||
|  | Resource aete resid 0  | ||||||
|  | """ | ||||||
|  | import aetools | ||||||
|  | Error = aetools.Error | ||||||
|  | import Standard_Suite | ||||||
|  | import Special_Events | ||||||
|  | import Utility_Events | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | _code_to_module = { | ||||||
|  | 	'Core' : Standard_Suite, | ||||||
|  | 	'ddsk' : Special_Events, | ||||||
|  | 	'ddsk' : Utility_Events, | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | _code_to_fullname = { | ||||||
|  | 	'Core' : ('Disk_Copy.Standard_Suite', 'Standard_Suite'), | ||||||
|  | 	'ddsk' : ('Disk_Copy.Special_Events', 'Special_Events'), | ||||||
|  | 	'ddsk' : ('Disk_Copy.Utility_Events', 'Utility_Events'), | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | from Standard_Suite import * | ||||||
|  | from Special_Events import * | ||||||
|  | from Utility_Events import * | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | class Disk_Copy(Standard_Suite_Events, | ||||||
|  | 		Special_Events_Events, | ||||||
|  | 		Utility_Events_Events, | ||||||
|  | 		aetools.TalkTo): | ||||||
|  | 	_signature = 'ddsk' | ||||||
|  | 
 | ||||||
							
								
								
									
										15
									
								
								Mac/Demo/applescript/makedisk.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								Mac/Demo/applescript/makedisk.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,15 @@ | ||||||
|  | import Disk_Copy | ||||||
|  | import macfs | ||||||
|  | import sys | ||||||
|  | 
 | ||||||
|  | talker = Disk_Copy.Disk_Copy(start=1) | ||||||
|  | talker.activate() | ||||||
|  | filespec = macfs.FSSpec('my disk image.img') | ||||||
|  | try: | ||||||
|  | 	objref = talker.create('my disk image', saving_as=filespec, leave_image_mounted=1) | ||||||
|  | except Disk_Copy.Error, arg: | ||||||
|  | 	print "ERROR: my disk image:", arg | ||||||
|  | else: | ||||||
|  | 	print 'objref=', objref | ||||||
|  | print 'Type return to exit-' | ||||||
|  | sys.stdin.readline() | ||||||
|  | @ -1,547 +0,0 @@ | ||||||
| """Suite Eudora Suite: Terms specific to Eudora |  | ||||||
| Level 1, version 1 |  | ||||||
| 
 |  | ||||||
| Generated from flap:Programma's:Eudora Light |  | ||||||
| AETE/AEUT resource version 2/16, language 0, script 0 |  | ||||||
| """ |  | ||||||
| 
 |  | ||||||
| import aetools |  | ||||||
| import MacOS |  | ||||||
| 
 |  | ||||||
| _code = 'CSOm' |  | ||||||
| 
 |  | ||||||
| class Eudora_Suite: |  | ||||||
| 
 |  | ||||||
| 	_argmap_connect = { |  | ||||||
| 		'sending' : 'eSen', |  | ||||||
| 		'checking' : 'eChk', |  | ||||||
| 		'waiting' : 'eIdl', |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	def connect(self, _no_object=None, _attributes={}, **_arguments): |  | ||||||
| 		"""connect: Connect to the mail server and transfer mail |  | ||||||
| 		Keyword argument sending: true to make eudora send queued messages |  | ||||||
| 		Keyword argument checking: true to make eudora check for mail |  | ||||||
| 		Keyword argument waiting: true to make eudora wait for idle time before checking |  | ||||||
| 		Keyword argument _attributes: AppleEvent attribute dictionary |  | ||||||
| 		""" |  | ||||||
| 		_code = 'CSOm' |  | ||||||
| 		_subcode = 'eCon' |  | ||||||
| 
 |  | ||||||
| 		aetools.keysubst(_arguments, self._argmap_connect) |  | ||||||
| 		if _no_object != None: raise TypeError, 'No direct arg expected' |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 		_reply, _arguments, _attributes = self.send(_code, _subcode, |  | ||||||
| 				_arguments, _attributes) |  | ||||||
| 		if _arguments.has_key('errn'): |  | ||||||
| 			raise aetools.Error, aetools.decodeerror(_arguments) |  | ||||||
| 		# XXXX Optionally decode result |  | ||||||
| 		if _arguments.has_key('----'): |  | ||||||
| 			return _arguments['----'] |  | ||||||
| 
 |  | ||||||
| 	_argmap_reply = { |  | ||||||
| 		'quoting' : 'eQTx', |  | ||||||
| 		'everyone' : 'eRAl', |  | ||||||
| 		'self' : 'eSlf', |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	def reply(self, _object, _attributes={}, **_arguments): |  | ||||||
| 		"""reply: Reply to a message |  | ||||||
| 		Required argument: the message to reply to |  | ||||||
| 		Keyword argument quoting: true if you want to quote the original text in the reply |  | ||||||
| 		Keyword argument everyone: true if you want the reply to go to everyone who got the original |  | ||||||
| 		Keyword argument self: true if you want the reply to go to yourself, too |  | ||||||
| 		Keyword argument _attributes: AppleEvent attribute dictionary |  | ||||||
| 		Returns: to the reply message |  | ||||||
| 		""" |  | ||||||
| 		_code = 'CSOm' |  | ||||||
| 		_subcode = 'eRep' |  | ||||||
| 
 |  | ||||||
| 		aetools.keysubst(_arguments, self._argmap_reply) |  | ||||||
| 		_arguments['----'] = _object |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 		_reply, _arguments, _attributes = self.send(_code, _subcode, |  | ||||||
| 				_arguments, _attributes) |  | ||||||
| 		if _arguments.has_key('errn'): |  | ||||||
| 			raise aetools.Error, aetools.decodeerror(_arguments) |  | ||||||
| 		# XXXX Optionally decode result |  | ||||||
| 		if _arguments.has_key('----'): |  | ||||||
| 			return _arguments['----'] |  | ||||||
| 
 |  | ||||||
| 	def forward(self, _object, _attributes={}, **_arguments): |  | ||||||
| 		"""forward: Forward a message |  | ||||||
| 		Required argument: the message to forward |  | ||||||
| 		Keyword argument _attributes: AppleEvent attribute dictionary |  | ||||||
| 		Returns: to the forwarded message |  | ||||||
| 		""" |  | ||||||
| 		_code = 'CSOm' |  | ||||||
| 		_subcode = 'eFwd' |  | ||||||
| 
 |  | ||||||
| 		if _arguments: raise TypeError, 'No optional args expected' |  | ||||||
| 		_arguments['----'] = _object |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 		_reply, _arguments, _attributes = self.send(_code, _subcode, |  | ||||||
| 				_arguments, _attributes) |  | ||||||
| 		if _arguments.has_key('errn'): |  | ||||||
| 			raise aetools.Error, aetools.decodeerror(_arguments) |  | ||||||
| 		# XXXX Optionally decode result |  | ||||||
| 		if _arguments.has_key('----'): |  | ||||||
| 			return _arguments['----'] |  | ||||||
| 
 |  | ||||||
| 	def redirect(self, _object, _attributes={}, **_arguments): |  | ||||||
| 		"""redirect: Redirect a message |  | ||||||
| 		Required argument: the message to redirect |  | ||||||
| 		Keyword argument _attributes: AppleEvent attribute dictionary |  | ||||||
| 		Returns: to the redirected message |  | ||||||
| 		""" |  | ||||||
| 		_code = 'CSOm' |  | ||||||
| 		_subcode = 'eRdr' |  | ||||||
| 
 |  | ||||||
| 		if _arguments: raise TypeError, 'No optional args expected' |  | ||||||
| 		_arguments['----'] = _object |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 		_reply, _arguments, _attributes = self.send(_code, _subcode, |  | ||||||
| 				_arguments, _attributes) |  | ||||||
| 		if _arguments.has_key('errn'): |  | ||||||
| 			raise aetools.Error, aetools.decodeerror(_arguments) |  | ||||||
| 		# XXXX Optionally decode result |  | ||||||
| 		if _arguments.has_key('----'): |  | ||||||
| 			return _arguments['----'] |  | ||||||
| 
 |  | ||||||
| 	def send_again(self, _object, _attributes={}, **_arguments): |  | ||||||
| 		"""send again: Send a message again |  | ||||||
| 		Required argument: the message to send again |  | ||||||
| 		Keyword argument _attributes: AppleEvent attribute dictionary |  | ||||||
| 		Returns: to the message sent again |  | ||||||
| 		""" |  | ||||||
| 		_code = 'CSOm' |  | ||||||
| 		_subcode = 'eSav' |  | ||||||
| 
 |  | ||||||
| 		if _arguments: raise TypeError, 'No optional args expected' |  | ||||||
| 		_arguments['----'] = _object |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 		_reply, _arguments, _attributes = self.send(_code, _subcode, |  | ||||||
| 				_arguments, _attributes) |  | ||||||
| 		if _arguments.has_key('errn'): |  | ||||||
| 			raise aetools.Error, aetools.decodeerror(_arguments) |  | ||||||
| 		# XXXX Optionally decode result |  | ||||||
| 		if _arguments.has_key('----'): |  | ||||||
| 			return _arguments['----'] |  | ||||||
| 
 |  | ||||||
| 	_argmap_queue = { |  | ||||||
| 		'_for' : 'eWhn', |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	def queue(self, _object, _attributes={}, **_arguments): |  | ||||||
| 		"""queue: Queue a message to be sent |  | ||||||
| 		Required argument: the message to queue |  | ||||||
| 		Keyword argument _for: date to send the message, in seconds since 1904, UTC |  | ||||||
| 		Keyword argument _attributes: AppleEvent attribute dictionary |  | ||||||
| 		""" |  | ||||||
| 		_code = 'CSOm' |  | ||||||
| 		_subcode = 'eQue' |  | ||||||
| 
 |  | ||||||
| 		aetools.keysubst(_arguments, self._argmap_queue) |  | ||||||
| 		_arguments['----'] = _object |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 		_reply, _arguments, _attributes = self.send(_code, _subcode, |  | ||||||
| 				_arguments, _attributes) |  | ||||||
| 		if _arguments.has_key('errn'): |  | ||||||
| 			raise aetools.Error, aetools.decodeerror(_arguments) |  | ||||||
| 		# XXXX Optionally decode result |  | ||||||
| 		if _arguments.has_key('----'): |  | ||||||
| 			return _arguments['----'] |  | ||||||
| 
 |  | ||||||
| 	def unqueue(self, _object, _attributes={}, **_arguments): |  | ||||||
| 		"""unqueue: Remove a message from the queue, so it won¹t be sent |  | ||||||
| 		Required argument: the message to unqueue |  | ||||||
| 		Keyword argument _attributes: AppleEvent attribute dictionary |  | ||||||
| 		""" |  | ||||||
| 		_code = 'CSOm' |  | ||||||
| 		_subcode = 'eUnQ' |  | ||||||
| 
 |  | ||||||
| 		if _arguments: raise TypeError, 'No optional args expected' |  | ||||||
| 		_arguments['----'] = _object |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 		_reply, _arguments, _attributes = self.send(_code, _subcode, |  | ||||||
| 				_arguments, _attributes) |  | ||||||
| 		if _arguments.has_key('errn'): |  | ||||||
| 			raise aetools.Error, aetools.decodeerror(_arguments) |  | ||||||
| 		# XXXX Optionally decode result |  | ||||||
| 		if _arguments.has_key('----'): |  | ||||||
| 			return _arguments['----'] |  | ||||||
| 
 |  | ||||||
| 	_argmap_attach_to = { |  | ||||||
| 		'documents' : 'eDcl', |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	def attach_to(self, _object, _attributes={}, **_arguments): |  | ||||||
| 		"""attach to: Attach documents to a message |  | ||||||
| 		Required argument: the message to attach the documents to |  | ||||||
| 		Keyword argument documents: list of documents to attach |  | ||||||
| 		Keyword argument _attributes: AppleEvent attribute dictionary |  | ||||||
| 		""" |  | ||||||
| 		_code = 'CSOm' |  | ||||||
| 		_subcode = 'eAtc' |  | ||||||
| 
 |  | ||||||
| 		aetools.keysubst(_arguments, self._argmap_attach_to) |  | ||||||
| 		_arguments['----'] = _object |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 		_reply, _arguments, _attributes = self.send(_code, _subcode, |  | ||||||
| 				_arguments, _attributes) |  | ||||||
| 		if _arguments.has_key('errn'): |  | ||||||
| 			raise aetools.Error, aetools.decodeerror(_arguments) |  | ||||||
| 		# XXXX Optionally decode result |  | ||||||
| 		if _arguments.has_key('----'): |  | ||||||
| 			return _arguments['----'] |  | ||||||
| 
 |  | ||||||
| 	_argmap_start_notifying = { |  | ||||||
| 		'when' : 'eWHp', |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	def start_notifying(self, _object, _attributes={}, **_arguments): |  | ||||||
| 		"""start notifying: Notify an application of things that happen |  | ||||||
| 		Required argument: an application to notify |  | ||||||
| 		Keyword argument when: what to notify the application of |  | ||||||
| 		Keyword argument _attributes: AppleEvent attribute dictionary |  | ||||||
| 		""" |  | ||||||
| 		_code = 'CSOm' |  | ||||||
| 		_subcode = 'nIns' |  | ||||||
| 
 |  | ||||||
| 		aetools.keysubst(_arguments, self._argmap_start_notifying) |  | ||||||
| 		_arguments['----'] = _object |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 		_reply, _arguments, _attributes = self.send(_code, _subcode, |  | ||||||
| 				_arguments, _attributes) |  | ||||||
| 		if _arguments.has_key('errn'): |  | ||||||
| 			raise aetools.Error, aetools.decodeerror(_arguments) |  | ||||||
| 		# XXXX Optionally decode result |  | ||||||
| 		if _arguments.has_key('----'): |  | ||||||
| 			return _arguments['----'] |  | ||||||
| 
 |  | ||||||
| 	_argmap_stop_notifying = { |  | ||||||
| 		'when' : 'eWHp', |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	def stop_notifying(self, _object, _attributes={}, **_arguments): |  | ||||||
| 		"""stop notifying: Stop notifying applications of things that are happening |  | ||||||
| 		Required argument: an application currently being notified |  | ||||||
| 		Keyword argument when: the things no longer to notify it of |  | ||||||
| 		Keyword argument _attributes: AppleEvent attribute dictionary |  | ||||||
| 		""" |  | ||||||
| 		_code = 'CSOm' |  | ||||||
| 		_subcode = 'nRem' |  | ||||||
| 
 |  | ||||||
| 		aetools.keysubst(_arguments, self._argmap_stop_notifying) |  | ||||||
| 		_arguments['----'] = _object |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 		_reply, _arguments, _attributes = self.send(_code, _subcode, |  | ||||||
| 				_arguments, _attributes) |  | ||||||
| 		if _arguments.has_key('errn'): |  | ||||||
| 			raise aetools.Error, aetools.decodeerror(_arguments) |  | ||||||
| 		# XXXX Optionally decode result |  | ||||||
| 		if _arguments.has_key('----'): |  | ||||||
| 			return _arguments['----'] |  | ||||||
| 
 |  | ||||||
| 	_argmap_notice = { |  | ||||||
| 		'occurrence' : 'eWHp', |  | ||||||
| 		'messages' : 'eMLs', |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	def notice(self, _no_object=None, _attributes={}, **_arguments): |  | ||||||
| 		"""notice: Eudora sends this event to notify an application that something happened |  | ||||||
| 		Keyword argument occurrence: what happened |  | ||||||
| 		Keyword argument messages: of the messages involved |  | ||||||
| 		Keyword argument _attributes: AppleEvent attribute dictionary |  | ||||||
| 		""" |  | ||||||
| 		_code = 'CSOm' |  | ||||||
| 		_subcode = 'eNot' |  | ||||||
| 
 |  | ||||||
| 		aetools.keysubst(_arguments, self._argmap_notice) |  | ||||||
| 		if _no_object != None: raise TypeError, 'No direct arg expected' |  | ||||||
| 
 |  | ||||||
| 		aetools.enumsubst(_arguments, 'eWHp', _Enum_eNot) |  | ||||||
| 
 |  | ||||||
| 		_reply, _arguments, _attributes = self.send(_code, _subcode, |  | ||||||
| 				_arguments, _attributes) |  | ||||||
| 		if _arguments.has_key('errn'): |  | ||||||
| 			raise aetools.Error, aetools.decodeerror(_arguments) |  | ||||||
| 		# XXXX Optionally decode result |  | ||||||
| 		if _arguments.has_key('----'): |  | ||||||
| 			return _arguments['----'] |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| class mail_folder(aetools.ComponentItem): |  | ||||||
| 	"""mail folder - A folder containing mailboxes or other mail folders.""" |  | ||||||
| 	want = 'euMF' |  | ||||||
| class name(aetools.NProperty): |  | ||||||
| 	"""name - the name""" |  | ||||||
| 	which = 'pnam' |  | ||||||
| 	want = 'itxt' |  | ||||||
| #        element 'euMB' as ['indx', 'name'] |  | ||||||
| #        element 'euMF' as ['indx', 'name'] |  | ||||||
| 
 |  | ||||||
| class mailbox(aetools.ComponentItem): |  | ||||||
| 	"""mailbox - A mailbox.""" |  | ||||||
| 	want = 'euMB' |  | ||||||
| # repeated property name the name of the mail folder |  | ||||||
| class space_wasted(aetools.NProperty): |  | ||||||
| 	"""space wasted - the amount of waste space in the mailbox""" |  | ||||||
| 	which = 'euWS' |  | ||||||
| 	want = 'long' |  | ||||||
| class space_required(aetools.NProperty): |  | ||||||
| 	"""space required - the minimum amount of space required to hold the mailbox""" |  | ||||||
| 	which = 'euNS' |  | ||||||
| 	want = 'long' |  | ||||||
| class location(aetools.NProperty): |  | ||||||
| 	"""location - the file the mailbox is stored in""" |  | ||||||
| 	which = 'euFS' |  | ||||||
| 	want = 'fss ' |  | ||||||
| class toc_location(aetools.NProperty): |  | ||||||
| 	"""toc location - the file the table of contents is stored in""" |  | ||||||
| 	which = 'eTFS' |  | ||||||
| 	want = 'fss ' |  | ||||||
| #        element 'euMS' as ['indx'] |  | ||||||
| 
 |  | ||||||
| class message(aetools.ComponentItem): |  | ||||||
| 	"""message - A message""" |  | ||||||
| 	want = 'euMS' |  | ||||||
| class body(aetools.NProperty): |  | ||||||
| 	"""body - the body of the message""" |  | ||||||
| 	which = 'eBod' |  | ||||||
| 	want = 'TEXT' |  | ||||||
| class priority(aetools.NProperty): |  | ||||||
| 	"""priority - the priority""" |  | ||||||
| 	which = 'euPY' |  | ||||||
| 	want = 'long' |  | ||||||
| class label(aetools.NProperty): |  | ||||||
| 	"""label - the index of the label""" |  | ||||||
| 	which = 'eLbl' |  | ||||||
| 	want = 'long' |  | ||||||
| class status(aetools.NProperty): |  | ||||||
| 	"""status - the message status""" |  | ||||||
| 	which = 'euST' |  | ||||||
| 	want = 'eSta' |  | ||||||
| class sender(aetools.NProperty): |  | ||||||
| 	"""sender - the sender as appearing in the message summary""" |  | ||||||
| 	which = 'euSe' |  | ||||||
| 	want = 'itxt' |  | ||||||
| class date(aetools.NProperty): |  | ||||||
| 	"""date - the date as appearing in the message summary""" |  | ||||||
| 	which = 'euDa' |  | ||||||
| 	want = 'itxt' |  | ||||||
| class subject(aetools.NProperty): |  | ||||||
| 	"""subject - the subject as appearing in the message summary""" |  | ||||||
| 	which = 'euSu' |  | ||||||
| 	want = 'itxt' |  | ||||||
| class size(aetools.NProperty): |  | ||||||
| 	"""size - the size of the message""" |  | ||||||
| 	which = 'euSi' |  | ||||||
| 	want = 'long' |  | ||||||
| class outgoing(aetools.NProperty): |  | ||||||
| 	"""outgoing - is the message is outgoing?""" |  | ||||||
| 	which = 'euOu' |  | ||||||
| 	want = 'bool' |  | ||||||
| class signature(aetools.NProperty): |  | ||||||
| 	"""signature - which signature the message should have""" |  | ||||||
| 	which = 'eSig' |  | ||||||
| 	want = 'eSig' |  | ||||||
| class QP(aetools.NProperty): |  | ||||||
| 	"""QP - is Eudora allowed to encode text?""" |  | ||||||
| 	which = 'eMQP' |  | ||||||
| 	want = 'bool' |  | ||||||
| class return_receipt(aetools.NProperty): |  | ||||||
| 	"""return receipt - is a return receipt is requested?""" |  | ||||||
| 	which = 'eRRR' |  | ||||||
| 	want = 'bool' |  | ||||||
| class wrap(aetools.NProperty): |  | ||||||
| 	"""wrap - should the text be wrapped when sent?""" |  | ||||||
| 	which = 'eWrp' |  | ||||||
| 	want = 'bool' |  | ||||||
| class tab_expansion(aetools.NProperty): |  | ||||||
| 	"""tab expansion - should tabs get expanded to spaces?""" |  | ||||||
| 	which = 'eTab' |  | ||||||
| 	want = 'bool' |  | ||||||
| class keep_copy(aetools.NProperty): |  | ||||||
| 	"""keep copy - should a copy should be kept after message is sent?""" |  | ||||||
| 	which = 'eCpy' |  | ||||||
| 	want = 'bool' |  | ||||||
| class preserve_macintosh_info(aetools.NProperty): |  | ||||||
| 	"""preserve macintosh info - should Macintosh information always be sent with attachments?""" |  | ||||||
| 	which = 'eXTX' |  | ||||||
| 	want = 'bool' |  | ||||||
| class attachment_encoding(aetools.NProperty): |  | ||||||
| 	"""attachment encoding - the type of encoding to use for attachments""" |  | ||||||
| 	which = 'eATy' |  | ||||||
| 	want = 'eAty' |  | ||||||
| class show_all_headers(aetools.NProperty): |  | ||||||
| 	"""show all headers - should all headers be visible?""" |  | ||||||
| 	which = 'eBla' |  | ||||||
| 	want = 'bool' |  | ||||||
| class transliteration_table(aetools.NProperty): |  | ||||||
| 	"""transliteration table - the resource id of the transliteration table""" |  | ||||||
| 	which = 'eTbl' |  | ||||||
| 	want = 'long' |  | ||||||
| class will_be_fetched(aetools.NProperty): |  | ||||||
| 	"""will be fetched - will the message be [re]fetched on next check?""" |  | ||||||
| 	which = 'eWFh' |  | ||||||
| 	want = 'bool' |  | ||||||
| class will_be_deleted(aetools.NProperty): |  | ||||||
| 	"""will be deleted - will the message be deleted from server on next check?""" |  | ||||||
| 	which = 'eWDl' |  | ||||||
| 	want = 'bool' |  | ||||||
| #        element 'euFd' as ['name'] |  | ||||||
| 
 |  | ||||||
| class field(aetools.ComponentItem): |  | ||||||
| 	"""field - An RFC 822 header field in a message (field named "" is the body)""" |  | ||||||
| 	want = 'euFd' |  | ||||||
| 
 |  | ||||||
| class setting(aetools.ComponentItem): |  | ||||||
| 	"""setting - Eudora's settings""" |  | ||||||
| 	want = 'ePrf' |  | ||||||
| mail_folder._propdict = { |  | ||||||
| 	'name' : name, |  | ||||||
| } |  | ||||||
| mail_folder._elemdict = { |  | ||||||
| 	'mailbox' : mailbox, |  | ||||||
| 	'mail_folder' : mail_folder, |  | ||||||
| } |  | ||||||
| mailbox._propdict = { |  | ||||||
| 	'name' : name, |  | ||||||
| 	'space_wasted' : space_wasted, |  | ||||||
| 	'space_required' : space_required, |  | ||||||
| 	'location' : location, |  | ||||||
| 	'toc_location' : toc_location, |  | ||||||
| } |  | ||||||
| mailbox._elemdict = { |  | ||||||
| 	'message' : message, |  | ||||||
| } |  | ||||||
| message._propdict = { |  | ||||||
| 	'body' : body, |  | ||||||
| 	'priority' : priority, |  | ||||||
| 	'label' : label, |  | ||||||
| 	'status' : status, |  | ||||||
| 	'sender' : sender, |  | ||||||
| 	'date' : date, |  | ||||||
| 	'subject' : subject, |  | ||||||
| 	'size' : size, |  | ||||||
| 	'outgoing' : outgoing, |  | ||||||
| 	'signature' : signature, |  | ||||||
| 	'QP' : QP, |  | ||||||
| 	'return_receipt' : return_receipt, |  | ||||||
| 	'wrap' : wrap, |  | ||||||
| 	'tab_expansion' : tab_expansion, |  | ||||||
| 	'keep_copy' : keep_copy, |  | ||||||
| 	'preserve_macintosh_info' : preserve_macintosh_info, |  | ||||||
| 	'attachment_encoding' : attachment_encoding, |  | ||||||
| 	'show_all_headers' : show_all_headers, |  | ||||||
| 	'transliteration_table' : transliteration_table, |  | ||||||
| 	'will_be_fetched' : will_be_fetched, |  | ||||||
| 	'will_be_deleted' : will_be_deleted, |  | ||||||
| } |  | ||||||
| message._elemdict = { |  | ||||||
| 	'field' : field, |  | ||||||
| } |  | ||||||
| field._propdict = { |  | ||||||
| } |  | ||||||
| field._elemdict = { |  | ||||||
| } |  | ||||||
| setting._propdict = { |  | ||||||
| } |  | ||||||
| setting._elemdict = { |  | ||||||
| } |  | ||||||
| _Enum_eSta = { |  | ||||||
| 	'unread' : 'euS\001',	# has not been read |  | ||||||
| 	'already_read' : 'euS\002',	# has been read |  | ||||||
| 	'replied' : 'euS\003',	# has been replied to |  | ||||||
| 	'forwarded' : 'euS\010',	# has been forwarded |  | ||||||
| 	'redirected' : 'euS\004',	# has been redirected |  | ||||||
| 	'not_sendable' : 'euS\005',	# cannot be sent |  | ||||||
| 	'sendable' : 'euS\006',	# can be sent |  | ||||||
| 	'queued' : 'euS\007',	# queued for delivery |  | ||||||
| 	'sent' : 'euS\011',	# has been sent |  | ||||||
| 	'never_sent' : 'euS\012',	# never was sent |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| _Enum_eSig = { |  | ||||||
| 	'none' : 'sig\000',	# no signature |  | ||||||
| 	'standard' : 'sig\001',	# standard signature file |  | ||||||
| 	'alternate' : 'sig\002',	# alternate signature file |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| _Enum_eAty = { |  | ||||||
| 	'AppleDouble' : 'atc\000',	# AppleDouble format |  | ||||||
| 	'AppleSingle' : 'atc\001',	# AppleSingle format |  | ||||||
| 	'BinHex' : 'atc\002',	# BinHex format |  | ||||||
| 	'uuencode' : 'atc\003',	# uuencode format |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| _Enum_eNot = { |  | ||||||
| 	'mail_arrives' : 'wArv',	# mail arrival |  | ||||||
| 	'mail_sent' : 'wSnt',	# mail has been sent |  | ||||||
| 	'will_connect' : 'wWCn',	# eudora is about to connect to a mail server |  | ||||||
| 	'has_connected' : 'wHCn',	# eudora has finished talking to a mail server |  | ||||||
| 	'has_manually_filtered' : 'mFil',	# eudora has finished manually filtering messages |  | ||||||
| 	'opens_filters' : 'wFil',	# user has requested Eudora open the filter window |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| # |  | ||||||
| # Indices of types declared in this module |  | ||||||
| # |  | ||||||
| _classdeclarations = { |  | ||||||
| 	'euMB' : mailbox, |  | ||||||
| 	'euMS' : message, |  | ||||||
| 	'euMF' : mail_folder, |  | ||||||
| 	'ePrf' : setting, |  | ||||||
| 	'euFd' : field, |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| _propdeclarations = { |  | ||||||
| 	'eWFh' : will_be_fetched, |  | ||||||
| 	'euDa' : date, |  | ||||||
| 	'euSi' : size, |  | ||||||
| 	'eRRR' : return_receipt, |  | ||||||
| 	'pnam' : name, |  | ||||||
| 	'euSe' : sender, |  | ||||||
| 	'eWrp' : wrap, |  | ||||||
| 	'eSig' : signature, |  | ||||||
| 	'euOu' : outgoing, |  | ||||||
| 	'eMQP' : QP, |  | ||||||
| 	'eTFS' : toc_location, |  | ||||||
| 	'eWDl' : will_be_deleted, |  | ||||||
| 	'eLbl' : label, |  | ||||||
| 	'eATy' : attachment_encoding, |  | ||||||
| 	'euSu' : subject, |  | ||||||
| 	'eBla' : show_all_headers, |  | ||||||
| 	'eCpy' : keep_copy, |  | ||||||
| 	'euWS' : space_wasted, |  | ||||||
| 	'eBod' : body, |  | ||||||
| 	'euNS' : space_required, |  | ||||||
| 	'eTab' : tab_expansion, |  | ||||||
| 	'eTbl' : transliteration_table, |  | ||||||
| 	'eXTX' : preserve_macintosh_info, |  | ||||||
| 	'euFS' : location, |  | ||||||
| 	'euST' : status, |  | ||||||
| 	'euPY' : priority, |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| _compdeclarations = { |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| _enumdeclarations = { |  | ||||||
| 	'eAty' : _Enum_eAty, |  | ||||||
| 	'eNot' : _Enum_eNot, |  | ||||||
| 	'eSta' : _Enum_eSta, |  | ||||||
| 	'eSig' : _Enum_eSig, |  | ||||||
| } |  | ||||||
|  | @ -1,272 +0,0 @@ | ||||||
| """Suite Standard Suite: Common terms for most applications |  | ||||||
| Level 1, version 1 |  | ||||||
| 
 |  | ||||||
| Generated from flap:Programma's:Eudora Light |  | ||||||
| AETE/AEUT resource version 2/16, language 0, script 0 |  | ||||||
| """ |  | ||||||
| 
 |  | ||||||
| import aetools |  | ||||||
| import MacOS |  | ||||||
| 
 |  | ||||||
| _code = 'CoRe' |  | ||||||
| 
 |  | ||||||
| class Standard_Suite: |  | ||||||
| 
 |  | ||||||
| 	def close(self, _object, _attributes={}, **_arguments): |  | ||||||
| 		"""close: Close an object |  | ||||||
| 		Required argument: the object to close |  | ||||||
| 		Keyword argument _attributes: AppleEvent attribute dictionary |  | ||||||
| 		""" |  | ||||||
| 		_code = 'core' |  | ||||||
| 		_subcode = 'clos' |  | ||||||
| 
 |  | ||||||
| 		if _arguments: raise TypeError, 'No optional args expected' |  | ||||||
| 		_arguments['----'] = _object |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 		_reply, _arguments, _attributes = self.send(_code, _subcode, |  | ||||||
| 				_arguments, _attributes) |  | ||||||
| 		if _arguments.has_key('errn'): |  | ||||||
| 			raise aetools.Error, aetools.decodeerror(_arguments) |  | ||||||
| 		# XXXX Optionally decode result |  | ||||||
| 		if _arguments.has_key('----'): |  | ||||||
| 			return _arguments['----'] |  | ||||||
| 
 |  | ||||||
| 	_argmap_count = { |  | ||||||
| 		'each' : 'kocl', |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	def count(self, _object, _attributes={}, **_arguments): |  | ||||||
| 		"""count: Return the number of elements of a particular class within an object |  | ||||||
| 		Required argument: the object whose elements are to be counted |  | ||||||
| 		Keyword argument each: the class of the elements to be counted. Keyword 'each' is optional in AppleScript |  | ||||||
| 		Keyword argument _attributes: AppleEvent attribute dictionary |  | ||||||
| 		Returns: the number of elements |  | ||||||
| 		""" |  | ||||||
| 		_code = 'core' |  | ||||||
| 		_subcode = 'cnte' |  | ||||||
| 
 |  | ||||||
| 		aetools.keysubst(_arguments, self._argmap_count) |  | ||||||
| 		_arguments['----'] = _object |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 		_reply, _arguments, _attributes = self.send(_code, _subcode, |  | ||||||
| 				_arguments, _attributes) |  | ||||||
| 		if _arguments.has_key('errn'): |  | ||||||
| 			raise aetools.Error, aetools.decodeerror(_arguments) |  | ||||||
| 		# XXXX Optionally decode result |  | ||||||
| 		if _arguments.has_key('----'): |  | ||||||
| 			return _arguments['----'] |  | ||||||
| 
 |  | ||||||
| 	def exists(self, _object, _attributes={}, **_arguments): |  | ||||||
| 		"""exists: Verify if an object exists |  | ||||||
| 		Required argument: the object in question |  | ||||||
| 		Keyword argument _attributes: AppleEvent attribute dictionary |  | ||||||
| 		Returns: true if it exists, false if not |  | ||||||
| 		""" |  | ||||||
| 		_code = 'core' |  | ||||||
| 		_subcode = 'doex' |  | ||||||
| 
 |  | ||||||
| 		if _arguments: raise TypeError, 'No optional args expected' |  | ||||||
| 		_arguments['----'] = _object |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 		_reply, _arguments, _attributes = self.send(_code, _subcode, |  | ||||||
| 				_arguments, _attributes) |  | ||||||
| 		if _arguments.has_key('errn'): |  | ||||||
| 			raise aetools.Error, aetools.decodeerror(_arguments) |  | ||||||
| 		# XXXX Optionally decode result |  | ||||||
| 		if _arguments.has_key('----'): |  | ||||||
| 			return _arguments['----'] |  | ||||||
| 
 |  | ||||||
| 	def get(self, _object, _attributes={}, **_arguments): |  | ||||||
| 		"""get: Get the data for an object |  | ||||||
| 		Required argument: the object whose data is to be returned |  | ||||||
| 		Keyword argument _attributes: AppleEvent attribute dictionary |  | ||||||
| 		Returns: the data from the object |  | ||||||
| 		""" |  | ||||||
| 		_code = 'core' |  | ||||||
| 		_subcode = 'getd' |  | ||||||
| 
 |  | ||||||
| 		if _arguments: raise TypeError, 'No optional args expected' |  | ||||||
| 		_arguments['----'] = _object |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 		_reply, _arguments, _attributes = self.send(_code, _subcode, |  | ||||||
| 				_arguments, _attributes) |  | ||||||
| 		if _arguments.has_key('errn'): |  | ||||||
| 			raise aetools.Error, aetools.decodeerror(_arguments) |  | ||||||
| 		# XXXX Optionally decode result |  | ||||||
| 		if _arguments.has_key('----'): |  | ||||||
| 			return _arguments['----'] |  | ||||||
| 
 |  | ||||||
| 	_argmap_make = { |  | ||||||
| 		'new' : 'kocl', |  | ||||||
| 		'at' : 'insh', |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	def make(self, _no_object=None, _attributes={}, **_arguments): |  | ||||||
| 		"""make: Make a new element |  | ||||||
| 		Keyword argument new: the class of the new element. Keyword 'new' is optional in AppleScript |  | ||||||
| 		Keyword argument at: the location at which to insert the element |  | ||||||
| 		Keyword argument _attributes: AppleEvent attribute dictionary |  | ||||||
| 		Returns: to the new object |  | ||||||
| 		""" |  | ||||||
| 		_code = 'core' |  | ||||||
| 		_subcode = 'crel' |  | ||||||
| 
 |  | ||||||
| 		aetools.keysubst(_arguments, self._argmap_make) |  | ||||||
| 		if _no_object != None: raise TypeError, 'No direct arg expected' |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 		_reply, _arguments, _attributes = self.send(_code, _subcode, |  | ||||||
| 				_arguments, _attributes) |  | ||||||
| 		if _arguments.has_key('errn'): |  | ||||||
| 			raise aetools.Error, aetools.decodeerror(_arguments) |  | ||||||
| 		# XXXX Optionally decode result |  | ||||||
| 		if _arguments.has_key('----'): |  | ||||||
| 			return _arguments['----'] |  | ||||||
| 
 |  | ||||||
| 	_argmap_move = { |  | ||||||
| 		'to' : 'insh', |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	def move(self, _object, _attributes={}, **_arguments): |  | ||||||
| 		"""move: Move object to a new location |  | ||||||
| 		Required argument: the object to move |  | ||||||
| 		Keyword argument to: the new location for the object |  | ||||||
| 		Keyword argument _attributes: AppleEvent attribute dictionary |  | ||||||
| 		Returns: to the object after they have been moved |  | ||||||
| 		""" |  | ||||||
| 		_code = 'core' |  | ||||||
| 		_subcode = 'move' |  | ||||||
| 
 |  | ||||||
| 		aetools.keysubst(_arguments, self._argmap_move) |  | ||||||
| 		_arguments['----'] = _object |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 		_reply, _arguments, _attributes = self.send(_code, _subcode, |  | ||||||
| 				_arguments, _attributes) |  | ||||||
| 		if _arguments.has_key('errn'): |  | ||||||
| 			raise aetools.Error, aetools.decodeerror(_arguments) |  | ||||||
| 		# XXXX Optionally decode result |  | ||||||
| 		if _arguments.has_key('----'): |  | ||||||
| 			return _arguments['----'] |  | ||||||
| 
 |  | ||||||
| 	_argmap_duplicate = { |  | ||||||
| 		'to' : 'insh', |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	def duplicate(self, _object, _attributes={}, **_arguments): |  | ||||||
| 		"""duplicate: Make a duplicate object |  | ||||||
| 		Required argument: the object to move |  | ||||||
| 		Keyword argument to: the new location for the object |  | ||||||
| 		Keyword argument _attributes: AppleEvent attribute dictionary |  | ||||||
| 		Returns: to the object after they have been moved |  | ||||||
| 		""" |  | ||||||
| 		_code = 'core' |  | ||||||
| 		_subcode = 'clon' |  | ||||||
| 
 |  | ||||||
| 		aetools.keysubst(_arguments, self._argmap_duplicate) |  | ||||||
| 		_arguments['----'] = _object |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 		_reply, _arguments, _attributes = self.send(_code, _subcode, |  | ||||||
| 				_arguments, _attributes) |  | ||||||
| 		if _arguments.has_key('errn'): |  | ||||||
| 			raise aetools.Error, aetools.decodeerror(_arguments) |  | ||||||
| 		# XXXX Optionally decode result |  | ||||||
| 		if _arguments.has_key('----'): |  | ||||||
| 			return _arguments['----'] |  | ||||||
| 
 |  | ||||||
| 	def open(self, _object, _attributes={}, **_arguments): |  | ||||||
| 		"""open: Open the specified object |  | ||||||
| 		Required argument: list of objects to open |  | ||||||
| 		Keyword argument _attributes: AppleEvent attribute dictionary |  | ||||||
| 		""" |  | ||||||
| 		_code = 'aevt' |  | ||||||
| 		_subcode = 'odoc' |  | ||||||
| 
 |  | ||||||
| 		if _arguments: raise TypeError, 'No optional args expected' |  | ||||||
| 		_arguments['----'] = _object |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 		_reply, _arguments, _attributes = self.send(_code, _subcode, |  | ||||||
| 				_arguments, _attributes) |  | ||||||
| 		if _arguments.has_key('errn'): |  | ||||||
| 			raise aetools.Error, aetools.decodeerror(_arguments) |  | ||||||
| 		# XXXX Optionally decode result |  | ||||||
| 		if _arguments.has_key('----'): |  | ||||||
| 			return _arguments['----'] |  | ||||||
| 
 |  | ||||||
| 	def _print(self, _object, _attributes={}, **_arguments): |  | ||||||
| 		"""print: Print the specified message |  | ||||||
| 		Required argument: the message to print |  | ||||||
| 		Keyword argument _attributes: AppleEvent attribute dictionary |  | ||||||
| 		""" |  | ||||||
| 		_code = 'aevt' |  | ||||||
| 		_subcode = 'pdoc' |  | ||||||
| 
 |  | ||||||
| 		if _arguments: raise TypeError, 'No optional args expected' |  | ||||||
| 		_arguments['----'] = _object |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 		_reply, _arguments, _attributes = self.send(_code, _subcode, |  | ||||||
| 				_arguments, _attributes) |  | ||||||
| 		if _arguments.has_key('errn'): |  | ||||||
| 			raise aetools.Error, aetools.decodeerror(_arguments) |  | ||||||
| 		# XXXX Optionally decode result |  | ||||||
| 		if _arguments.has_key('----'): |  | ||||||
| 			return _arguments['----'] |  | ||||||
| 
 |  | ||||||
| 	def save(self, _object, _attributes={}, **_arguments): |  | ||||||
| 		"""save: Save an object |  | ||||||
| 		Required argument: the composition message to save |  | ||||||
| 		Keyword argument _attributes: AppleEvent attribute dictionary |  | ||||||
| 		""" |  | ||||||
| 		_code = 'core' |  | ||||||
| 		_subcode = 'save' |  | ||||||
| 
 |  | ||||||
| 		if _arguments: raise TypeError, 'No optional args expected' |  | ||||||
| 		_arguments['----'] = _object |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 		_reply, _arguments, _attributes = self.send(_code, _subcode, |  | ||||||
| 				_arguments, _attributes) |  | ||||||
| 		if _arguments.has_key('errn'): |  | ||||||
| 			raise aetools.Error, aetools.decodeerror(_arguments) |  | ||||||
| 		# XXXX Optionally decode result |  | ||||||
| 		if _arguments.has_key('----'): |  | ||||||
| 			return _arguments['----'] |  | ||||||
| 
 |  | ||||||
| 	_argmap_set = { |  | ||||||
| 		'to' : 'data', |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	def set(self, _object, _attributes={}, **_arguments): |  | ||||||
| 		"""set: Set an object's data |  | ||||||
| 		Required argument: the object to change |  | ||||||
| 		Keyword argument to: the new value |  | ||||||
| 		Keyword argument _attributes: AppleEvent attribute dictionary |  | ||||||
| 		""" |  | ||||||
| 		_code = 'core' |  | ||||||
| 		_subcode = 'setd' |  | ||||||
| 
 |  | ||||||
| 		aetools.keysubst(_arguments, self._argmap_set) |  | ||||||
| 		_arguments['----'] = _object |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 		_reply, _arguments, _attributes = self.send(_code, _subcode, |  | ||||||
| 				_arguments, _attributes) |  | ||||||
| 		if _arguments.has_key('errn'): |  | ||||||
| 			raise aetools.Error, aetools.decodeerror(_arguments) |  | ||||||
| 		# XXXX Optionally decode result |  | ||||||
| 		if _arguments.has_key('----'): |  | ||||||
| 			return _arguments['----'] |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| #    Class 'application' ('capp') -- 'An application program' |  | ||||||
| #        property 'version' ('vers') 'itxt' -- 'the version number' [] |  | ||||||
| #        property 'selected text' ('eStx') 'TEXT' -- 'the text of the user\325s current selection' [] |  | ||||||
| #        element 'euMF' as ['indx', 'name'] |  | ||||||
| #        element 'ePrf' as ['indx'] |  | ||||||
|  | @ -1,46 +0,0 @@ | ||||||
| """A test program that allows us to control Eudora""" |  | ||||||
| 
 |  | ||||||
| import sys |  | ||||||
| import aetools |  | ||||||
| import Eudora_Suite |  | ||||||
| import Required_Suite |  | ||||||
| import Standard_Suite |  | ||||||
| import MacOS |  | ||||||
| 
 |  | ||||||
| class Eudora(Eudora_Suite.Eudora_Suite, Required_Suite.Required_Suite, \ |  | ||||||
| 				Standard_Suite.Standard_Suite, aetools.TalkTo): |  | ||||||
| 	"""A class that can talk to Eudora""" |  | ||||||
| 	pass |  | ||||||
| 	 |  | ||||||
| # The Creator signature of eudora: |  | ||||||
| SIGNATURE="CSOm" |  | ||||||
| 
 |  | ||||||
| def main(): |  | ||||||
| 	talker = Eudora(SIGNATURE, start=1) |  | ||||||
| 	while 1: |  | ||||||
| 		print 'get, put, name (of first folder), list (foldernames), quit (eudora) or exit (this program) ?' |  | ||||||
| 		line = sys.stdin.readline() |  | ||||||
| 		try: |  | ||||||
| 			if line[0] == 'g': |  | ||||||
| 				talker.connect(checking=1) |  | ||||||
| 			elif line[0] == 'p': |  | ||||||
| 				talker.connect(sending=1) |  | ||||||
| 			elif line[0] == 'n': |  | ||||||
| 				id = Eudora_Suite.mailbox(1).name |  | ||||||
| 				name = talker._get(id, as='text') |  | ||||||
| 				print "It is called", name |  | ||||||
| 			elif line[0] == 'l': |  | ||||||
| 				pass |  | ||||||
| 			elif line[0] == 'q': |  | ||||||
| 				talker.quit() |  | ||||||
| 			elif line[0] == 'e': |  | ||||||
| 				break |  | ||||||
| 		except MacOS.Error, arg: |  | ||||||
| 			if arg[0] == -609: |  | ||||||
| 				print 'Connection invalid, is eudora running?' |  | ||||||
| 			else: |  | ||||||
| 				print 'MacOS Error:', arg[1] |  | ||||||
| 		except aetools.Error, arg: |  | ||||||
| 			print 'Eudora returned error:', arg |  | ||||||
| 			 |  | ||||||
| main() |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Jack Jansen
						Jack Jansen