zoel Posted May 31, 2019 Share Posted May 31, 2019 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 expandcollapse popup#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 More sharing options...
Moderators Melba23 Posted May 31, 2019 Moderators Share Posted May 31, 2019 zoel, Looking through the Help file, what functions do you think might be used to do what you want? M23  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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
zoel Posted May 31, 2019 Author Share Posted May 31, 2019 @Melba23 I am afraid I dont know, do you have any hints? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 31, 2019 Moderators Share Posted May 31, 2019 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 zoel 1  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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
Zedna Posted June 1, 2019 Share Posted June 1, 2019 (edited) GUICtrlRead() + FileWrite() @Melba: Sorry to destroy your "teach fishing" strategy here :-) Â Edited June 1, 2019 by Zedna zoel 1 Resources UDF Â ResourcesEx UDF Â AutoIt Forum Search Link to comment Share on other sites More sharing options...
zoel Posted June 1, 2019 Author Share Posted June 1, 2019 Thank you @zedna I thought _WinAPI_GetSaveFileName would help. Can you give me an example, I don't understand the help file examples. Thank you  Link to comment Share on other sites More sharing options...
BrewManNH Posted June 1, 2019 Share Posted June 1, 2019 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. zoel 1 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 GudeHow 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 More sharing options...
zoel Posted June 1, 2019 Author Share Posted June 1, 2019 @BrewManNH I think the same, 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. Â Exit and mikell 1 1 Link to comment Share on other sites More sharing options...
argumentum Posted June 1, 2019 Share Posted June 1, 2019 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  FrancescoDiMuro 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted June 2, 2019 Moderators Share Posted June 2, 2019 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. Earthshine and FrancescoDiMuro 1 1 "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 More sharing options...
jchd Posted June 2, 2019 Share Posted June 2, 2019 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. Earthshine and FrancescoDiMuro 1 1 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 hereRegExp tutorial: enough to get startedPCRE 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 More sharing options...
zoel Posted June 2, 2019 Author Share Posted June 2, 2019 @JLogan3o13 @jchd I get it guys, is not nice to be lazy, I will put more effort, thanks for your inputs. argumentum 1 Link to comment Share on other sites More sharing options...
zoel Posted June 2, 2019 Author Share Posted June 2, 2019 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 More sharing options...
argumentum Posted June 2, 2019 Share Posted June 2, 2019 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  zoel 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 3, 2019 Moderators Share Posted June 3, 2019 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 zoel 1  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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
zoel Posted June 3, 2019 Author Share Posted June 3, 2019 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 expandcollapse popup#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 More sharing options...
iamtheky Posted June 3, 2019 Share Posted June 3, 2019 (edited) 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 June 3, 2019 by iamtheky zoel 1 ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
zoel Posted June 3, 2019 Author Share Posted June 3, 2019 7 minutes ago, iamtheky said: close, but it shows lack of basic debugging at all with your filewrite line in that much disrepair. Case $idSaveitem Local $editcontent = guictrlread($idInput) FileWrite("Save.txt" , $editcontent)  Thanks but it doesn't work Link to comment Share on other sites More sharing options...
iamtheky Posted June 3, 2019 Share Posted June 3, 2019 eventually you will start coming with receipts zoel 1 ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
zoel Posted June 3, 2019 Author Share Posted June 3, 2019 I don't understand @iamtheky english is not my first language, as I see from the photos you've been able to do it? I cant do it! Link to comment Share on other sites More sharing options...
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