Jump to content

chkdsk gui in WinPE array error


Recommended Posts

I have a project I'm working on, as part of a maintenance disk. I want to make a GUI for automating chkdsk startup, as in I run the GUI, then I select what drives I'm wanting to chkdsk. I want to run this from a PE based enviroment, I believe the disk I've chosen is a BartPE based disk, if that matters.

Here's where my issue comes into play. When I start the program I have it set to specify a log save location with a Save As box. That part works great, so I have it make the GUI. Here's the issue: When I'm making the GUI, I want it to grab the drive letters and use that as part of either Checkboxes OR multiple dropdown menus. That part I'm flexible on, I just want it to work, and the dropdown menus was just another way of thinking about it.

So I figured out how to grab drive letters into an array and do an If-Then for less than 4 drives (test machine has 3 drives, trying to get it work before worrying about whether or not it's less than 2 or 3):

Global $Drives[5] = ["1","2","3","4","5"]
$Drives = DriveGetDrive("Fixed")
If $Drives[0] < 4 Then
    $Drives[4] = "None"
EndIf

For some reason, when I run that code, it flips it's lid about being outside my subscript range. I added the ReDim command to resize it back to 5, but that still doesn't work. Now if I set it when I initialize it, it's fine, and I can edit it all I want to manually, just not with DriveGetDrive.

Current modified code:

Global $Drives[5] = ["1","2","3","4","5"]
$Drives = DriveGetDrive("Fixed")
If $Drives[0] < 4 Then
  ReDim $Drives[5]
    $Drives[4] = "None"
EndIf

What I would like to do is resize the Array to fix the amount of drives I have, i.e. if I have 2 drives, make it 3 slots big, [0] for the count it generates, [1] for drive 1, [2] for drive 2, etc. and if it doesn't get a reply from slots 3 and 4, disable those checkboxes/remove the entry from the dropdown list. But that is further complicating the issue as it is, just want the basic premise to work.

If anyone has any ideas for this little issue, I'm welcoming the ideas.

Edited by hackersarchangel
Link to comment
Share on other sites

  • Moderators

hackersarchangel,

No need to ReDim the array - the function returns a suitably sized array for you automatically, so there is no need to check its size: :oops:

Global $Drives = DriveGetDrive("Fixed")

Once you have the array, you can run a loop For $i = 1 To $Drives[0] to create your checkboxes/combo list. :bye:

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

hackersarchangel,

Using the count element means that you remain within the bounds automatically so you should not have that problem. :oops:

But you know where we are if you find something else not working. :bye:

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

That I do :oops: You guys have always been helpful :bye:

Ok I'll try this when I have a minute today, have some other things going on.

Request thread be closed, going to start a thread about the project in general asking if anyone wants to contribute to the project in an Open Source form.

Edited by hackersarchangel
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

×
×
  • Create New...