hayesb0404 Posted August 21, 2014 Author Posted August 21, 2014 Yeah, it makes sense how you explain it. That also exactly what i wanted. What variables do the New Data 1 & 2 get saved to so that I can reference it? Sorry if my questions are rudimentary. I'm trying hard to understand this - Read a text file from the directory - in this case its the script directory Fill labels with text file data Create 2 new inputs Inputs are required to be filled Once saved, the New Data inputs will be saved in $aDataStore - which seems like an array datastore I should be able to reference the datastore for the AD portion. I suppose that I would be referencing the elements of the array then..?
Moderators Melba23 Posted August 21, 2014 Moderators Posted August 21, 2014 hayesb0404,The $aDataStore array holds the ControlIDs of the various data controls (labels set automatically and the new data set by the user) - to get their content you use GUICtrlRead(ControlID) as I did in the loop "; Collect data from inputs". You of course do not need to loop, just reference the specific ControlID when you need the data within it. 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
hayesb0404 Posted August 21, 2014 Author Posted August 21, 2014 Ok, thats what I was looking at. I went through it all again and see where you set up $aDatastore. This looks perfect. I will bring it on my test network and let you know how it pans out. I appreciate the help Melba23!
hayesb0404 Posted August 25, 2014 Author Posted August 25, 2014 The script worked perfectly! The program does include a couple of reboots though. What is the best way to retain the array information after a reboot? I move the file to a working directory, should I set up another GUI after each reboot (not desireable) or could I have the GUI write to my text file as well?
Moderators Melba23 Posted August 25, 2014 Moderators Posted August 25, 2014 hayesb0404,Dog eaten your Help file? You might find the FileWriteFrom/ReadToArray functions useful. 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
Moderators JLogan3o13 Posted August 25, 2014 Moderators Posted August 25, 2014 (edited) We need to add a new smiley Edited August 25, 2014 by JLogan3o13 "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!
hayesb0404 Posted August 27, 2014 Author Posted August 27, 2014 Haha, I guess so. That's why I come here and ask. I do appreciate the help though, so I guess I can take some humility.
hayesb0404 Posted August 27, 2014 Author Posted August 27, 2014 I actually just took another route since the array was just giving back numbers and not the saved data. This worked for me. $sData = "" For $i = 0 To UBound($aDataStore) - 1 $sData &= GUICtrlRead($aDataStore[$i]) & @CRLF Next MsgBox($MB_SYSTEMMODAL, "Data", $sData) FileOpen ($sFile,2) FileWrite ($sFile,$sData)
hayesb0404 Posted August 28, 2014 Author Posted August 28, 2014 This seems pretty straight forward, but I don't know why it wont get the data from the file. Any ideas? $workingdir = "C:\New Users\Working\" ; List all the files and folders in the desktop directory using the default parameters. Global $aFileList = _FileListToArray($workingdir,"*.txt") If @error = 1 Then MsgBox($MB_SYSTEMMODAL, "", "Path was invalid.") Exit EndIf If @error = 4 Then MsgBox($MB_SYSTEMMODAL, "", "No file(s) were found.") Exit EndIf $selected = $aFileList[1] FileOpen($selected) If FileReadLine($selected,1) = "Bob" Then MsgBox (64,"Done!", "You completed a simple task!") EndIf
kylomas Posted August 28, 2014 Posted August 28, 2014 hayesb0404, Specify the fully qualified file name. See comments in code... #include <File.au3> #include <MsgBoxConstants.au3> $workingdir = "C:\New Users\Working\" ; List all the files and folders in the desktop directory using the default parameters. Global $aFileList = _FileListToArray($workingdir,"*.txt") If @error = 1 Then MsgBox($MB_SYSTEMMODAL, "", "Path was invalid.") Exit EndIf If @error = 4 Then MsgBox($MB_SYSTEMMODAL, "", "No file(s) were found.") Exit EndIf $selected = $aFileList[1] FileOpen($workingdir & '\' & $selected) ; add full path If FileReadLine($workingdir & '\' & $selected,1) = "Bob" Then ; add full path MsgBox (64,"Done!", "You completed a simple task!") EndIf Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
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