sak Posted April 17, 2011 Posted April 17, 2011 (edited) Write SystemInfo from Dos to Notepad. It's easy. #NoTrayIcon #include <Process.au3> Global $sCommand = 'SystemInfo > SYSINFO.txt' Global $sText = 'SYSINFO.txt' SystemInfo() Func SystemInfo() _RunDOS( $sCommand) If Not @error Then _RunDOS($sText) EndFunc Edited April 17, 2011 by sak
sak Posted April 17, 2011 Author Posted April 17, 2011 (edited) Write text from Notepad to GUI Edit. It's Easy. expandcollapse popup#NoTrayIcon #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Process.au3> Opt("MustDeclareVars", 1) Global $guititle = 'Idia design by:sak2005' Global $txttitle = 'SYSINFO.txt - Notepad' Global $sCommand = 'SYSTEMINFO > SYSINFO.txt' Global $sText = 'SYSINFO.txt' Global $ctlclass = '[Class:Notepad]', $ctlid = 'Edit1' Global $Edit, $textinfo, $nMsg If Not FileExists($sText) Then ToolTip("Please wait!", 400, 300, "") _RunDOS($sCommand) If Not @error Then ToolTip("") Sleep(500) ShellExecute($sText) EndIf Else ShellExecute($sText) EndIf GUICreate($guititle, 540, 448, -1, -1) $Edit = GUICtrlCreateEdit("", 16, 16, 505, 417, _ BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_READONLY,$ES_WANTRETURN,$WS_HSCROLL,$WS_VSCROLL)) GUISetState(@SW_SHOW) WinWait($guititle) $textinfo = ControlGetText($ctlclass, "", $ctlid) GUICtrlSetData($Edit, @TAB&@TAB&@TAB&@TAB&"SystemInfo"&@CRLF&$textinfo) If GUICtrlRead($Edit) <> '' Then WinClose($txttitle) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Edited April 17, 2011 by sak
sak Posted April 18, 2011 Author Posted April 18, 2011 (edited) Same as code. Use RunWait and @ComSpec. #NoTrayIcon Global $sCommand = 'SystemInfo > SYSINFO.txt' Global $sText = 'SYSINFO.txt' SystemInfo() Func SystemInfo() If Not FileExists($sText) Then ToolTip("Please wait!", 400, 300) RunWait(@ComSpec & " /c " & $sCommand, "", @SW_HIDE) If Not @error Then ToolTip("") Sleep(500) ShellExecute($sText) WinWait("[Class:Notepad]") WinSetOnTop("[Class:Notepad]", "", 1) EndIf Else ShellExecute($sText) WinWait("[Class:Notepad]") WinSetOnTop("[Class:Notepad]", "", 1) EndIf EndFunc Edited April 18, 2011 by sak
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