Ravage 0 Posted September 21, 2007 (edited) I wanted to make a program that stores inputs that I want, here's what I have until now:$name = Inputbox ( "Name", "What's your name?", "", " M" )if @error = 1 then Exitelsesleep (1000)endif$age = Inputbox ( "Age", "How old are you?", "", " M" )if @error = 1 then Exitelsesleep (1000)endifMsgBox ( 0, "Info", "Hello" $name "You're" $age "years old", 30 )sleep (1000)Run("notepad.exe")WinWaitActive("Untitled - Notepad")Send($name)Send("-")Send($age)WinClose("Untitled - Notepad")WinWaitActive("Notepad", "&Save")Send("!y")Sleep (1000)MsgBox (0, "Stored", "Your info has been stored.", 15 )Well, my question is if it's possible to ONLY put in numbers in the $age inputbox and ONLY put in tekst in the $name box?Thanks in advance.-edit-I noticed that it doesn't allow the ! in the inputbox and it also blocks the next character, how come? Edited September 21, 2007 by Ravage Share this post Link to post Share on other sites
AlmarM 22 Posted September 21, 2007 (edited) This is al I can get for you... I can't figure out how it will save automatic, so heres what I got: $name = Inputbox("Name", "What's your name?", "", " M" ) if @error = 1 then Exit else sleep (500) endif $age = Inputbox ( "Age", "How old are you?", "", " M" ) if @error = 1 then Exit else sleep (500) endif MsgBox(0, "Info", "Hello " & $name & " you're " & $age & " years old", 30) sleep (500) Run("notepad.exe") WinWaitActive("Untitled - Notepad") Send($name) Send("-") Send($age) Edited September 21, 2007 by AlmarM MinesweeperA minesweeper game created in autoit, source available._Mouse_UDFAn UDF for registering functions to mouse events, made in pure autoit.2D Hitbox EditorA 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Share this post Link to post Share on other sites
aslani 2 Posted September 21, 2007 Enjoy. $name = Inputbox ( "Name", "What's your name?", "", " M" ) if @error = 1 then Exit else sleep (1000) endif $age = Inputbox ( "Age", "How old are you?", "", " M" ) if @error = 1 then Exit else sleep (1000) endif MsgBox ( 0, "Info", "Hello, " & $name & @CRLF & "You're " & $age & " years old", 30 ) sleep (1000) $name_age = "" & $name & "-" & $age If FileExists(@ScriptDir & "\name-age.txt") Then FileSetAttrib(@ScriptDir & "\name-age.txt", "-RASHNOT") Else $file = FileOpen(@ScriptDir & "\name-age.txt", 2) FileWrite(@ScriptDir & "\name-age.txt", $name_age) FileClose($file) FileSetAttrib(@ScriptDir & "\name-age.txt", "-AHNOT+RS") EndIf Sleep (1000) MsgBox (0, "Stored", "Your info has been stored.", 15 ) [font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version Share this post Link to post Share on other sites
Nahuel 1 Posted September 21, 2007 Using an inifile would make it more efficient and it's easier to handle the stored info. I also added the StringIsDigit and StringIsAlpha functions to do what you wanted: Do;loop until the user enters letters only or clicks cancel $name = Inputbox ( "Name", "What's your name?", "", " M" ) If (Not @error) AND (NOT StringIsAlpha($name))Then MsgBox(0,"Error","You must enter letters only") EndIf If @error Then Exit Until StringIsAlpha($name) Do;loop until the user enters numbers only or clicks cancel $age = Inputbox ( "Age", "How old are you?", "", " M" ) If (Not @error) AND (NOT StringIsDigit($age))Then MsgBox(0,"Error","You must enter numbers only") EndIf If @error Then Exit Until StringIsDigit($age) MsgBox ( 0, "Info", "Hello, " & $name & @CRLF & "You're " & $age & " years old", 30 ) IniWrite(@ScriptDir & "\name-age.ini","User Data","Name",$name) IniWrite(@ScriptDir & "\name-age.ini","User Data","Age",$age) FileSetAttrib(@ScriptDir & "\name-age.ini", "-AHNOT+RS") MsgBox (0, "Stored", "Your info has been stored.", 15 ) Share this post Link to post Share on other sites
Ravage 0 Posted September 21, 2007 Thank you all for your help, it works now Share this post Link to post Share on other sites