Announcement

Collapse
No announcement yet.

Help with making code dynamic needed please!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help with making code dynamic needed please!

    Hi, long time no post!

    so basically I have a listbox that I want to populate with hard drive letters (type 3) and then when i select a listbox entry i want it to display details in labels, such as disk label, total size, partitions etc..

    So far I have it hard coded that the disk to show info on (C but I cannot figure out all the for's, if's & then's.

    Code I have so far (this part is the hard coded drive letter)

    sDriveSize = Drive.GetSize("C:");
    cGBspace=sDriveSize/1024
    csNewFreeSpace = String.Left(cGBspace, 5);
    Label.SetText("LabelDiskSize", csNewFreeSpace.." GB Total Capacity");


    This next bit successfully loads the drive letters into the listbox, but I am stuck with the on click specifics (again for, if & then's!)

    drives = Drive.Enumerate();
    for j,k in pairs (drives) do
    drive_type = Drive.GetType (k)
    if drive_type == 3 then
    result = ListBox.AddItem("ListDrives", k .. "", "");
    end
    end


    If I cannot do it this way through AMS, is there any commands I can type in command prompt and then pipe the results to a file for manipulation?
    Thanks for your time.

    Arty.


  • #2
    Hi arty,
    There are plenty of examples if you do a full search.I don't think you need a great deal of if's & then's
    see attached example and try to study the code.This is for a combobox not listbox but you should be able to modify if required
    drive info.apz
    Cheers

    Comment


    • #3
      Originally posted by colc View Post
      Hi arty,
      There are plenty of examples if you do a full search.I don't think you need a great deal of if's & then's
      see attached example and try to study the code.This is for a combobox not listbox but you should be able to modify if required
      [ATTACH]n299936[/ATTACH]
      Cheers
      Thanks for taking the time to respond & help me :-)
      I can definitely use this code in more than one project, I especially love the progress bars with the text in them, have tried a few different ways to achieve the result, but yours is by far the easiest!

      Part of my problem is I cant always get in the mood for AMS, sometimes I even look at what Ive spent hours working on and cant make sense of it lol

      Thanks again :-)

      Comment

      Working...
      X