Jump to content
Sign in to follow this  
lionfaggot

is it possible to read code from a file?

Recommended Posts

lionfaggot

sort of like, i put autoit code in a txt file, can a compiled autoit exe execute the code? and also, how would i go about this in a secure manner, it creates possible code injection vulnerabilities

Share this post


Link to post
Share on other sites
Gideon

You will need the compiler or write your own compiler.

You can make your own script with autoitscript.

So yes, it's possible.


Many times you need to think like hobby-bob:')

Share this post


Link to post
Share on other sites
lionfaggot

not what i meant, i saw another post on here some time ago asking a similar question and it got answered. at the time i didnt care but now i wanna do something with it and cant find the post LOL

Share this post


Link to post
Share on other sites
Gideon

What you mean then?

You want to make a kind of macro's, instead of compile it to .exe?

So in example you make a text file called "code.txt".

In "code.txt" is written "msg: hello world".

And you want to make a msgbox with "hello world" from your compiled script.


Many times you need to think like hobby-bob:')

Share this post


Link to post
Share on other sites
lionfaggot

no, i want to have a compiled exe read from a file msgbox(0,"poop","poop") and execute the code

Share this post


Link to post
Share on other sites
Gideon

So you will have something like this:

#include <file.au3>
Dim $aRecords
If Not _FileReadToArray("C:\code.txt",$aRecords) Then
   MsgBox(4096,"Error", " Error reading log to Array     error:" & @error)
   Exit
EndIf
For $x = 1 to $aRecords[0]
    If StringRegExp($aRecords[$x],'(?i)MsgBox') Then
    MsgBox(0,"test","regexp true")
    EndIf
Next
Edited by Gideon

Many times you need to think like hobby-bob:')

Share this post


Link to post
Share on other sites
ChrisL
Gideon

Do you mean this?

Run("anyCompiledAutoitExe.exe  /AutoIt3ExecuteScript C:\MyAutoitScriptInATextFile.txt" )

That's a lot better:)

I'm trying to help, but not know everything, Sorry


Many times you need to think like hobby-bob:')

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.