Sign in to follow this  
Followers 0
ryushi5

AutoIt and Python - Limited Functions

8 posts in this topic

I'm using Python to call AutoIt functions, but some functions don't work. Is there a reason for this? If so, can I fix it?

from win32com.client import Dispatch
Auto = Dispatch("AutoItX3.Control")
def autoTest():
    print Auto.MsgBox('')

When I run it I get this error:

line 516, in __getattr__
    raise AttributeError("%s.%s" % (self._username_, attr))
AttributeError: AutoItX3.Control.MsgBox

It seems like it's reading 'MsgBox' as an attribute and not a function. Any thoughts?

1 person likes this

Share this post


Link to post
Share on other sites



Nevermind, I simply did not research well enough. Please disregard. :mellow:

Share this post


Link to post
Share on other sites

but it is a very good idea Python call Autoit.

Share this post


Link to post
Share on other sites

Sooooo what was the problem?

Posted Image

Share this post


Link to post
Share on other sites

Hello everyone, I'm new here and experiencing the same problem as Ryushi, using Python to call COM automating AutoIt

But even with these parameters,

from win32com.client import Dispatch
Auto = Dispatch("AutoItX3.Control")
def autoTest():
    print Auto.MsgBox( 0, "title", "text" )

I got that error

line 516, in __getattr__
    raise AttributeError("%s.%s" % (self._username_, attr))
AttributeError: AutoItX3.Control.MsgBox

Maybe i didn't understood something clearly,

Thank you for your help !

Share this post


Link to post
Share on other sites

Hello!

I face the same problem, when try to launch message box from Python:

autoIT.MsgBox(0, "Strange", "Hello!")

AttributeError: AutoItX3.Control.MsgBox

What is the solution?

Could you, please, provide it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • n3wbie
      By n3wbie
      Hello m trying to learn python 
      m interested in knowing if there is koda like gui designer for python
      please also help me what all additional modules i require
      like ones which are famous
      i have already done with
      1.Scrapy
      2.Openpyxl
      3.twister
      4.selenium
      5.Requests
      6.pdfrw
       
    • breakbadsp
      By breakbadsp
      I want to run a python script from autoit. 
      I know we can do this with shellexecute or run , but this python script takes 3 cmd line arguments.
      How to pass them from autoit script?
      I tried many ways.
      Following solution also not working 
      e.g. 
      RunWait( 'fullpath\Python.exe Scriptpath\ReadLog.py  -f "file.log" -k "key" -e "errMsg" ') Found solution:
      RunWait( 'fullpath\Python.exe ReadLog.py -f "file.log" -k "key" -e "errMsg" ', 'Working_directory_path')  
      PFB description:
      https://stackoverflow.com/questions/45757834/how-to-pass-command-line-arguments-to-a-python-script-anyscript-while-executin
       
    • KemyKo
      By KemyKo
      I recently discovered these: 
      https://pypi.python.org/pypi/PyAutoIt
      https://github.com/jacexh/pyautoit
      I guess any python developer knows what these are.
       
      The problem is that I`m on a 64bit version of Windows and i can`t use neither 
      pip install -U pyautoit nor 
      python setup.py install to install the package 
       
      Is there anyone who has the same problem like me?
      Suggest your suggestions 
      *(nice joke right there )*

      Problem solved -> Apparently when i run the setup.py file from github it worked.
       
    • cosmos
      By cosmos
      Edit: Just realised this was posted in the wrong forum! I guess the Mods will move it to either "AutoIt General Help and Support" or "AutoIt Technical Discussion".
      Do you use type checking? Or do you choose not to type check?
      I was trying to think of the simplest way to do a type check without typing arguments more than once and I came up with:
      Func displayPerson($firstName, $lastName, $age) ; -- TYPE CHECK -- Local $typeCheck = ("" _ & IsString($firstName) _ & IsString($lastName) _ & IsNumber($age) _ ) If (StringInStr($typeCheck, "0")) Then MsgBox(16, "Type Error: displayPerson()", $typeCheck) ; -- FUNCTION -- MsgBox(0, "", $firstName & " " & $lastName & " (" & $age & ")") EndFunc The only catch with this method is that it produces a very simplistic error message. Even still, the fact that you only have to type out arguments once makes it a reasonable approach, in my opinion. The same logic can also be used for making function contracts (for example: $firstName mustn't be an empty string etc...).
      What do you think? How do you go about such things?
    • vikashbitm2010
      By vikashbitm2010
      Hi all,
      I want to return string from autoit script to the python code.
      Autoit:
      Exit("22 FE 45") -> not working
      Exit(1) -> Working
      Exit(0) -> Working
      python:
      import os
      res=os.system(autoitmine.exe)
      print "res",res
      I got some hint of @ExitCode macro, but dont know how to use it to get the string in python variable 'res'.
      Please resolve this issue for me if anyone knows about this.