Hacker4All Posted April 10, 2009 Share Posted April 10, 2009 Okay, so I've got an idea for a new script of mine(when i say new, i mean first) and it starts out with a message box, but i cant seem to find what kind of box it is. I want it to be a box that you can type stuff into, like Run - Solitare, or the stuff like that. What kind of MsgBox, if it is a MsgBox is that? Link to comment Share on other sites More sharing options...
Xand3r Posted April 10, 2009 Share Posted April 10, 2009 search the help file for inputbox Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro Link to comment Share on other sites More sharing options...
Hacker4All Posted April 11, 2009 Author Share Posted April 11, 2009 Okay, so, here is what i am trying to do. Odds are, someone else has already done it, but hey, I would like to give it a shot. The InputBox Thingy works like a charm, thank you for that. I am wondering if there was someway to where if you put in, say, "Run Notepad", then the program would then close the MsgBox and then run a notepad. Or if you say, "Run Solitare", then the program would start up the solitare.exe. Is there any way to add a variable for what could possibly be typed in? Link to comment Share on other sites More sharing options...
Hacker4All Posted April 11, 2009 Author Share Posted April 11, 2009 I have the very basic layout of pretty much what i want it to do: $ans = InputBox("Linkin'", "What would you like to do today?") If $ans = "Run Notepad" Then Run("notepad.exe") Exit EndIf If $ans = "Run Cmd" Then Run("cmd.exe") Exit EndIf However, I am having trouble fittign a variable into what you would put after "Run". Any Ideas? Link to comment Share on other sites More sharing options...
Death Posted April 11, 2009 Share Posted April 11, 2009 (edited) So basically you want to make your own run with AutoIt? And If notepad.exe was typed into the inputbox you'd go If $ans = "notepad.exe" Then ShellExecute("notepad.exe") Exit EndIf Edited April 11, 2009 by Death Link to comment Share on other sites More sharing options...
Hacker4All Posted April 11, 2009 Author Share Posted April 11, 2009 Yes, pretty much. I would like to make my own Run, as you put it. But i want it to do something like this, but i dont quite understand how i should put it: $ans = InputBox("Linkin'", "What would you like to do today?") If $ans = "Run $process" Then Run("$process.exe") I know it doesnt work like that, but that is what i would like for it to do, if you can have a variable within a variable. Link to comment Share on other sites More sharing options...
maqleod Posted April 11, 2009 Share Posted April 11, 2009 Yes, pretty much. I would like to make my own Run, as you put it. But i want it to do something like this, but i dont quite understand how i should put it:$ans = InputBox("Linkin'", "What would you like to do today?")If $ans = "Run $process" ThenRun("$process.exe")I know it doesnt work like that, but that is what i would like for it to do, if you can have a variable within a variable.If $ans = "Run " & $process Then <-- this is how you would concatenate text and variable, that is probably what you need to do what you want [u]You can download my projects at:[/u] Pulsar Software Link to comment Share on other sites More sharing options...
Hacker4All Posted April 12, 2009 Author Share Posted April 12, 2009 Two questions: Whats the difference between run and ShellExecute, and what do i declare the $process as? Link to comment Share on other sites More sharing options...
qazwsx Posted April 12, 2009 Share Posted April 12, 2009 If $ans = "Run " & $process Then <-- this is how you would concatenate text and variable, that is probably what you need to do what you wantThat won't work, but it is how you concatenate. Why don't you trim the run from answer and then do a shellexecute ($ans & ".exe").Whats the difference between run and ShellExecuteSounds like a question for the help file. Link to comment Share on other sites More sharing options...
JackDinn Posted April 12, 2009 Share Posted April 12, 2009 (edited) If $ans = "Run " & $process Then That won't work, but it is how you concatenate. Why don't you trim the run from answer and then do a shellexecute ($ans & ".exe"). If $ans = "Run " & $process Then would work fine. But how about:- $ans = InputBox("Linkin'", "What would you like to do today?") $split=StringSplit($ans," ") if $split[1]="run" Then Run($split[2] & ".exe") EndIf that way you can get the effect i think your after Edited April 12, 2009 by JackDinn Thx all,Jack Dinn. JD's Auto Internet Speed Tester JD's Clip Catch (With Screen Shot Helper) Projects :- AutoIt - My projects My software never has bugs. It just develops random features. :-D 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