Jump to content

Execute($func) works on some some, not others?


Recommended Posts

$GUI=GUICreate("",170,85)
GUISetState()
GUICtrlCreateLabel("Input function to execute.",25,5)
$Input=GUICtrlCreateInput("",30,25,100)
$Execute=GUICtrlCreateButton("Execute",60,50)

While 1
$Msg=GUIGetMsg()
$InputRead=GUICtrlRead($Input)
If $msg = -3 Then Exit
If $msg = $Execute Then Execute($InputRead)
If @error Then MsgBox(0,"Error","Function could not be executed.",1)
WEnd

That pops up a GUI with an input box, you input a function and press Execute, it will run the function. It works for some function, like Beep() and MouseMove(), but doesn't work for others. I though at first it was an issue with quotations, but then I tried Shutdown(64), and that returned with an error as well.

Anyone know what could possibly be causing this?

Edited by idusy
Link to comment
Share on other sites

per help

Environment, Files, Dir, Disk, GUI, InputBox, MsgBox, Misc, Network, Obj/COM, Process, Registry, Tray, WinKill functions implying deletion or modification will not be executed. They will set @error to 9999 and return "".

$GUI=GUICreate("",170,85)
GUISetState()
GUICtrlCreateLabel("Input function to execute.",25,5)
$Input=GUICtrlCreateInput("",30,25,100)
$Execute=GUICtrlCreateButton("Execute",60,50)

While 1
$Msg=GUIGetMsg()
$InputRead=GUICtrlRead($Input)
If $msg = -3 Then Exit
If $msg = $Execute Then Execute($InputRead)
If @error Then MsgBox(0,"Error","Function could not be executed. #" & @error,3)
WEnd

now test with this and you will see the error set to 9999

8)

NEWHeader1.png

Link to comment
Share on other sites

per help

$GUI=GUICreate("",170,85)
GUISetState()
GUICtrlCreateLabel("Input function to execute.",25,5)
$Input=GUICtrlCreateInput("",30,25,100)
$Execute=GUICtrlCreateButton("Execute",60,50)

While 1
$Msg=GUIGetMsg()
$InputRead=GUICtrlRead($Input)
If $msg = -3 Then Exit
If $msg = $Execute Then Execute($InputRead)
If @error Then MsgBox(0,"Error","Function could not be executed. #" & @error,3)
WEnd

now test with this and you will see the error set to 9999

8)

Bleh, I even read that before and it didn't sink in... Well, that makes much more sense now. Thanks. Edited by idusy
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...