Guest Guidosoft Posted August 13, 2004 Posted August 13, 2004 I don't think anyone posted this before but I made an include script that let's you easily ask a question in the notepad and allows the user to type the answer and press enter and then you recieve the answer. It's sort of like the basic's Input command for dos. Does anybody want it. I send it to you by email. Just contact me at parkofnoah@yahoo.com
Developers Jos Posted August 13, 2004 Developers Posted August 13, 2004 (edited) I don't think anyone posted this before but I made an include script that let's you easily ask a question in the notepad and allows the user to type the answer and press enter and then you recieve the answer. It's sort of like the basic's Input command for dos. Does anybody want it. I send it to you by email. Just contact me at parkofnoah@yahoo.com <{POST_SNAPBACK}>Why not post it the to PUBLIC space available... http://www.autoitscript.com/forum/index.php?showtopic=3061 ps.. maybe better not to post your email address in that format to avoid spam... Edited August 13, 2004 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Bartokv Posted August 13, 2004 Posted August 13, 2004 I don't think anyone posted this before but I made an include script that let's you easily ask a question in the notepad and allows the user to type the answer and press enter and then you recieve the answer. It's sort of like the basic's Input command for dos. Does anybody want it. I send it to you by email. Just contact me at parkofnoah@yahoo.com <{POST_SNAPBACK}>Sounds good... Kind of like AutoIt's InputBox command, but with an added search filter? (Or the SET /P command in the later versions of DOS) :">
Guest Guidosoft Posted August 13, 2004 Posted August 13, 2004 OH yea. I did not know as much as I know now about autoit so I made it so it requires three directions to recieve input from the notepad. Here is the example. I know I should of made it so you could do it easier. I will in the next version. #Include "NotepadConsole1.AU3" Global $Question Global $Answer Global $Answered Global $ConsoleTitle $ConsoleTitle = "My Notepad Console" Call("LoadConsole") $Question = "What is your name? " Call("Ask") $Name = $Answer Send("Your name is "&$Name) The question will be prinited in the notepad. You actualy type the answer in the notepad after the question and press enter. And it returns the answer. Just like dos. I figured since AutoIt can do what it can do, why not make it so you can have full console applications made with it including the input feature.. I am gona make another version with more console like stuff and it will be much easier to use. In the next version all that is needed will be one line for everything like $Answer = Input("Question") and LoadConsole("My Console"). I will do that soon. Now you can replicate dos programs in the notepad. It's at www.http://www.autoitscript.com/fileman/user/public/Guidosoft/notepadconsole1.AU3. If this is wrong then just goto the public area and look for it in my folder. Please comment on what I can add and how I can improve this.
Guest Guidosoft Posted August 14, 2004 Posted August 14, 2004 Well, I made NotepadConsole2.au3 but it still sucks with bugs like the user backspacing the question and crap. It is now easier to use though. I am working on another version(NotepadConsole3.au3) witch will be much better. It will fix alot of things like. 1) The user backspacing the question. (This cause problems, as a matter of fact if the question isn't there then the script won't be able to tell where the answer is.) Did that part. Didn't release it yet though. 2) The user writting while the thing is writting. 3) QUICK PLACMENT OF TEXT AND QUESTIONS DUDE. No way am I gona leave that old send command to type on letter at a time. Just use the console commands to quickly place the text via clipboard(Quite simple actualy. 2 lines of code.) 4) No more of the user clicking off the notepad and having accidents like typing in their important work. 5) I'll think of more stuff.
BasicOs Posted August 14, 2004 Posted August 14, 2004 (edited) if you please, dont open some many topics for the same thing, i hate the rubbish-nonsense topics which are different to the info topics..., which care for getting a better level here, if you are younger of 12 years old you may not understand what i mean, then sorry(i dont know your age) . im trying to be constructive with this reply , i supousse my reply itself is also a rubbish-nonsense topic -- but guido may read and other alike Anyway i find nice that of changing the gui, something dry.............. Edited August 14, 2004 by BasicOs Autoit.es - Foro Autoit en Español Word visitors Image Clustrmap image: - Football Spanish team - Spanish team: Casillas, Iniesta, Villa, Xavi, Puyol, Campdevilla, etc..Programando en Autoit+Html - Coding Autoit-Html - Arranca programas desde Internet - Preprocesador de Autoit a http
ioliver Posted August 17, 2004 Posted August 17, 2004 (edited) Thanks for the script. I want to try to start working with it. Can you povide me with some example code for how to Ask Questions and Print Answers? Thanks again, Ian This is what I was trying, but I guess it's not right: ; Note-Term.au3 ; August 17, 2004 #Include NotepadConsole2.au3 Global $Question Global $Answer Global $Answered Global $ConsoleTitle Run("Notepad.exe") LoadConsole("Untitled - Notepad") ActivateConsole() $Answer = Input("What is your name? ") Send("Your name is " & $Answer) Edited August 17, 2004 by ioliver "Blessed be the name of the Lord" - Job 1:21Check out Search IMF
Guest Guidosoft Posted August 17, 2004 Posted August 17, 2004 (edited) Thanks for the script. I want to try to start working with it. Can you povide me with some example code for how to Ask Questions and Print Answers? Thanks again, Ian This is what I was trying, but I guess it's not right: ; Note-Term.au3 ; August 17, 2004 #Include NotepadConsole2.au3 Global $Question Global $Answer Global $Answered Global $ConsoleTitle Run("Notepad.exe") LoadConsole("Untitled - Notepad") ActivateConsole() $Answer = Input("What is your name? ") Send("Your name is " & $Answer) <{POST_SNAPBACK}>NotepadConsole2.AU3 no longer requires globals. The loadconsole function opens the notepad itself. You need only provide a title not a window title of an opened notepad. The notepad already activates when you run it so you don't need that when you load the console. Here is the correct code: #Include "NotepadConsole2.AU3" LoadConsole("My Console") $Name = Input("What is your name? ") Send("Your name is "&Answer") See very simple. Warning! Don't backspace or alter the question within the notepad. The script depends on the length of the line subtracted by the length of the question to extract the answer. BTW, Make sure you get script 3 when I make it. It will be much much better. Harder for the user to flaw. Edited August 17, 2004 by Guidosoft
ioliver Posted August 17, 2004 Posted August 17, 2004 (edited) ; Note-Term.au3 ; August 17, 2004 #Include NotepadConsole2.au3 Run("Notepad.exe") LoadConsole("My Console") $Answer = Input("What is your name? ") Send("Your name is " & $Answer) This is what I have now but it's still not working. Right now I have the NotepadConsole.au3 script in the same directory as the script that I'm working on. Do I need to have it there are somewhere else? Thanks again, Ian -> I got it to work, I moved the file to the Include Dir. And I was also missing quotes ("") around the NotepadConsole2.au3. Ian Edited August 17, 2004 by ioliver "Blessed be the name of the Lord" - Job 1:21Check out Search IMF
ioliver Posted August 17, 2004 Posted August 17, 2004 Here's the code that I have now, just in case someone is interested. It dosen't do much, but it uses the NotepadConsole.au3 script. ; Note-Term.au3 ; August 17, 2004 #Include "NotepadConsole2.au3" Dim $MyPrompt = "Note-Term" LoadConsole("Note-Term") Call("Main") Func Main() $Prompt = Input($MyPrompt & ": ") $Prompt = StringLower($Prompt) Select Case $Prompt = "time" Call("Func_Time") Case $Prompt = "prompt" Call("Func_MyPrompt") EndSelect EndFunc Func Func_Time() $currenttime = @HOUR & ":" & @MIN & ":" & @SEC Send("Time: " & $currenttime) Send("{ENTER}") Call("Main") EndFunc Func Func_MyPrompt() $NewPrompt = Input("Type your new prompt: ") $MyPrompt = $NewPrompt Send("{ENTER}") Call("Main") EndFunc Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF
Guest Guidosoft Posted August 18, 2004 Posted August 18, 2004 (edited) Here's the code that I have now, just in case someone is interested. It dosen't do much, but it uses the NotepadConsole.au3 script. ; Note-Term.au3 ; August 17, 2004 #Include "NotepadConsole2.au3" Dim $MyPrompt = "Note-Term" LoadConsole("Note-Term") Call("Main") Func Main() $Prompt = Input($MyPrompt & ": ") $Prompt = StringLower($Prompt) Select Case $Prompt = "time" Call("Func_Time") Case $Prompt = "prompt" Call("Func_MyPrompt") EndSelect EndFunc Func Func_Time() $currenttime = @HOUR & ":" & @MIN & ":" & @SEC Send("Time: " & $currenttime) Send("{ENTER}") Call("Main") EndFunc Func Func_MyPrompt() $NewPrompt = Input("Type your new prompt: ") $MyPrompt = $NewPrompt Send("{ENTER}") Call("Main") EndFunc Ian <{POST_SNAPBACK}>You might wan't to consider using an infanite loop and not have a function call a function that called it. There is a limit to how deep functions can be inside of each other, pushing that limit will result in error. Instead of: Func Func1() Call("Func2") EndFunc Func Func2() Call("Func1") EndFunc You should have: Func Func1() While 1 Call("Func2") Wend EndFunc Func Func2() ;Do some stuff here EndFunc The loop can be killed at anytime by using the ExitLoop command. Edited August 18, 2004 by Guidosoft
Guest Guidosoft Posted August 18, 2004 Posted August 18, 2004 Just finished NotepadConsole.Au3. It's in the Public Files area in my folder "Guidosoft". You still use it the same way but it's better. In this version it is defenitly much harder to mess anything up ya know? Know, the user can go to another window and return with no probs. The user can exit the window with no probs. The user can't screw up the question. Narly yea. The only roblem is that you have to click in the window on the same line you left off. You also can use the 2 new functions ConsoleOutput and ConsoleOutputLine instead of Send("sass") and Send("dsdsd{ENTER}"). Why should you use it. Well when you use send it takes a while to type it all, but when you use the new function it just pastes it write on quick in one shot via the clip board. Narly yea. Just got keep saying Narly. Can't help it.
upnorth Posted August 18, 2004 Posted August 18, 2004 expandcollapse popupGlobal $CONSOLE_ANSWER Global $CONSOLE_ANSWERED Global $TEMP_HANDLE = -1 Func ActivateConsole() Opt ("WinTitleMatchMode", 4) WinActivate("Handle=" & $TEMP_HANDLE) EndFunc ;==>ActivateConsole Func LoadConsole($CONSOLETITLE) Local $CLASSNAME = 'classname=Notepad' Opt ("WinTitleMatchMode", 4) Run("Notepad.exe") WinWait($CLASSNAME) $TEMP_HANDLE = WinGetHandle($CLASSNAME) WinSetTitle("Handle=" & $TEMP_HANDLE, "", "Notepad Console - " & $CONSOLETITLE) EndFunc ;==>LoadConsole Func SetConsoleTitle($CONSOLE_TITLE) Opt ("WinTitleMatchMode", 4) WinSetTitle("Handle=" & $TEMP_HANDLE, "", "Notepad Console - " & $CONSOLETITLE) EndFunc ;==>SetConsoleTitle Func GetConsoleTitle() Opt ("WinTitleMatchMode", 4) Return WinGetTitle("Handle=" & $TEMP_HANDLE) EndFunc ;==>GetConsoleTitle Func CloseConsole() Opt ("WinTitleMatchMode", 4) WinKill("Handle=" & $TEMP_HANDLE) EndFunc ;==>CloseConsole Func Input($QUESTION) Opt ("WinTitleMatchMode", 4) ControlSend("Handle=" & $TEMP_HANDLE, "", "Edit1", "{END}" & @LF & $QUESTION & @LF) WaitAnswer() Return $CONSOLE_ANSWER EndFunc ;==>Input Func WaitAnswer() HotKeySet("{ENTER}", "Answer") While $CONSOLE_ANSWERED = 0 Sleep(10) Wend $CONSOLE_ANSWERED = 0 EndFunc ;==>WaitAnswer Func Answer() HotKeySet("{ENTER}") $CONSOLE_ANSWER = _getlastline() $CONSOLE_ANSWERED = 1 EndFunc ;==>Answer Func _getlastline() Opt ("WinTitleMatchMode", 4) Local $TEMP_LINE_COUNT = ControlCommand("Handle=" & $TEMP_HANDLE, "", "Edit1", "GetLineCount", "") Return ControlCommand("Handle=" & $TEMP_HANDLE, "", "Edit1", "GetLine", $TEMP_LINE_COUNT) EndFunc ;==>_getlastline Func ClearConsole() ControlSend("Handle=" & $TEMP_HANDLE, "", "Edit1", "^a{DEL}") EndFunc ;==>ClearConsole
Guest Guidosoft Posted August 18, 2004 Posted August 18, 2004 (edited) expandcollapse popupGlobal $CONSOLE_ANSWER Global $CONSOLE_ANSWERED Global $TEMP_HANDLE = -1 Func ActivateConsole() Opt ("WinTitleMatchMode", 4) WinActivate("Handle=" & $TEMP_HANDLE) EndFunc ;==>ActivateConsole Func LoadConsole($CONSOLETITLE) Local $CLASSNAME = 'classname=Notepad' Opt ("WinTitleMatchMode", 4) Run("Notepad.exe") WinWait($CLASSNAME) $TEMP_HANDLE = WinGetHandle($CLASSNAME) WinSetTitle("Handle=" & $TEMP_HANDLE, "", "Notepad Console - " & $CONSOLETITLE) EndFunc ;==>LoadConsole Func SetConsoleTitle($CONSOLE_TITLE) Opt ("WinTitleMatchMode", 4) WinSetTitle("Handle=" & $TEMP_HANDLE, "", "Notepad Console - " & $CONSOLETITLE) EndFunc ;==>SetConsoleTitle Func GetConsoleTitle() Opt ("WinTitleMatchMode", 4) Return WinGetTitle("Handle=" & $TEMP_HANDLE) EndFunc ;==>GetConsoleTitle Func CloseConsole() Opt ("WinTitleMatchMode", 4) WinKill("Handle=" & $TEMP_HANDLE) EndFunc ;==>CloseConsole Func Input($QUESTION) Opt ("WinTitleMatchMode", 4) ControlSend("Handle=" & $TEMP_HANDLE, "", "Edit1", "{END}" & @LF & $QUESTION & @LF) WaitAnswer() Return $CONSOLE_ANSWER EndFunc ;==>Input Func WaitAnswer() HotKeySet("{ENTER}", "Answer") While $CONSOLE_ANSWERED = 0 Sleep(10) Wend $CONSOLE_ANSWERED = 0 EndFunc ;==>WaitAnswer Func Answer() HotKeySet("{ENTER}") $CONSOLE_ANSWER = _getlastline() $CONSOLE_ANSWERED = 1 EndFunc ;==>Answer Func _getlastline() Opt ("WinTitleMatchMode", 4) Local $TEMP_LINE_COUNT = ControlCommand("Handle=" & $TEMP_HANDLE, "", "Edit1", "GetLineCount", "") Return ControlCommand("Handle=" & $TEMP_HANDLE, "", "Edit1", "GetLine", $TEMP_LINE_COUNT) EndFunc ;==>_getlastline Func ClearConsole() ControlSend("Handle=" & $TEMP_HANDLE, "", "Edit1", "^a{DEL}") EndFunc ;==>ClearConsole <{POST_SNAPBACK}>Hmm, this seems to be a modification of my NotepadConsole2.AU3 Script. Well, I guess this person made his extras to fix problems just as I made NotepadConsole3.AU3 with problems fixed as well. So what did you fix in Notepad Console 2 UP NORTH? Edited August 18, 2004 by Guidosoft
Guest Guidosoft Posted August 18, 2004 Posted August 18, 2004 Well, I like my NotepadConsole3.AU3. I have fixed alot. Just a we bit more problems but you pretty much covered one of them in ur code there. Anyway, everybody that downloaded the NotepadConsole2.AU3 should get the NotepadConsole3.AU3. It's 98% Flawless. Just 2 problemos left i think. I'll fix it in yet another version(NotepadConsole4.AU3)
ioliver Posted August 23, 2004 Posted August 23, 2004 Guidosoft, How is NotepadConsole4 comming along? How about you MS-DOS replacement? Just checking in. I think NotepadConsole is a good idea. Please keep me updated on future versions. Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF
Guest Guidosoft Posted August 24, 2004 Posted August 24, 2004 Guidosoft, How is NotepadConsole4 comming along? How about you MS-DOS replacement? Just checking in. I think NotepadConsole is a good idea. Please keep me updated on future versions. Ian <{POST_SNAPBACK}>OK, do you have NotepadConsole3.AU3?
ioliver Posted August 24, 2004 Posted August 24, 2004 Yea, I've got version 3. Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF
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