Jump to content

How to save the output in a txt file


Recommended Posts

Hi guys and girls, I have a save option in my menu, and I want to save the output from an edit form to a text file, how can I do that?

here is my code

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <AutoItConstants.au3>
#include <GuiEdit.au3>
#include <ScrollBarsConstants.au3>
#include <GUIToolTip.au3>
Local $aWndPos
Local $vDos, $sline = ""
$NetAs = GUICreate("NetAs-Network Assistant", 1096, 521, 182, 135)
Local $idFilemenu = GUICtrlCreateMenu("&File")
Local $idExititem = GUICtrlCreateMenuItem("Exit", $idFilemenu)
Local $idSaveitem = GUICtrlCreateMenuItem("Save", $idFilemenu)
Local $idInput = GUICtrlCreateEdit("", 168, 34, 921, 465)
Local $Button1 = GUICtrlCreateButton("IPconfig", 48, 56, 75, 25)
Local $Button3 = GUICtrlCreateButton("FlushDNS", 48, 96, 75, 25)
Local $Button5 = GUICtrlCreateButton("ConnRelease", 48, 136, 75, 25)
Local $Button7 = GUICtrlCreateButton("NetStat", 48, 176, 75, 25)
Local $Button9 = GUICtrlCreateButton("Route Print", 48, 216, 75, 25)
Local $Button11 = GUICtrlCreateButton("ARP", 48, 256, 75, 25)
Local $Button13 = GUICtrlCreateButton("NSLookup", 48, 296, 75, 25)
Local $Button15 = GUICtrlCreateButton("NetStat -an", 48, 336, 75, 25)
Local $Button17 = GUICtrlCreateButton("GetMac", 48, 376, 75, 25)
Local $Button19 = GUICtrlCreateButton("Ping", 48, 416, 75, 25)
Local $Button23 = GUICtrlCreateButton("Run", 656, 8, 73, 25)
Local $Button24 = GUICtrlCreateButton("Clear", 576, 8, 75, 25)

Local $Input1 = GUICtrlCreateInput("", 736, 8, 345, 21)
GUISetState(@SW_SHOW)
$hENTER = GUICtrlCreateDummy()
Dim $AccelKeys[1][2] = [["{ENTER}", $hENTER]] ; Set accelerators
GUISetAccelerators($AccelKeys)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $idExititem
            Exit
        Case $Button1
            GUICtrlSetData($idInput, _CmdInfo() & @CRLF)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
        Case $Button3
            GUICtrlSetData($idInput, _CmdInfo2() & @CRLF)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
        Case $Button5
            GUICtrlSetData($idInput, _CmdInfo3() & @CRLF)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
        Case $Button7
            GUICtrlSetData($idInput, _CmdInfo4() & @CRLF)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
        Case $Button9
            GUICtrlSetData($idInput, _CmdInfo5() & @CRLF)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
        Case $Button11
            GUICtrlSetData($idInput, _CmdInfo6() & @CRLF)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
        Case $Button13
            GUICtrlSetData($idInput, _CmdInfo7() & @CRLF)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
        Case $Button15
            GUICtrlSetData($idInput, _CmdInfo8() & @CRLF)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
        Case $Button17
            GUICtrlSetData($idInput, _CmdInfo9() & @CRLF)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
        Case $Button19
            GUICtrlSetData($idInput, _CmdInfo10() & @CRLF)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
        Case $Button24
                GUICtrlSetData($idInput, "")
        Case $Button23, $hENTER
                $vDos = Run(@ComSpec & " /c " & GUICtrlRead($Input1), @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
                While 1
                    $sline &= StdoutRead($vDos)
                    If @error Then ExitLoop
                WEnd
                GUICtrlSetData($idInput, $sline & @CRLF)
                GUICtrlSetData($Input1, "")
                ;----> Reset
                $sline = ""
    EndSwitch
WEnd



Func _CmdInfo($_sCmdInfo = "ipconfig /all")
    Local $iPID = Run(@ComSpec & " /c " & $_sCmdInfo, "", @SW_HIDE,  BitOR($STDERR_CHILD, $STDOUT_CHILD))
    ; Wait until the process has closed using the PID returned by Run.
    ProcessWaitClose($iPID)
    ; Read the Stdout stream of the PID returned by Run. This can also be done in a while loop. Look at the example for StderrRead.
    Local $sOutput = StringReplace(StdoutRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sOutErr = StringReplace(StderrRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sReult = $sOutput <> "" ? $sOutput : $sOutErr
    Return $sReult
EndFunc
Func _CmdInfo2($_sCmdInfo2 = "IPConfig /FlushDNS")
    Local $iPID = Run(@ComSpec & " /c " & $_sCmdInfo2, "", @SW_HIDE,  BitOR($STDERR_CHILD, $STDOUT_CHILD))
    ; Wait until the process has closed using the PID returned by Run.
    ProcessWaitClose($iPID)
    ; Read the Stdout stream of the PID returned by Run. This can also be done in a while loop. Look at the example for StderrRead.
    Local $sOutput = StringReplace(StdoutRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sOutErr = StringReplace(StderrRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sReult = $sOutput <> "" ? $sOutput : $sOutErr
    Return $sReult
EndFunc
Func _CmdInfo3($_sCmdInfo3 = "IPConfig /Release")
    Local $iPID = Run(@ComSpec & " /c " & $_sCmdInfo3, "", @SW_HIDE,  BitOR($STDERR_CHILD, $STDOUT_CHILD))
    ; Wait until the process has closed using the PID returned by Run.
    ProcessWaitClose($iPID)
    ; Read the Stdout stream of the PID returned by Run. This can also be done in a while loop. Look at the example for StderrRead.
    Local $sOutput = StringReplace(StdoutRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sOutErr = StringReplace(StderrRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sReult = $sOutput <> "" ? $sOutput : $sOutErr
    Return $sReult
EndFunc
Func _CmdInfo4($_sCmdInfo4 = "NetStat")
    Local $iPID = Run(@ComSpec & " /c " & $_sCmdInfo4, "", @SW_HIDE,  BitOR($STDERR_CHILD, $STDOUT_CHILD))
    ; Wait until the process has closed using the PID returned by Run.
    ProcessWaitClose($iPID)
    ; Read the Stdout stream of the PID returned by Run. This can also be done in a while loop. Look at the example for StderrRead.
    Local $sOutput = StringReplace(StdoutRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sOutErr = StringReplace(StderrRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sReult = $sOutput <> "" ? $sOutput : $sOutErr
    Return $sReult
EndFunc
Func _CmdInfo5($_sCmdInfo5 = "Route Print")
    Local $iPID = Run(@ComSpec & " /c " & $_sCmdInfo5, "", @SW_HIDE,  BitOR($STDERR_CHILD, $STDOUT_CHILD))
    ; Wait until the process has closed using the PID returned by Run.
    ProcessWaitClose($iPID)
    ; Read the Stdout stream of the PID returned by Run. This can also be done in a while loop. Look at the example for StderrRead.
    Local $sOutput = StringReplace(StdoutRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sOutErr = StringReplace(StderrRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sReult = $sOutput <> "" ? $sOutput : $sOutErr
    Return $sReult
EndFunc
Func _CmdInfo6($_sCmdInfo6 = "ARP -a")
    Local $iPID = Run(@ComSpec & " /c " & $_sCmdInfo6, "", @SW_HIDE,  BitOR($STDERR_CHILD, $STDOUT_CHILD))
    ; Wait until the process has closed using the PID returned by Run.
    ProcessWaitClose($iPID)
    ; Read the Stdout stream of the PID returned by Run. This can also be done in a while loop. Look at the example for StderrRead.
    Local $sOutput = StringReplace(StdoutRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sOutErr = StringReplace(StderrRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sReult = $sOutput <> "" ? $sOutput : $sOutErr
    Return $sReult
EndFunc
Func _CmdInfo7($_sCmdInfo7 = "NSLookup")
    Local $iPID = Run(@ComSpec & " /c " & $_sCmdInfo7, "", @SW_HIDE,  BitOR($STDERR_CHILD, $STDOUT_CHILD))
    ; Wait until the process has closed using the PID returned by Run.
    ProcessWaitClose($iPID)
    ; Read the Stdout stream of the PID returned by Run. This can also be done in a while loop. Look at the example for StderrRead.
    Local $sOutput = StringReplace(StdoutRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sOutErr = StringReplace(StderrRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sReult = $sOutput <> "" ? $sOutput : $sOutErr
    Return $sReult
EndFunc
Func _CmdInfo8($_sCmdInfo8 = "netstat -an")
    Local $iPID = Run(@ComSpec & " /c " & $_sCmdInfo8, "", @SW_HIDE,  BitOR($STDERR_CHILD, $STDOUT_CHILD))
    ; Wait until the process has closed using the PID returned by Run.
    ProcessWaitClose($iPID)
    ; Read the Stdout stream of the PID returned by Run. This can also be done in a while loop. Look at the example for StderrRead.
    Local $sOutput = StringReplace(StdoutRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sOutErr = StringReplace(StderrRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sReult = $sOutput <> "" ? $sOutput : $sOutErr
    Return $sReult
EndFunc
Func _CmdInfo9($_sCmdInfo9 = "getmac")
    Local $iPID = Run(@ComSpec & " /c " & $_sCmdInfo9, "", @SW_HIDE,  BitOR($STDERR_CHILD, $STDOUT_CHILD))
    ; Wait until the process has closed using the PID returned by Run.
    ProcessWaitClose($iPID)
    ; Read the Stdout stream of the PID returned by Run. This can also be done in a while loop. Look at the example for StderrRead.
    Local $sOutput = StringReplace(StdoutRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sOutErr = StringReplace(StderrRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sReult = $sOutput <> "" ? $sOutput : $sOutErr
    Return $sReult
EndFunc
Func _CmdInfo10($_sCmdInfo10 = "ping google.com")
    Local $iPID = Run(@ComSpec & " /c " & $_sCmdInfo10, "", @SW_HIDE,  BitOR($STDERR_CHILD, $STDOUT_CHILD))
    ; Wait until the process has closed using the PID returned by Run.
    ProcessWaitClose($iPID)
    ; Read the Stdout stream of the PID returned by Run. This can also be done in a while loop. Look at the example for StderrRead.
    Local $sOutput = StringReplace(StdoutRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sOutErr = StringReplace(StderrRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sReult = $sOutput <> "" ? $sOutput : $sOutErr
    Return $sReult
EndFunc

 

Link to comment
Share on other sites

  • Moderators

zoel,

Looking through the Help file, what functions do you think might be used to do what you want?

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

zoel,

Quote

do you have any hints?

Open the Help file and actually look at the listed functions to see if any of them might seem likely to be useful.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

12 minutes ago, zoel said:

I don't understand the help file examples.

You should probably reassess programming and if it's something you should be attempting.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

When I was 1, I would cry and get food.
When I was 10, I would say "Mum, I'm hungry" and get food.
When I was 20, I would say "Mum, I'm hungry" and for some reason I would not get food, I don't know why :( 

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

  • Moderators
10 hours ago, zoel said:

I don't have interest to read the help file as I should, thats why I ask so many questions, I'm a little lazy.

 

And it is getting tiring. Continue to be "a little lazy" and you'll find no one willing to help you. If you are unwilling to put forth any effort, you are essentially useless to the community.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

11 hours ago, zoel said:

I don't have interest to read the help file as I should, thats why I ask so many questions, I'm a little lazy.

We have zero interest in reading and even less incentive positively answering your uninterrupted flow of ill-posed, laziness-based questions.  We aren't keen to be treated as your servile minions and you ought to stop fingering yourself.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

On 6/1/2019 at 4:28 PM, Zedna said:

GUICtrlRead() + FileWrite() 

@Melba: Sorry to destroy your "teach fishing" strategy here 🙂

 

As I read in the help file these do different things compared what i want, should I use _WinAPI_GetSaveFileName for better results.

Thank you

Link to comment
Share on other sites

2 hours ago, zoel said:

...compared what i want, should I use....

.. a good question. I'd say, try all of them, use the one you feel is better.
Once you decided, share your code for the next guys and girls that may look for such an answer  :) 

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

  • Moderators

zoel,

Quote

GUICtrlRead() + FileWrite() 

As I read in the help file these do different things compared what i want

Really? You said:

Quote

I want to save the output from an edit form to a text file

and the Help file tells you this :

GUICtrlRead:

Read state or data of a control

FileWrite:

Write text/data to the end of a previously opened file

which to me seems to be exactly what you asked for. So why do you feel those 2 functions are not what you need?

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

I am trying to save the output in a .txt file on the disk but with no luck. one of the things i tried is this code

Case $idSaveitem
            Local $editcontent = guictrlread($idInput)
            FileWrite($idInput, "Line 2")

And her is the full code

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <AutoItConstants.au3>
#include <GuiEdit.au3>
#include <ScrollBarsConstants.au3>
#include <GUIToolTip.au3>
#include <WinAPIDlg.au3>
Local $aWndPos
Local $vDos, $sline = ""
$NetAs = GUICreate("NetAs-Network Assistant", 1096, 521, 182, 135)
Local $idFilemenu = GUICtrlCreateMenu("&File")
Local $idExititem = GUICtrlCreateMenuItem("Exit", $idFilemenu)
Local $idSaveitem = GUICtrlCreateMenuItem("Save", $idFilemenu)
Local $idInput = GUICtrlCreateEdit("", 168, 34, 921, 465)
GUICtrlSetFont(-1, 10, 400, 0, "Courier")
GUICtrlSetBkColor(-1, 0x0000FF)
GUICtrlSetColor($idInput, 0xFFFFFF)
Local $Button1 = GUICtrlCreateButton("IPconfig", 48, 56, 75, 25)
GUICtrlSetTip($Button1, "ipconfig /all")
Local $Button3 = GUICtrlCreateButton("FlushDNS", 48, 96, 75, 25)
Local $Button5 = GUICtrlCreateButton("ConnRelease", 48, 136, 75, 25)
Local $Button7 = GUICtrlCreateButton("DisplayDNS", 48, 176, 75, 25)
Local $Button9 = GUICtrlCreateButton("Route Print", 48, 216, 75, 25)
Local $Button11 = GUICtrlCreateButton("ARP", 48, 256, 75, 25)
Local $Button13 = GUICtrlCreateButton("NSLookup", 48, 296, 75, 25)
Local $Button15 = GUICtrlCreateButton("NetStat -an", 48, 336, 75, 25)
Local $Button17 = GUICtrlCreateButton("GetMac", 48, 376, 75, 25)
Local $Button19 = GUICtrlCreateButton("Ping", 48, 416, 75, 25)
Local $Button23 = GUICtrlCreateButton("Run", 656, 8, 73, 25)
Local $Button24 = GUICtrlCreateButton("Clear", 576, 8, 75, 25)

Local $Input1 = GUICtrlCreateInput("", 736, 8, 345, 21)
GUISetState(@SW_SHOW)
$hENTER = GUICtrlCreateDummy()
Dim $AccelKeys[1][2] = [["{ENTER}", $hENTER]] ; Set accelerators
GUISetAccelerators($AccelKeys)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $idExititem
            Exit
        Case $Button1
            GUICtrlSetData($idInput, _CmdInfo() & @CRLF)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
        Case $idSaveitem
            Local $editcontent = guictrlread($idInput)
            FileWrite($idInput, "Line 2")
        Case $Button3
            GUICtrlSetData($idInput, _CmdInfo2() & @CRLF)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
        Case $Button5
            GUICtrlSetData($idInput, _CmdInfo3() & @CRLF)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
        Case $Button7
            GUICtrlSetData($idInput, _CmdInfo4() & @CRLF)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
        Case $Button9
            GUICtrlSetData($idInput, _CmdInfo5() & @CRLF)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
        Case $Button11
            GUICtrlSetData($idInput, _CmdInfo6() & @CRLF)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
        Case $Button13
            GUICtrlSetData($idInput, _CmdInfo7() & @CRLF)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
        Case $Button15
            GUICtrlSetData($idInput, _CmdInfo8() & @CRLF)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
        Case $Button17
            GUICtrlSetData($idInput, _CmdInfo9() & @CRLF)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
        Case $Button19
            GUICtrlSetData($idInput, _CmdInfo10() & @CRLF)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
            _GUICtrlEdit_Scroll($idInput, $SB_SCROLLCARET)
        Case $Button24
                GUICtrlSetData($idInput, "")
        Case $Button23, $hENTER
                $vDos = Run(@ComSpec & " /c " & GUICtrlRead($Input1), @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
                While 1
                    $sline &= StdoutRead($vDos)
                    If @error Then ExitLoop
                WEnd
                GUICtrlSetData($idInput, $sline & @CRLF)
                GUICtrlSetData($Input1, "")
                ;----> Reset
                $sline = ""
    EndSwitch
WEnd



Func _CmdInfo($_sCmdInfo = "ipconfig /all")
    Local $iPID = Run(@ComSpec & " /c " & $_sCmdInfo, "", @SW_HIDE,  BitOR($STDERR_CHILD, $STDOUT_CHILD))
    ; Wait until the process has closed using the PID returned by Run.
    ProcessWaitClose($iPID)
    ; Read the Stdout stream of the PID returned by Run. This can also be done in a while loop. Look at the example for StderrRead.
    Local $sOutput = StringReplace(StdoutRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sOutErr = StringReplace(StderrRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sReult = $sOutput <> "" ? $sOutput : $sOutErr
    Return $sReult
EndFunc
Func _CmdInfo2($_sCmdInfo2 = "IPConfig /FlushDNS")
    Local $iPID = Run(@ComSpec & " /c " & $_sCmdInfo2, "", @SW_HIDE,  BitOR($STDERR_CHILD, $STDOUT_CHILD))
    ; Wait until the process has closed using the PID returned by Run.
    ProcessWaitClose($iPID)
    ; Read the Stdout stream of the PID returned by Run. This can also be done in a while loop. Look at the example for StderrRead.
    Local $sOutput = StringReplace(StdoutRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sOutErr = StringReplace(StderrRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sReult = $sOutput <> "" ? $sOutput : $sOutErr
    Return $sReult
EndFunc
Func _CmdInfo3($_sCmdInfo3 = "IPConfig /Release")
    Local $iPID = Run(@ComSpec & " /c " & $_sCmdInfo3, "", @SW_HIDE,  BitOR($STDERR_CHILD, $STDOUT_CHILD))
    ; Wait until the process has closed using the PID returned by Run.
    ProcessWaitClose($iPID)
    ; Read the Stdout stream of the PID returned by Run. This can also be done in a while loop. Look at the example for StderrRead.
    Local $sOutput = StringReplace(StdoutRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sOutErr = StringReplace(StderrRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sReult = $sOutput <> "" ? $sOutput : $sOutErr
    Return $sReult
EndFunc
Func _CmdInfo4($_sCmdInfo4 = "ipconfig /displaydns")
    Local $iPID = Run(@ComSpec & " /c " & $_sCmdInfo4, "", @SW_HIDE,  BitOR($STDERR_CHILD, $STDOUT_CHILD))
    ; Wait until the process has closed using the PID returned by Run.
    ProcessWaitClose($iPID)
    ; Read the Stdout stream of the PID returned by Run. This can also be done in a while loop. Look at the example for StderrRead.
    Local $sOutput = StringReplace(StdoutRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sOutErr = StringReplace(StderrRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sReult = $sOutput <> "" ? $sOutput : $sOutErr
    Return $sReult
EndFunc
Func _CmdInfo5($_sCmdInfo5 = "Route Print")
    Local $iPID = Run(@ComSpec & " /c " & $_sCmdInfo5, "", @SW_HIDE,  BitOR($STDERR_CHILD, $STDOUT_CHILD))
    ; Wait until the process has closed using the PID returned by Run.
    ProcessWaitClose($iPID)
    ; Read the Stdout stream of the PID returned by Run. This can also be done in a while loop. Look at the example for StderrRead.
    Local $sOutput = StringReplace(StdoutRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sOutErr = StringReplace(StderrRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sReult = $sOutput <> "" ? $sOutput : $sOutErr
    Return $sReult
EndFunc
Func _CmdInfo6($_sCmdInfo6 = "ARP -a")
    Local $iPID = Run(@ComSpec & " /c " & $_sCmdInfo6, "", @SW_HIDE,  BitOR($STDERR_CHILD, $STDOUT_CHILD))
    ; Wait until the process has closed using the PID returned by Run.
    ProcessWaitClose($iPID)
    ; Read the Stdout stream of the PID returned by Run. This can also be done in a while loop. Look at the example for StderrRead.
    Local $sOutput = StringReplace(StdoutRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sOutErr = StringReplace(StderrRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sReult = $sOutput <> "" ? $sOutput : $sOutErr
    Return $sReult
EndFunc
Func _CmdInfo7($_sCmdInfo7 = "NSLookup")
    Local $iPID = Run(@ComSpec & " /c " & $_sCmdInfo7, "", @SW_HIDE,  BitOR($STDERR_CHILD, $STDOUT_CHILD))
    ; Wait until the process has closed using the PID returned by Run.
    ProcessWaitClose($iPID)
    ; Read the Stdout stream of the PID returned by Run. This can also be done in a while loop. Look at the example for StderrRead.
    Local $sOutput = StringReplace(StdoutRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sOutErr = StringReplace(StderrRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sReult = $sOutput <> "" ? $sOutput : $sOutErr
    Return $sReult
EndFunc
Func _CmdInfo8($_sCmdInfo8 = "netstat -an")
    Local $iPID = Run(@ComSpec & " /c " & $_sCmdInfo8, "", @SW_HIDE,  BitOR($STDERR_CHILD, $STDOUT_CHILD))
    ; Wait until the process has closed using the PID returned by Run.
    ProcessWaitClose($iPID)
    ; Read the Stdout stream of the PID returned by Run. This can also be done in a while loop. Look at the example for StderrRead.
    Local $sOutput = StringReplace(StdoutRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sOutErr = StringReplace(StderrRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sReult = $sOutput <> "" ? $sOutput : $sOutErr
    Return $sReult
EndFunc
Func _CmdInfo9($_sCmdInfo9 = "getmac")
    Local $iPID = Run(@ComSpec & " /c " & $_sCmdInfo9, "", @SW_HIDE,  BitOR($STDERR_CHILD, $STDOUT_CHILD))
    ; Wait until the process has closed using the PID returned by Run.
    ProcessWaitClose($iPID)
    ; Read the Stdout stream of the PID returned by Run. This can also be done in a while loop. Look at the example for StderrRead.
    Local $sOutput = StringReplace(StdoutRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sOutErr = StringReplace(StderrRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sReult = $sOutput <> "" ? $sOutput : $sOutErr
    Return $sReult
EndFunc
Func _CmdInfo10($_sCmdInfo10 = "ping google.com")
    Local $iPID = Run(@ComSpec & " /c " & $_sCmdInfo10, "", @SW_HIDE,  BitOR($STDERR_CHILD, $STDOUT_CHILD))
    ; Wait until the process has closed using the PID returned by Run.
    ProcessWaitClose($iPID)
    ; Read the Stdout stream of the PID returned by Run. This can also be done in a while loop. Look at the example for StderrRead.
    Local $sOutput = StringReplace(StdoutRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sOutErr = StringReplace(StderrRead($iPID), @CRLF & @CRLF, @CRLF)
    Local $sReult = $sOutput <> "" ? $sOutput : $sOutErr
    Return $sReult
EndFunc

 

Link to comment
Share on other sites

close, but it shows lack of basic debugging at all with your filewrite line in that much disrepair.  **I only mention that so you dont feel slighted by others, because next time I call bad guy and the other folk can chime in with solutions.

Case $idSaveitem
            Local $editcontent = guictrlread($idInput)
            FileWrite("Save.txt" , $editcontent)

 

Edited by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

eventually you will start coming with receiptsoutput-to-txt.thumb.png.3176cc013ac03a1ff960ee8ec71a7f65.png

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

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...