05-05-2014 08:37 AM
consider this trivial python script which retrievs the number of "Anwendungen" (applications) from MEGA:
import win32com.client.dynamic as w32
def main():
env = w32.Dispatch("MegaRepository.CurrentEnv")
root = env.GetRoot()
col = root.GetCollection("Anwendung")
# works fine
print("GetCollection: # Anwendungen = %s" % col.Count)
col = root.GetSelection("Select [Anwendung]")
# fails, because Count isn't a known attribute
print("GetSelection: # Anwendungen = %s" % col.Count)
if __name__ == '__main__':
main()
Isn't GetSelection supposed to return a MegaCollection with an attribute Count, too?
09-05-2014 09:54 AM
Hello gubaer
For your information, MEGA Support is not aware of another customer using Pyhton
For quick administration scripts, most developpers use VB script
08-05-2014 09:28 AM
Yes, this works fine in VBScript (in my case from within Excel).
My findings after playing around with pywin32: pywin32 isn't compatible with the way MEGA provides COM objects. Don't know why exactly, but pywin32 can't deal with them. That's a pity because I'd like to use Python for my day to day quick and dirty scripts.
07-05-2014 03:08 PM
Indeed, GetSelection returns a MegaCollection on which you can use the count.
In vbscript this works fine, I don't know phyton so I can not tell if it is something in the code