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