nym3ts Posted August 7, 2007 Share Posted August 7, 2007 I am creating a GUI application and I have a question about the GUICtrlCreateInput function. I want the program to execute a certain command based on what I type in the input box. For example, when I type notepad and click OK it will do Run("notepad.exe") but when I type Calculator it will do Run("calc.exe"). If someone can explain how to do this I would appreciate it. Link to comment Share on other sites More sharing options...
enaiman Posted August 7, 2007 Share Posted August 7, 2007 GUICtrlRead - read the content of your inputbox. As for executing the command - if you want to avoid typing the whole name (i.e. notepad.exe - you will want to type only notepad) - you can use a Select or Switch statement like: Switch GUICtrlRead ($input) Case "notepad" Run ("notepad.exe") Case "calc" Run ("C:\WINDOWS\system32\calc.exe") EndSwitch Add as many cases as you wish. If you want to run a file other than exe you might consider using ShellExecute. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
nym3ts Posted August 7, 2007 Author Share Posted August 7, 2007 GUICtrlRead - read the content of your inputbox. As for executing the command - if you want to avoid typing the whole name (i.e. notepad.exe - you will want to type only notepad) - you can use a Select or Switch statement like: Switch GUICtrlRead ($input) Case "notepad" Run ("notepad.exe") Case "calc" Run ("C:\WINDOWS\system32\calc.exe") EndSwitch Add as many cases as you wish. If you want to run a file other than exe you might consider using ShellExecute. Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now