Sign in to follow this  
Followers 0
GreenBox

Python Embadding to Autoit

10 posts in this topic

#1 ·  Posted (edited)

Current Support Python Version : 3.0 - 3.x (python 3k support)

I want you to be useful this UDF, but still can not call many functions.

However, in the Python documentation and source code using a macro to convert the code to Autoit UDF are thinking. :)

Have been translated using Google Translate.

PyAutoit_OpenDll($sDllPath = Default)
PyAutoit_CloseDll()
PyAutoit_GetDllHandle()
 - use after Py_Initialize
PyAutoit_GetConst($sName)
 - same PyAutoit_GetDllHandle()
PyAutoit_GetStructAsBytes($x)
PyAutoit_CreateStruct($sFormat, $pPointer = Default)
 - MUST FREE BY PyAutoit_FreeStruct FUNCTION! (not auto free)
PyAutoit_FreeStruct($vStruct)
PyAutoit_CreateAutoFreeStructInfo()
 - return $apStructInfo
PyAutoit_CreateStruct_AutoFree(ByRef $apStructInfo, $sFormat, $pPointer = Default)
PyAutoit_FreeStruct_AutoFree(ByRef $apStructInfo)
 - must call before return when call PyAutoit_CreateAutoFreeStructInfo()
PyAutoit_ConcatStruct($1, $2, ...)
 - concat struct (not ptr!)
PyAutoit_GetStructPtr($vStruct)
PyAutoit_CreateStringBuffer($sString)
PyAutoit_CreateUnicodeBuffer($sString)
PyAutoit_WrapDllCall($vRet, $iErr = @error, $iExt = @extended) -> $vRet = PyAutoit_WrapDllCall(DLLCall(...)) (array[0] -> $vRet)
PyAutoit_BuildValue($valueformat, $autoit_dllcall_type1, $autoit_dllcall_value1, ...)
PyAutoit_BuildValueFromArray($valueformat, $vParams) -> like PyAutoit_BuildValue but input are $vParams [?
PyAutoit_ArgParseTuple($pPyTuple, $sParamFormat, $auoit_dllcall_type1, ...)
PyAutoit_CreatePyMethodDef($sFakeFuncName, $sFuncName, $iFuncFlag = $METH_VARARGS, $sDoc = "")
PyAutoit_Main($CmdLine = $CmdLine)

_PyAutoit_InternalError($msg, $line = @ScriptLineNumber)
_PyAutoit_InternalWarning($msg)
_PyAutoit_GetCallBackPtr($sFuncName, $sTypeRet = "ptr", $sCallBackArgs = "")
_PyAutoit_CalcStructFormatSize($sFormat)

Py_BuildString($string) -> (ptr)Python String Object 

Py_None() -> {Py_INCREF(&Py_None); return &Py_None;}

you must read http://docs.python.org/py3k/c-api/ Python document.

some function didn't work.

TODO (i don't know when work start):

- convert mecro function or value : ex) PyRun_SimpleString(=> PyRun_SimpleStringFlags($x, NULL)) (can't detect mecro defined functions from gcc preprocesser)

- convert real mecro : like sizeof(int) [?

- document & example work (PyAutoit_BuildValue, PyAutoit_BuildValueFromArray, PyAutoit_CreatePyMethodDef, PyAutoit_CreateStruct_AutoFree, etc...)

- using AutoitObject -> #include <pythonex.au3>?

- etc

python.zip

Edited by GreenBox

Share this post


Link to post
Share on other sites



#4 ·  Posted (edited)

@GreenBox

Interesting. I have a feeling I'm going to be playing with this today.

Edited by FuryCell

HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites

Don't forget about the integration you can get with the COM ScriptControl. See Here:

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

Share this post


Link to post
Share on other sites

I have installed Python 3.2 and tried turtle.py

Python Turtle Graphics example is more "talking" !

Thanks ! Posted Image


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Very impressive.

I do not know much about phyton but I could imagine the potential of having threading capability to autoit via Phyton.

Beside, If the threading library will be formed into then that will make many people on this forum happy.

Good job.

Edited by lsakizada

Be Green Now or Never (BGNN)!

Share this post


Link to post
Share on other sites

Very impressive.

I do not know much about phyton but I could imagine the potential of having threading capability to autoit via Phyton.

Beside, If the threading library will be formed into then that will make many people on this forum happy.

Good job.

but Autoit didn't support thread currently.

thanks idea that AutoitObject use.

Share this post


Link to post
Share on other sites

Hello, I'd appreciate some help with this, I can't figure out how to make it work. I have installed Python version 3.2.3. In the 'pyexample.au3' script, I have changed:

PyAutoit_OpenDll("python31")

to read:

PyAutoit_OpenDll("python32")

and I have changed:

PyAutoit_Main(StringSplit("./module1.py", " "))

to include the name of the Python file I want to convert, instead of 'module1.py'. I have then run the script, it completes without returning an error, but nothing happens. I've tried it with 'turtle.py' as someone mentions this above, but still no joy.

This code is _way_ beyond my programming capabilities, and my approach is probably very simplistic. I can't understand how the UDF works. If someone could show me how to simply use this to convert a .py file to AutoIT code, I'd be very grateful.

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