Jump to content

Search the Community

Showing results for tags 'contol'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Location


WWW


Interests

Found 1 result

  1. Hi everyone , i'm trying to make some sort of full screen console window where some of the text must be non-editable like windows CMD.exe. Text already typed before pressing enter or the working folder 'C:\...>' is read only in CMD.exe and I want to know if mimicking this behavior in an edit control is possible. My attempt to make a console makes all the [A-Za-z0-9] keys a hotkey and the main edit control is set to read only. Every time the user types something the hotkey function is triggered, the cursor in the edit control is set to the end of the text and the character you typed is added to the edit. If you try to press the {backspace} key when you are at the edge of some text that is read only nothing happens. This works but I guess it is not the best or most clean way to make something like this.. Can someone give me some advice or help me make a better function for having full control over text in the edit control? kind regards, TheAutomator #include <GuiEdit.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form = GUICreate("Console", @DesktopWidth, @DesktopHeight, 0, 0, BitOR($WS_POPUP, $DS_SETFOREGROUND), $WS_EX_TOPMOST) GUISetBkColor(0x000000) $Console = GUICtrlCreateEdit('Loading...', 32, 32, @DesktopWidth-15, @DesktopHeight - 64, BitOR($ES_READONLY,$WS_VSCROLL), 0) GUICtrlSetFont(-1, 28, 400, 0, 'OCR A Extended') GUICtrlSetColor(-1, 0x00FF00) GUICtrlSetBkColor(-1, 0x000000) GUICtrlSetCursor (-1, 2) _GUICtrlEdit_SetMargins( -1, $EC_RIGHTMARGIN, Default, 49) GUISetState(@SW_SHOW) ;################################################################################################################## Global $keys = 'abcdefghijklmnopqrstuvwxyz _ABCDEFGHIJKLMNOPQRSTUVWXYZ' ;################################################################################################################## For $_ = 1 To StringLen($keys) HotKeySet( StringMid($keys,$_,1), 'keypress') Next For $_ = 0 To 9 HotKeySet($_, 'keypress') HotKeySet('{numpad'&$_&'}', 'keypress') Next HotKeySet('{bs}','Keypress') HotKeySet('{enter}','Enter') _GUICtrlEdit_AppendText($Console, @CRLF&'Type a command:') $MIN = StringLen(GUICtrlRead($Console)) + 1 $MAX = $MIN ;################################################################################################################## Func Keypress() Local $key = @HotKeyPressed If StringLen($key) = 1 Then _GUICtrlEdit_AppendText($Console, $key) $MAX += 1 ElseIf StringRegExp($key,'\{numpad[0-9]\}') Then _GUICtrlEdit_AppendText($Console, StringMid($key,8,1)) $MAX += 1 ElseIf $key = '{bs}' Then If $max = $min then Return Else Local $len = StringLen(GUICtrlRead($Console)) _GUICtrlEdit_SetSel($Console, $len - 1, $len) _GUICtrlEdit_ReplaceSel($Console, '') $MAX -= 1 EndIf EndIf EndFunc Func Enter();handle typed commands when ENTER is pressed: Switch StringStripWS(StringLower(StringMid(GUICtrlRead($Console),$min,$max)),8) Case '' Beep(1000,50) Case 'clear' GUICtrlSetData($Console,'Command:') $MIN = StringLen(GUICtrlRead($Console)) + 1 $MAX = $MIN Return Case 'quit' Quit() Case Else _GUICtrlEdit_AppendText($Console, @CRLF&@TAB&'Unknown command!') EndSwitch _GUICtrlEdit_AppendText($Console, @CRLF&'Type a command:') $MIN = StringLen(GUICtrlRead($Console)) + 1 $MAX = $MIN EndFunc ;============================================================= Func Quit() _GUICtrlEdit_AppendText($Console, @CRLF&@TAB&'Goodbye...') Sleep(1500) Exit EndFunc While True If GUIGetMsg() = $GUI_EVENT_CLOSE Then Quit() EndIf WEnd
×
×
  • Create New...