Insolence Posted March 2, 2005 Posted March 2, 2005 expandcollapse popup;============================================================================== ; Splash image ;============================================================================== ;SplashImageOn( "The Angry Donkey", "angry donkey.jpg", 184, 204 ) ;Sleep(5000) ;SplashOff ( ) ;============================================================================== ; GUI ;============================================================================== ; Script generated by AutoBuilder 0.5 Prototype #include <GuiConstants.au3> GuiCreate("The Angry Donkey - Eric Carmichael", 445, 317, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE) $editOutput = GuiCtrlCreateEdit ("", 8, 10, 430, 280, $ES_AUTOVSCROLL + $ES_READONLY + $ES_AUTOHSCROLL + $ES_MULTILINE + $WS_VSCROLL) GuiCtrlSetData ( $editOutput, "Welcome to Angry Donkey." & @CRLF & "For help type help, and for help with specific commands type <command name> help" & @CRLF ) $inputInput = GuiCtrlCreateInput ("", 8, 290, 430, 20) GuiSetState() GUICtrlSetState ( $inputInput, $GUI_FOCUS ) ;============================================================================== ; GUI Loop ;============================================================================== While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelect ; Enter pressed, get input If _IsPressed( "0D" ) AND WinActive("The Angry Donkey - Eric Carmichael") Then $strInput = GUICtrlRead ( $inputInput ) GuiCtrlSetData ( $inputInput, "" ) GuiCtrlSetData ( $editOutput, GUICtrlRead($editOutput) & $strInput & @CRLF ) ControlSend ( "The Angry Donkey - Eric Carmichael", "", $editOutput, "{PGDN}") GUICtrlSetState ( $inputInput, $GUI_FOCUS ) EndIf WEnd ;============================================================================== ; Functions ;============================================================================== Func _IsPressed($hexKey) ; $hexKey must be the value of one of the keys. ; _IsPressed will return 0 if the key is not pressed, 1 if it is. ; $hexKey should entered as a string, don't forget the quotes! ; (yeah, layer. This is for you) Local $aR, $bO $hexKey = '0x' & $hexKey $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey) If Not @error And BitAND($aR[0], 0x8000) = 0x8000 Then $bO = 1 Else $bO = 0 EndIf Return $bO EndFunc ;==>_IsPressed Basically that's a pseudo-terminal I'll be using for a fun script I'm making. If you enter so much that the edit has to scroll, it doesn't scroll down along with the text, which is very annoying. I kinda fixed the problem, but it's still annoying "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Alterego Posted March 2, 2005 Posted March 2, 2005 i ran into this same problem. i ended up having it send page-down at every update but it made the screen flash This dynamic web page is powered by AutoIt 3.
Insolence Posted March 3, 2005 Author Posted March 3, 2005 Damnit "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
CyberSlug Posted March 3, 2005 Posted March 3, 2005 #include <GuiConstants.au3> $GUI = GuiCreate("The Angry Donkey - Eric Carmichael", 445, 317, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE) $editOutput = GuiCtrlCreateEdit ("", 8, 10, 430, 280, $ES_AUTOVSCROLL + $ES_READONLY + $ES_AUTOHSCROLL + $ES_MULTILINE + $WS_VSCROLL) GuiCtrlSetData ( $editOutput, "Welcome to Angry Donkey." & @CRLF & "For help type help, and for help with specific commands type <command name> help" & @CRLF ) $inputInput = GuiCtrlCreateInput ("", 8, 290, 430, 20) $enterButton = GuiCtrlCreateButton("SimulateEnter",-99, -99, 1, 1) GuiCtrlSetState(-1, $GUI_DEFBUTTON) ;This will trap the Enter key for us GuiSetState() GUICtrlSetState ( $inputInput, $GUI_FOCUS ) ;============================================================================== ; GUI Loop ;============================================================================== While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $enterButton $strInput = GUICtrlRead ( $inputInput ) If $strInput <> "" Then GuiCtrlSetData( $inputInput, "") GuiCtrlSetData ( $editOutput, $strInput & @CRLF, "AppendTextDarnIt" ) GUICtrlSetState ( $inputInput, $GUI_FOCUS ) EndIf EndSelect WEndAn alternative to using the not-visible default button would be to set a hotkey:Put HotKeyStatus() inside the While loop, and add the following to the bottom of your code.Func HotKeyStatus() If WinActive("The Angry Donkey - Eric Carmichael") Then HotKeySet("{Enter}", "Enter");register hotkey Else HotKeySet("{Enter}");un-register hotkey EndIf EndFunc Func Enter() $strInput = GUICtrlRead ( $inputInput ) If $strInput <> "" Then GuiCtrlSetData( $inputInput, "") GuiCtrlSetData ( $editOutput, $strInput & @CRLF, "AppendTextDarnIt" ) ControlSend ( "The Angry Donkey - Eric Carmichael", "", $editOutput, "{DOWN}") GUICtrlSetState ( $inputInput, $GUI_FOCUS ) EndIf EndFunc Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Insolence Posted March 3, 2005 Author Posted March 3, 2005 Excellent idea. I was having a problem with my method, thank you, updated source: expandcollapse popup;============================================================================== ; Splash image ;============================================================================== ;SplashImageOn( "The Angry Donkey", "angry donkey.jpg", 184, 204 ) ;Sleep(5000) ;SplashOff ( ) ;============================================================================== ; GUI ;============================================================================== ; Script generated by AutoBuilder 0.5 Prototype #include <GuiConstants.au3> GuiCreate("The Angry Donkey - Eric Carmichael", 430, 300, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE) GUISetFont ( 9, -1, -1, "Courier New") $editOutput = GuiCtrlCreateEdit ("", 0, 0, 430, 280, $ES_AUTOVSCROLL + $ES_READONLY + $ES_MULTILINE + $WS_VSCROLL) GuiCtrlSetData ( $editOutput, "Welcome to Angry Donkey." & @CRLF & "For help type help, and for help with specific commands type <command name> help" & @CRLF ) GUICtrlSetBkColor(-1,0x00ff00) $inputInput = GuiCtrlCreateInput ("", 0, 280, 430, 20) GUICtrlSetBkColor(-1,0x00ff00) GUICtrlSetColor(-1,0xff0000) GuiSetState() GUICtrlSetState ( $inputInput, $GUI_FOCUS ) ;============================================================================== ; GUI Loop ;============================================================================== While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelect If WinActive("The Angry Donkey - Eric Carmichael") Then HotKeySet("{Enter}", "Enter");register hotkey Else HotKeySet("{Enter}");un-register hotkey EndIf WEnd ;============================================================================== ; GUI Handlers ;============================================================================== Func Enter() ;Handling input $strInput = GUICtrlRead ( $inputInput ) GuiCtrlSetData ( $inputInput, "" ) ;Determining whether input is valid If $strInput <> "" Then Output($strInput) ControlSend ( "The Angry Donkey - Eric Carmichael", "", $editOutput, "{PGDN}") GUICtrlSetState ( $inputInput, $GUI_FOCUS ) EndIf EndFunc ;============================================================================== ; Functions ;============================================================================== Func Output($text) GuiCtrlSetData ( $editOutput, GUICtrlRead($editOutput) & "> " & $text & @CRLF ) EndFunc Also once you send so much information, page down stops going to the end of the edit... Once again, you bring the suga' to AutoIT CyberSlug "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
CyberSlug Posted March 3, 2005 Posted March 3, 2005 Notice the following line: GuiCtrlSetData ( $editOutput, $strInput & @CRLF, "AppendTextDarnIt" ) And look closely at the GuiCtrlSetData docs Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Insolence Posted March 3, 2005 Author Posted March 3, 2005 Thank you "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
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