Getting Application object in Python 2005-03-28 - By Luke Emrose
Back Hi there,
I think from memory that this may have been discussed before but I cannot remember if a solution was ever found.
At the moment in Python, if I use modules I have to pass in the Application object from the main piece of code in order for everything to work as expected.
Originally I thought I could use:
* from win32com import client ap = client.Dispatch('XSI.Application')*
which for most things seems to work, but for some strange reason doesn't seem to work for the ClassName and GetValue commands.
At the moment this is driving me nutz, as I have a very large module library for a large tool I'm building and for some stupid reason if I have to pass in the Application object to an object more than two levels deep it stops working (i.e, *module1.module2.module3.ap = Application* doesn't work but *module1.module2.ap = Application* does, huh!!!!).
Surely there is an easier and foolproof way to get the Application object without having to pass it in from one place (which sucks), especially since this is completely painless in every other language that is supported (i.e. C++, JavaScript and VBScript).
thanks,
Luke
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859 (See http://ISO-8859.ora-code.com)-1" http-equiv="Content-Type"> <title></title> </head> <body bgcolor="#ffffff" text="#000000"> Hi there,<br> <br> I think from memory that this may have been discussed before but I cannot remember if a solution was ever found.<br> <br> At the moment in Python, if I use modules I have to pass in the Application object from the main piece of code in order for everything to work as expected.<br> <br> Originally I thought I could use:<br> <br> <b> from win32com import client <br> ap = client.Dispatch('XSI.Application')</b><br> <br> which for most things seems to work, but for some strange reason doesn't seem to work for the ClassName and GetValue commands.<br> <br> At the moment this is driving me nutz, as I have a very large module library for a large tool I'm building and for some stupid reason if I have to pass in the Application object to an object more than two levels deep it stops working (i.e, <b>module1.module2.module3.ap = Application</b> doesn't work but <b>module1.module2.ap = Application</b> does, huh!!!!).<br> <br> Surely there is an easier and foolproof way to get the Application object without having to pass it in from one place (which sucks), especially since this is completely painless in every other language that is supported (i.e. C++, JavaScript and VBScript).<br> <br> thanks,<br> <br> Luke<br> </body> </html>
|
|