Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/01/2013 in all areas

  1. Reinhardt1julian , Just check to see if there is anything selected before doing anything at all: Case $Button3wah If _GUICtrlListView_GetSelectedIndices($List1wah) Then ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $selMessd2 = _GUICtrlListView_GetItemCount($List1wah) If $selMessd2 = 0 Then MsgBox(0, "Error", "Nothing here") Else $selectedwah = _GUICtrlListView_GetItemTextString($List1wah, _GUICtrlListView_GetSelectionMark($List1wah)) If $selectedwah = "|" Or $selectedwah = "||" Then Else GUICtrlCreateListViewItem($selectedwah, $List2wah) _GUICtrlListView_DeleteItemsSelected($List1wah) $aSorting = False _GUICtrlListView_SimpleSort($List2wah, $aSorting, 0) EndIf EndIf EndIf That works for me. M23
    1 point
  2. MHz

    Command Prompt

    I added a limit to what is put into the edit control as it can only do 30000 characters and then accepts no more. So, only approximately last 15000 is kept. Added CLS to clear the edit control. Added $tail variable to keep output of last command as you mention about ping.... Try this and see if it suits your interest. #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <Constants.au3> #include <GuiEdit.au3> #include <Misc.au3> #include <ButtonConstants.au3> $hGUI = GUICreate("Command Prompt", 600, 326) $hEdit = GUICtrlCreateEdit('', 0, 0, 600, 297, BitOR($WS_VSCROLL, $ES_AUTOVSCROLL, $ES_WANTRETURN, $ES_READONLY)) GUICtrlSetFont(-1, 10, 400, 0, "Lucida Console") GUICtrlSetBkColor(-1, 0x000000) GUICtrlSetColor(-1, 0xFFFFFF) $Input1 = GUICtrlCreateInput("", 104, 299, 483, 21) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, 0x000000) $Button1 = GUICtrlCreateButton("Send", 8, 297, 91, 25, $BS_DEFPUSHBUTTON) GUISetState(@SW_SHOW) $DOS = Run('"' & @ComSpec & '"', '', @SW_HIDE, $STDERR_MERGED + $STDIN_CHILD) Global $tail While ProcessExists($DOS) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE StdInWrite($DOS, 'Exit' & @CRLF) ProcessWaitClose($DOS) Case $Button1 ; clear screen using cls Switch GuiCtrlRead($Input1) Case 'cls' GUICtrlSetData($hEdit, '') GUICtrlSetData($Input1, '') ContinueLoop EndSwitch ; write in command StdinWrite($DOS, GuiCtrlRead($Input1) & @CRLF) ; clear input ctrl GUICtrlSetData($Input1, '') ; clear tail of stdout data $tail = '' Case Else ; get output from command $Stdout = StdoutRead($DOS) If @extended Then ; add to tail $tail &= $Stdout ; read edit ctrl $sEdit = GUICtrlRead($hEdit) ; limit size in edit to prevent reaching full limit If StringLen($sEdit) > 15000 Then GUICtrlSetData($hEdit, StringRight($sEdit, 15000)) EndIf ; append stdout to edit ctrl GUICtrlSetData($hEdit, $Stdout, True) ElseIf StringRight($tail, 1) = '>' Then ; show out of tail when > is found at the end MsgBox(0, 'tail', $tail) $tail = '' EndIf EndSwitch WEnd
    1 point
  3. Welcome to AutoIt and the forum! To handle multiple GUIs I recommend you read the wiki about this subject. BTW: Could you please enclose your code in AutoIt tags (the blue A icon in the editor)? That greatly enhances readability
    1 point
  4. carteblanche619, Welcome to the AutoIt forum. When you post code please use Code tags - see here how to do it. Then you get a scrolling box and syntax colouring as you can see above now I have added the tags. M23
    1 point
  5. MHz

    Command Prompt

    Try this version. It checks what may be in the buffer while looping when Case Else is actioned. #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <Constants.au3> #include <GuiEdit.au3> #include <Misc.au3> #include <ButtonConstants.au3> $hGUI = GUICreate("Command Prompt", 600, 326) $hEdit = GUICtrlCreateEdit('', 0, 0, 600, 297, BitOR($WS_VSCROLL, $ES_AUTOVSCROLL, $ES_WANTRETURN, $ES_READONLY)) GUICtrlSetFont(-1, 10, 400, 0, "Lucida Console") GUICtrlSetBkColor(-1, 0x000000) GUICtrlSetColor(-1, 0xFFFFFF) $Input1 = GUICtrlCreateInput("", 104, 299, 483, 21) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, 0x000000) $Button1 = GUICtrlCreateButton("Send", 8, 297, 91, 25, $BS_DEFPUSHBUTTON) GUISetState(@SW_SHOW) $DOS = Run('"' & @ComSpec & '"', '', @SW_HIDE, $STDERR_MERGED + $STDIN_CHILD) While ProcessExists($DOS) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE StdInWrite($DOS, 'Exit' & @CRLF) ProcessWaitClose($DOS) Case $Button1 StdinWrite($DOS, GuiCtrlRead($Input1) & @CRLF) GUICtrlSetData($Input1, '') Case Else If StdoutRead($DOS, True) Then GUICtrlSetData($hEdit, StdoutRead($DOS), True) EndSwitch WEnd Seems to be working ok.
    1 point
  6. i know that's what i want to do, just a proof of concept though, not a real goal beside.
    1 point
  7. Just for your information: If you want to use some specific GUI-color-commands and have Visual Styles/Themes (not XP-Classic-Theme) enabled they sometimes will not work. One possibility is to turn off the using of visual styles with a small "DllCall"-command in your script. The best is if you place it at the beginning of your script before showing a GUI. More infos also are here available: http://msdn.microsoft.com/library/default....pproperties.asp ; Functionality : ; just info about possibility to turn of theme-using in scripts/compiled-exe with using GUI stuff ; $nFlag = 0 ; Visual styles are completely disabled in the running script ; $nFlag = 1; Nonclient areas of the GUI can use visual styles ; $nFlag = 2; Controls can use visual styles (like Buttons, Progressbar, Group-ctrl's, etc.) ; $nFlag = 4; Web content displayed ??? (info from MSDN) can use visual styles ; ; These flags can be combined with BitOr(...) DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $nFlag)Regards Holger
    1 point
×
×
  • Create New...