ฟอรั่ม PSsix

Would you like to react to this message? Create an account in a few clicks or log in to continue.

ฟอรั่มของบล็อก http://pssix.blogspot.com


    SystemInfo

    sak20102005
    sak20102005
    ระงับสมาชิก
    ระงับสมาชิก


    SystemInfo Empty
    จำนวนข้อความ : 96
    ความนิยม : 4
    เข้าร่วมเมื่อ : 07/04/2011

    SystemInfo Empty SystemInfo

    ตั้งหัวข้อ by sak20102005 18/04/11, 10:22 pm

    Example:Copy text from Dos command to NotePad and Write text from Notepad to GUI Edit.

    Code:
    #NoTrayIcon

    Global $sCommand = 'SystemInfo > SYSINFO.txt'
    Global $sText = 'SYSINFO.txt'
    Global $sClass = '[Class:Notepad]'

    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($sClass)
                WinSetOnTop($sClass, "", 1)
            EndIf
        Else
            ShellExecute($sText)
            WinWait($sClass)
            WinSetOnTop($sClass, "", 1)
        EndIf
    EndFunc

    Code:
    #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', $TextTip = 'Please wait!'
    Global $ctlclass = '[Class:Notepad]', $ctlid = 'Edit1'
    Global $Edit, $textinfo, $nMsg

    If Not FileExists($sText) Then
        ToolTip($TextTip, 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

      เวลาขณะนี้ 28/03/24, 10:17 pm