Jump to content
Sign in to follow this  
UnKnOwned

Access Functions in Compiled Script

Recommended Posts

UnKnOwned

Can you, and if so how do you access functions in a compiled script from a non compiled script without using $cmdline or anything of that stature?

Share this post


Link to post
Share on other sites
Shaggi

You would have to make some inter process communication api, through which you can request commands and get results, either through cmdlines, standard streams, weird memory writing/scanning, or through wm_copydata messages etc.

In short, you cannot do it directly.


Ever wanted to call functions in another process? ProcessCall UDFConsole stuff: Console UDFC Preprocessor for AutoIt OMG

Share this post


Link to post
Share on other sites
UnKnOwned

If you set up the compiled script to parse the non compiled script which only includes function calls that are made inside the compiled script. You can then use the non compiled script to call functions inside the compiled script like so.

Compiled .AU3 Script:

Local $script = 'example.au3'
Local $file = FileOpen($script, 0)
While 1
    Local $line = FileReadLine($file)
    If @error = -1 then ExitLoop
    Execute($line)
WEnd


Func ReservedSpace($param)
msgbox(0, '', $param)
EndFunc

Non Compiled .AU3 Script:

Call("ReservedSpace", "Reverse Order Causes Disorder")

Is there a way where you can send complex expressions to the compiled script and have it embed in some way the code inside the function of the compiled script? Some manipulation of this could allow extended functionality after compilation.

Share this post


Link to post
Share on other sites
Shaggi

Are we talking about running two seperate processes or one process parsing an autoit-alike script? There are differences. If the former, no to your answer, autoit runtime, once run, will not modify/reflect on it's source, thus you cannot add anything like functions (native), only variables.


Ever wanted to call functions in another process? ProcessCall UDFConsole stuff: Console UDFC Preprocessor for AutoIt OMG

Share this post


Link to post
Share on other sites
jdelaney

Easiest way, include an #include line...worst case scenario, you have to recompile each time you make adjustments to the 'included' script.

Not exactly what you are asking for, but the end result is the same...you have an external script with all the functions, and a 'driver' script that calls those functions...or figure out how to create dll's and dll calls

If you want to get real tricky, you can _filereadtoarry, and then loop through line by line...but they functions need to be written extremely simply...something like this:

$a = RunWait(@AutoItExe & ' /AutoIt3ExecuteLine  "exit StringToBinary(  InputBox(''Hello World!'', ''Hi!'')  )"')
CoConsoleWrite(BinaryToString($a) & @CRLF)

in that example, the InputBox would be the line you read from the file

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

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  

×