planch Posted June 28, 2008 Share Posted June 28, 2008 "And, it is possible to script in Python inside AutoIt (with limitations, but it's possible)." This line was all I could find on this topic in my forum search, but no further explanation was given. Specifically, I have a .au3 file that builds a GUI and interacts with another window, and I want to simplify the code by using python scripting/data types (specifically dictionary type). Is this simple, or even possible? Link to comment Share on other sites More sharing options...
JRowe Posted June 28, 2008 Share Posted June 28, 2008 http://www.autoitscript.com/forum/index.ph...1&hl=pythonLinkThis may seem a little circuitous, but it should work for you. Write your AutoIt script, then call it from python, and use python to send/recv whatever data you need. You'll need to specifically format the data being sent between the two, because I doubt an autoit array will pass muster in python, and so on, so iterate through strings and send/set your data serially instead of all at once. [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Link to comment Share on other sites More sharing options...
planch Posted June 28, 2008 Author Share Posted June 28, 2008 Thanks for the reply. I found a few posts like that one, but the question I had was will I have to re-write the GUI/events in python? It is already written in au3, so I was trying to avoid re-writing them. Link to comment Share on other sites More sharing options...
DaleHohm Posted June 28, 2008 Share Posted June 28, 2008 A couple of things... Hash.au3 posted by aGorilla here on the forum gives you access to "dictionary" functionality (uses the Scripting.Dictionary COM component). You may want to check it out. I have not done this, but you can setup ActivePython for ActiveScripting that then gives you access to it through the COM ScriptControl. This is from the ActivePerl 2.4 docs: http://aspn.activestate.com/ASPN/docs/Acti...and_Python.html Active Server Pages has been a useful addition to Microsoft's Web strategy. Because of the language neutral nature of COM, any language that is capable of "Active X" (meaning COM) scripting can integrate with it. Python, with it's excellent COM support, is one of those languages. When you install it, by default, it is not setup for the ASP enviroment with IIS. If you look at the html documentation in: C:\\Program Files\\Python\\win32com\\HTML\\index.html at the bottom of the page you'll see 'Active X Scripting Demos'. If you then click on that it will describe how to register the engire. Essentially, there is a program called pyscript.py in: C:\\Program Files\\Python\\win32comext\\axscript\\client and if you run that it should register python for the ASP environment. This will let you do something like this: Local $oSC = ObjCreate("ScriptControl") $oSC.language = "Python" $oVal = $oSC.eval("a python command") the state of variables and the like is preserved between these calls and there are also ways to execute full scripts this way. Look for ScriptControl in this forum and on MSDN and you'll find more details. Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
planch Posted June 28, 2008 Author Share Posted June 28, 2008 Cool, thanks. I have zero experience with COM, but I suppose I can't avoid it forever... The Scripting.Dictionary bit looks extremely useful too. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now