Jump to content



Photo

Dynamic Execution Include Code Generator


  • Please log in to reply
7 replies to this topic

#1 twitchyliquid64

twitchyliquid64

    Peace. Always.

  • Active Members
  • PipPipPipPipPipPip
  • 520 posts

Posted 03 April 2011 - 02:59 PM

The Aim of this program is to generate an include file which can be used to perform dynamic code execution.


When run, this program will wonder your Autoit Documentation and Helpfiles looking up all kinds of information about functions parameters, and syntax.

It will then build an Include file for you, in the directory lower down to the Script Directory.

This include file will contain functional User Defined Functions as Wrappers to Builtin Autoit Functions.
At this point in time, the program will tell you you have 2 build errors (I have one last thing to do before this program is finished), but they are non-fatal and just mean that two functions could not be generated.
You can then do Dynamic Execution using the Call() function.





TODO:
Implement elipsis expression evaluation (...) to make those last two functions generate correctly.


You will need both these files:
Attached File  func Build.au3   11.85KB   316 downloads ^^== Run this one.
Attached File  build_overrides.au3   1.47KB   267 downloads

Have fun!

Twitchyliquid64.

Edited by twitchyliquid64, 13 April 2013 - 02:14 AM.

ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search







#2 Manadar

Manadar

    Taking a REST.

  • MVPs
  • 10,714 posts

Posted 04 April 2011 - 12:15 PM

Instead of trying
Call("MsgBox", 0, "Title", "Text")

which does not work you could have done:
Execute("MsgBox(0, ""Title"", ""Text"")")


Why not?

#3 twitchyliquid64

twitchyliquid64

    Peace. Always.

  • Active Members
  • PipPipPipPipPipPip
  • 520 posts

Posted 04 April 2011 - 12:41 PM

Instead of trying

Call("MsgBox", 0, "Title", "Text")

which does not work you could have done:
Execute("MsgBox(0, ""Title"", ""Text"")")


Why not?

This is the generated function for MsgBox:

Func _DynEXEC_MSGBOX( $flag, $title, $text, $timeout=Default, $hwnd=Default)     local $ret = MSGBOX($flag,$title,$text,$timeout,$hwnd)     SetError(@error,@extended)     Return $ret Endfunc


You should be calling _DynEXEC_MSGBOX, not MsgBox.

I always assumed, based on the info in the Call() helpfile, that dynamic execution is not possible natively in autoit. If what you say about Execute is correct, then I am wrong and a Fool for spending an hour writing this generator.

Edited by hyperzap, 04 April 2011 - 12:42 PM.

ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search

#4 Manadar

Manadar

    Taking a REST.

  • MVPs
  • 10,714 posts

Posted 04 April 2011 - 01:10 PM

The only thing not possible that is dynamic in AutoIt is dynamic includes.

#5 twitchyliquid64

twitchyliquid64

    Peace. Always.

  • Active Members
  • PipPipPipPipPipPip
  • 520 posts

Posted 04 April 2011 - 01:19 PM

Damn. wish i knew that before i wrote this.
ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search

#6 iShafayet

iShafayet

    Seeker

  • Active Members
  • 15 posts

Posted 04 April 2011 - 01:25 PM

Very interesting approach hyperzap. I wondered about the same thing few months ago. But just like Manadar said, it just ain't gonna work...
whoa! I can write!

#7 twitchyliquid64

twitchyliquid64

    Peace. Always.

  • Active Members
  • PipPipPipPipPipPip
  • 520 posts

Posted 07 April 2011 - 05:11 AM

Very interesting approach hyperzap. I wondered about the same thing few months ago. But just like Manadar said, it just ain't gonna work...


Well, It works, its just not ideal to use my 310 line code to generate 2100 lines of code to do a task that could be done with one line.
ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search

#8 Manadar

Manadar

    Taking a REST.

  • MVPs
  • 10,714 posts

Posted 18 April 2011 - 01:58 PM

hyperzap, I've written this Call function which can call any internal function as well: http://www.autoitscript.com/forum/topic/127735-callany-udf-function/




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users