MetalSpongebob Posted December 3, 2007 Share Posted December 3, 2007 Hi,I had an idea,write a program with GUI to manage the dos...a "frontend"Is an good idea,I create the gui with buttons,each button with a function that works with _rundos("namefunction").But I can only call the command with _rundos,to complete that program I need that informations of the dos commands are displayed in my gui program.How can display information (like the exaple)in the gui?Example with dos command "Tree c:\" (once used displays the structure of directories) Noob but ethical Link to comment Share on other sites More sharing options...
Paulie Posted December 3, 2007 Share Posted December 3, 2007 STDOutRead() Link to comment Share on other sites More sharing options...
MetalSpongebob Posted December 3, 2007 Author Share Posted December 3, 2007 sorry but I tryed _rundos("tree c:\")stdoutread("cmd")and dont work...dont understand Noob but ethical Link to comment Share on other sites More sharing options...
picaxe Posted December 3, 2007 Share Posted December 3, 2007 (edited) Don't know if it works with _RunDos. It certainly does with Run as per example from AutoIt help #include <Constants.au3> $foo = Run(@ComSpec & " /c tree c:\", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) $line = "" While 1 $line = StdoutRead($foo) If @error Then ExitLoop FileWrite("c:\test.txt", $line) Wend RunWait("notepad.exe c:\test.txt", "") FileDelete("c:\test.txt") Edited December 3, 2007 by picaxe Link to comment Share on other sites More sharing options...
MetalSpongebob Posted December 11, 2007 Author Share Posted December 11, 2007 Thak you for help,but your code doesn't work(script remain in execution,but without do nothing) I need to display in a windows or other a command dos like "tree" regardless the method(see screenshot at begin of topic) Noob but ethical Link to comment Share on other sites More sharing options...
picaxe Posted December 11, 2007 Share Posted December 11, 2007 (edited) It works for me. If you have a lot of folders in c:\ it could take a long time. This is faster #include <Constants.au3> $foo = Run(@ComSpec & " /c tree c:\", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) $line = "" While 1 $line &= StdoutRead($foo) If @error Then ExitLoop Wend ClipPut($line) Run("notepad.exe", "") WinWaitActive("Untitled -", "") Send("^v") Edited December 12, 2007 by picaxe Link to comment Share on other sites More sharing options...
Gianni Posted October 12, 2008 Share Posted October 12, 2008 Hi,I had an idea,write a program with GUI to manage the dos...a "frontend"Is an good idea,I create the gui with buttons,each button with a function that works with _rundos("namefunction").But I can only call the command with _rundos,to complete that program I need that informations of the dos commands are displayed in my gui program.How can display information (like the exaple)in the gui?Example with dos command "Tree c:\" (once used displays the structure of directories)Try with this, it is a prototype but it works:enter your dos command in the inputbox and then click on button1to see the output in the editboxByeCODE#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.12.1enter your dos command in the inputbox and then click on button1to see the result in the editbox #ce ----------------------------------------------------------------------------; Script Start - Add your code below here#include <Constants.au3>#include <GUIConstants.au3>#include <WindowsConstants.au3>#include <EditConstants.au3>#include <StaticConstants.au3>Opt("GUIOnEventMode", 1) ; Change to OnEvent mode#Region ### START Koda GUI section ### Form=$mainwindow = GUICreate("Form1", 583, 305, 207, 157)GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSE_Clicked")$Edit1 = GUICtrlCreateEdit("", 16, 40, 553, 249) ; Edit box (multiline)GUICtrlSetFont(-1, 10, 400, 0, "Courier New") ; FontGUICtrlSetColor(-1, 0x00FF00) ; Color of charactersGUICtrlSetBkColor(-1, 0x000000) ; Color of background; GUICtrlSetData($Edit1, $line)$Input1 = GUICtrlCreateInput("", 16, 8, 465, 21) ; InputBox (1 line)$Button1 = GUICtrlCreateButton("Button1", 496, 8, 73, 25, 0) ; ButtonGUICtrlSetOnEvent($Button1, "Button1_Click")GUISetState(@SW_SHOW)#EndRegion ### END Koda GUI section ###Local $prompt = Run(@ComSpec & " /K " , "c:\temp", @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD + $STDERR_MERGED)While 1 Sleep(1000) ; Idle around (endless loop)WEnd; - - - - Functions zone - - - -Func Button1_Click() ;Note: at this point @GUI_CTRLID would equal $okbutton ; MsgBox(0, "GUI Event", "You pressed Button!") ; StdinWrite($prompt, "dir c:\temp" & @CRLF) StdinWrite($prompt, GUICtrlRead($Input1) & @CRLF & @CRLF) Sleep(1000) $line = StdoutRead($prompt) GUICtrlSetData($Edit1,"") GUICtrlSetData($Edit1, $line) ; lMsgBox(0, "STDOUT read:", $line) EndFuncFunc CLOSE_Clicked() ;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE, ;@GUI_WINHANDLE will be either $mainwindow or $dummywindow If @GUI_WINHANDLE = $mainwindow Then ; MsgBox(0, "GUI Event", "You clicked CLOSE in the main window! Exiting...") Exit EndIf EndFunc Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
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