Jump to content

How to execute a Variable


Recommended Posts

Hey Guys,

I scriptet this little GUI here:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("WinTitleMatchMode", 2)
$Bildschirmgroesse=WinGetPos("Program Manager")
$Taskleistenhoehe=WinGetPos("[Class:Shell_TrayWnd]")
$Fensterbreite=150
$Fensterhoehe=70
$x=$Bildschirmgroesse[2]-$Fensterbreite-5
$y=$Bildschirmgroesse[3]-$Fensterhoehe-$Taskleistenhoehe[3]-28
GUICreate ( "" , $Fensterbreite , $Fensterhoehe , $x , $y )
$text   = GUICtrlCreateInput('MouseClick("",100,100)', 20, 15, 110, 20)
$Button1 = GUICtrlCreateButton("START", 20, 40, 110, 20)
GUISetState()

    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                Exit
            Case $msg = $Button1
    $example=GUICtrlRead($text)
    $example ;execute the $example
        EndSelect
    WEnd

My goal is to write whatever i want into the Input label an execute it by hitting the START button.

My Problem is that i can't execute the $example variable.

Someone have an idea how to solve it?

Link to comment
Share on other sites

My Problem is that i can't execute the $example variable.

Oh but you can Execute it. :bye:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("WinTitleMatchMode", 2)
$Bildschirmgroesse = WinGetPos("Program Manager")
$Taskleistenhoehe = WinGetPos("[Class:Shell_TrayWnd]")
$Fensterbreite = 150
$Fensterhoehe = 70
$x = $Bildschirmgroesse[2] - $Fensterbreite - 5
$y = $Bildschirmgroesse[3] - $Fensterhoehe - $Taskleistenhoehe[3] - 28
GUICreate("", $Fensterbreite, $Fensterhoehe, $x, $y)
$text = GUICtrlCreateInput('MouseClick("",100,100)', 20, 15, 110, 20)
$Button1 = GUICtrlCreateButton("START", 20, 40, 110, 20)
GUISetState()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $Button1
            $example = GUICtrlRead($text)
            Execute($example) ;execute the $example
    EndSelect
WEnd

Hope this helps :oops:

Link to comment
Share on other sites

  • Moderators

Hi, Apefelkiller, can you please provide us with an example output of $example? You're doing a GUICtrlRead, but what would you expect the information to be? That will define how you "execute" it.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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...