[Pythonmac-SIG] appscript

Ronald Oussoren ronaldoussoren at mac.com
Tue Feb 21 06:52:57 CET 2006


On 20-feb-2006, at 23:35, Keith Ray wrote:

> I'm trying to use python/appscript to send apply-events to a cocoa  
> application, but it seems to be choking on parsing the aete...  
> possibly because the aeta has been replaced by 'sdef' for holding  
> scripting terminology.
>
> help?

What happens if you create a small python script that contains  
something like:

	from appscript import *

	myapp = app("LocalApp")
	myapp.open(File("filename"))

And likewise, what happens if you type 'open -a LocalApp filename' in  
the shell (also look in the console log with Console.app). In both  
cases replace LocalApp and filename by the real names.

And finally, what versions of PyObjC and appscript are you using?

Ronald


> Traceback (most recent call last):
> File "/fitEtc/PyFIT/fit/fit/TypeAdapter.py", line 758, in  
> _compareCellToResult
> result = self.get()
> File "/fitEtc/PyFIT/fit/fit/TypeAdapter.py", line 901, in get
> return self.method(self.target)
> File "/fitEtc/quickbooks_tests/test_my_automation/ 
> verify_company_file.py", line 28, in result
> app(self.applicationpath).open(File(self.filename))
> File "/Library/Python/2.3/site-packages/appscript/specifier.py",  
> line 392, in __init__
> translationTables = tablesForLocalApp(path)
> File "/Library/Python/2.3/site-packages/appscript/ 
> translationtablereader.py", line 140, in tablesForLocalApp
> classes, enums, properties, elements, commands = buildTables(path)
> File "/Library/Python/2.3/site-packages/appscript/ 
> translationtablebuilder.py", line 98, in buildTables
> aeteparser.parse(getaete(path), p)
> File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
> python2.3/site-packages/osaterminology/aeteparser.py", line 254, in  
> parse
> a.list(_parseSuite, receiver)
> File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
> python2.3/site-packages/osaterminology/aeteparser.py", line 64, in  
> list
> fn(self, receiver)
> File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
> python2.3/site-packages/osaterminology/aeteparser.py", line 182, in  
> _parseSuite
> aete.list(fn, receiver)
> File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
> python2.3/site-packages/osaterminology/aeteparser.py", line 64, in  
> list
> fn(self, receiver)
> File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
> python2.3/site-packages/osaterminology/aeteparser.py", line 150, in  
> _parseComparison
> description = aete.string ()
> File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
> python2.3/site-packages/osaterminology/aeteparser.py", line 48, in  
> string
> count = ord(self._str[self._ptr])
>
>
> IndexError: string index out of range ------
>
> from fit.ColumnFixture import ColumnFixture
>
> from Foundation import NSString
> from AppKit import NSWorkspace
> import os.path
> from appscript import *
> from macfile import *
>
> class verify_company_file(ColumnFixture):
>     _typeDict={
>         "filename": "String",
>         "applicationpath": "String",
>         "result": "String",
>         }
>     filename = ""
>     applicationpath = ""
>     launchsuccess = 0
>     def result(self):
>         ws = NSWorkspace.sharedWorkspace()
>         ws.launchApplication_( self.applicationpath )
>         app(self.applicationpath).open(File(self.filename))
>         return None
>
>
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig



More information about the Pythonmac-SIG mailing list