Jump to content

Write SystemInfo from Dos to Notepad


sak
 Share

Recommended Posts

Write SystemInfo from Dos to Notepad. It's easy.:unsure:

#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 by sak
Link to comment
Share on other sites

Write text from Notepad to GUI Edit. It's Easy. :unsure:

#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 by sak
Link to comment
Share on other sites

Same as code. Use RunWait and @ComSpec. :unsure:

#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 by sak
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...