Jump to content

Using an Array List for radio button options?


Recommended Posts

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

Link to comment
Share on other sites

  • Moderators

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

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

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?

Link to comment
Share on other sites

  • Moderators

hayesb0404,

Dog eaten your Help file? :huh:

You might find the FileWriteFrom/ReadToArray functions 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

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)
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

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