Sign in to follow this  
Followers 0
Unc3nZureD

A kind of Plugin system

6 posts in this topic

Well, the thread (How to execute() multiple lines at once?) I opened before is a bit similar, but It's a bit extended version of it. I hope it's not a problem I opened a new thread for it. (completely different question, at least some more advanced)

So, I'd like to make a Plugin system for my application. It would simply read a file, for example script.plugin (it doesn't matter) and execute everything. Of course I would make a basic filter, so some special commands wouldn't be allowed for security reasons. Is it possible without using the AutoItExecuteAllowed pragma?

I tried to execute() each line, but I realized, that I can't deal with some more "complex" commands like loops or if/endif. Does anyone have any idea how to do something like this? Any bypass solutions would be accepted, the goal is to execute them :)

Thanks for any try :)

Share this post


Link to post
Share on other sites



I don't think that would work.

What if the user has no autoit installed? Anyways, I'd like to make custom commands, that user could use if he/she decides to write a plugin. So it would be the best if I could somehow alter the execute to allow lines such as

If FileExists("asd.exe") Then <newline> MsgBox(0,"", "Wooho") <newline> Else <newline> Exit <newline> EndIf

Or any kind of new /Beta/ function that would allow to run au3 files only if it's needed, and with the context of the original script. ( I mean to let me be able to use custom functions )

Share this post


Link to post
Share on other sites

Just some ideas, maybe interesting...

What about Run(@AutoItExe & ' /AutoIt3ExecuteScript 2ndScript.au3') ?

You can then use something like ConsoleWrite (in the 2ndScript) and StdoutRead (in the 1stScript), to get the result...

1stScript.au3 :

$iPid = Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & @ScriptDir & '\2ndScript.au3"', @ScriptDir, "", 2)
ProcessWaitClose($iPid)

$result = StdoutRead($iPid)

ConsoleWrite("Result is " & $result)

2ndScript.au3 :

ConsoleWrite("here is the result !")

Or you can use ShellExecuteWait and then get the exit code returned by your 2ndScript.

But if you want to share variables between the two (or more) scripts, it will be more complicated... (mailslot ?)

Share this post


Link to post
Share on other sites

Well, It seems I have to make a little bit more complicated system. As I see, the only way to execute a whole script is to use the interpreter. The backside of it, which I want to avoid is the following:

If the main script has the following function:

Func makeMeSomeApplePie($ingredients)
...
...
EndFunc

Then the script which I want to execute simply can not use this func! (Since it's not declared). If I use Execute, then It executes the correct Func, since it's declared in my main script.

However in the other thread I got a nice idea. I have to force using "Conditional operator" and after that I have to make some "Processors" which will be able to handle loops like while, do-until and for.

Well, for starting it'll be enough :) I'm not sure if it can have any incompatibility or bug possibility, but that will turn out later :)

Thanks guys.

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