I changed the topic so many can avoid it and we don't bore them to tears ;-) On Apr 20, 2006, at 2:02, has wrote:
But I give up on using appscript with Excel--some things just don't work because I think the terminology is seriously warped if no broken. Applescriptworks but appscript doesn't. I instead build a text Applescript from strings and use popen2 to invoke osascript like this example which reads in the stock symbols from a named range in an excel spreadsheet: def readSymbolList(self, workbook, worksheet, range): _getSymbolsScript = """tell app "Microsoft Excel" return Value of Range "%s" of Worksheet "%s" of Workbook "%s" end tell""" # read symbols from spreadsheet cout, cin = popen2.popen2( "/usr/bin/osascript -e \'%s\'" % \ (_getSymbolsScript % (range, worksheet, workbook))) symbols = cout.readline()[:-1] symbols = re.sub(",\s",",",symbols) if (self.DEBUG): print __module__, "::","symbols=", repr(symbols) # create symbolList symbolList = [] symbols = string.split(symbols, ",") if (self.DEBUG): print __module__, "::","stocks=", repr(symbols) for symbol in symbols: if (symbol != '0'): symbolList.append(symbol) cout.close() cin.close() return symbolList
If you really desire to you can but I just wrote a quick hack using re.sub() that correctly converts the paths I use so my needs are met. Daniel |
_______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig