Jump to content

Run Autoit Code In Editbox?


Recommended Posts

yes.

#include <GUIConstants.au3>
dim $EditContents
$Form1 = GUICreate("Edit Box Code", 488, 441, 192, 125)
$Edit1 = GUICtrlCreateEdit("", 8, 8, 473, 377)
$Button1 = GUICtrlCreateButton("Execute Code", 144, 400, 225, 33, 0)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button1
        $EditContents=GuiCtrlRead($Edit1)
        $EditContents=$EditContents&@CRLF
        $handle=FileOpen(@TempDir&"\Code.au3",10)
        FileWrite($handle,$EditContents)
        FileClose($handle)
        sleep(50)
        Run('"'&@ScriptFullPath&'" /AutoIt3ExecuteScript "'&@TempDir&'\Code.Au3"') 
        
    Case Else
;;;;;;;
    EndSelect
WEnd
Exit

Note: this code has to be compiled to exe form before you can use it

One of the nice functions of Autoit is the fact that you can use any compiled exe the same way you can use autoit3.exe

for executing a single line of code, see the "/AutoIt3ExecuteLine" switch in the help file

Edited by death pax
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...