Jump to content
Sign in to follow this  
Apfelkiller

How to execute a Variable

Recommended Posts

Apfelkiller

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?

Share this post


Link to post
Share on other sites
smartee

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:

Share this post


Link to post
Share on other sites
JLogan3o13

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.


√-1 2^3 ∑ π, and it was delicious!

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites
smartee

@JLogan3o13: look at the line

$text = GUICtrlCreateInput('MouseClick("",100,100)', 20, 15, 110, 20)
he did give us an example :oops:

Share this post


Link to post
Share on other sites
Apfelkiller

Woooooot?

It's sooo simple.

I just didn't try to find any "Execute" command.

Thanks thats exact what I wanted.

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  

×