drive properties

By PuNkTuReD on Sep 10, 2008

simply add to your remotes
then open via menus

once your info is showing you can send a line to your
clipboard by double clicking it.

updated
lmao now called Zmodems drive properties
nice one man :)

menu * {
  Drive Properties:dialog $iif($dialog(drive.properties),-v,-dm) drive.properties drive.properties
}
alias -l load.drives {
  var %i = $disk(0)
  while (%i) {
    did -a drive.properties 3 $disk(%i).path
    dec %i
  }
}
dialog drive.properties {
  title "Drive Properties"
  size -1 -1 71 90
  option dbu
  box "", 1, 2 2 67 86 
  text "Drive Properties:",2, 6 7 50 8
  combo 3, 4 16 30 26, autohs drop sort
  button "Get Info", 4, 36 16 30 10
  list 5, 4 27 63 59, size
}
on *:dialog:drive.properties:*:*: {
  var %d = $dname, %e = $devent, %i = $did
  if (%e == init) { did -b %d 4 | load.drives }
  if (%e == sclick) {
    if (%i == 3) { did - $+ $iif($disk($did(3)).type,e,b) %d 4 }
    if ((%i == 4) && ($disk($did(3)).type)) {
      var %a = did -a drive.properties 5, %drive = $did(drive.properties,3)
      did -r drive.properties 5
      %a Listing %drive Properties
      %a ------------------------
      %a Path: $disk(%drive).path
      %a Type: $disk(%drive).type
      %a Label: $disk(%drive).label
      %a Size: $bytes($disk(%drive).size,g) Gbs
      %a Free: $bytes($disk(%drive).free,g) Gbs
    }
  }
  if ((%e == dclick) && (%i == 5)) { clipboard $did(5,$did(5).sel) }
}

Comments

Sign in to comment.
Zmodem   -  Sep 12, 2008

Thanks!

 Respond  
PuNkTuReD   -  Sep 12, 2008

lol cool man niice job.

i especially like the
while (%i)
dec %i

 Respond  
Zmodem   -  Sep 12, 2008

Okay, I still felt like contributing, so I made a few adds/changes:

[b]Added a combo box that lists all of the disk drives when the dialog opens. This will make it easier to get info on any available disk drive.

Dialog will now display info for CDROM drives as well, including other types of drives that return a $false for the $disk() value.[/b]

Here is an update of the code:

menu * {
  Drive Properties:dialog $iif($dialog(drive.properties),-v,-dm) drive.properties drive.properties
}
alias -l load.drives {
  var %i = $disk(0)
  while (%i) {
    did -a drive.properties 3 $disk(%i).path
    dec %i
  }
}
dialog drive.properties {
  title "Drive Properties"
  size -1 -1 71 90
  option dbu
  box "", 1, 2 2 67 86 
  text "Drive Properties:",2, 6 7 50 8
  combo 3, 4 16 30 26, autohs drop sort
  button "Get Info", 4, 36 16 30 10
  list 5, 4 27 63 59, size
}
on *:dialog:drive.properties:*:*: {
  var %d = $dname, %e = $devent, %i = $did
  if (%e == init) { did -b %d 4 | load.drives }
  if (%e == sclick) {
    if (%i == 3) { did - $+ $iif($disk($did(3)).type,e,b) %d 4 }
    if ((%i == 4) && ($disk($did(3)).type)) {
      var %a = did -a drive.properties 5, %drive = $did(drive.properties,3)
      did -r drive.properties 5
      %a Listing %drive Properties
      %a ------------------------
      %a Path: $disk(%drive).path
      %a Type: $disk(%drive).type
      %a Label: $disk(%drive).label
      %a Size: $bytes($disk(%drive).size,g) Gbs
      %a Free: $bytes($disk(%drive).free,g) Gbs
    }
  }
  if ((%e == dclick) && (%i == 5)) { clipboard $did(5,$did(5).sel) }
}
 Respond  
water_dragon   -  Sep 12, 2008

no worries and i do like that better now.

 Respond  
PuNkTuReD   -  Sep 11, 2008

we did add that with Zmodems code just double click the line you wish to copy
ill add that into the description.
cheers water_dragon

 Respond  
water_dragon   -  Sep 11, 2008

nice. one suggestion. when your drive info comes up. your should make it so you can copy a line off it.

 Respond  
water_dragon   -  Sep 11, 2008

nice one suggestion. when your drive info comes up your should make it so you can copy a line off it.

 Respond  
Zmodem   -  Sep 10, 2008

LoL, I aim to please. Glad you liked it.

 Respond  
PuNkTuReD   -  Sep 10, 2008

wow thats reall neat
ive updated the code with Zmodems code
and i think ill have to look into this for all my other dialogs now lol.
cheers Zmodem.

 Respond  
Zmodem   -  Sep 10, 2008

You've still got the drive being set globally, basically due to not inferring the var function before it. All you really need to do is move the variable up after the first declared local variable, adding a comma of course.

Suggestion: How about double-clicking a line in the listbox sends the line to your clipboard?

You can also save line and spaces, and also clean up the code, by grouping the dialog events into one event. Here's the new event, all you would need is to replace the other on dialog events with just this one (with the clipboard thing added):

on *:dialog:drive.properties:*:*: {
  var %d = $dname, %e = $devent, %i = $did
  if (%e == init) { did -b %d 4 }
  if ((%e == edit) && (%i == 3)) { did - $+ $iif($disk($did(3)),e,b) %d 4 }
  if ((%e == sclick) && (%i == 4) && ($disk($did(3)))) {
    var %a = did -a drive.properties 5, %drive = $did(drive.properties,3)
    did -r drive.properties 5
    %a Listing %drive Properties
    %a ------------------------
    %a Path: $disk(%drive).path
    %a Type: $disk(%drive).type
    %a Label: $disk(%drive).label
    %a Size: $bytes($disk(%drive).size,g) Gbs
    %a Free: $bytes($disk(%drive).free,g) Gbs
  }
  if ((%e == dclick) && (%i == 5)) { clipboard $did(5,$did(5).sel) }
}
 Respond  
PuNkTuReD   -  Sep 10, 2008

cheers Cheiron

 Respond  
Cheiron   -  Sep 10, 2008

another very nice snippet from yourself there PunkTuReD. at least i canget a return from yours without it crashing my mirc not unlike my internal one on the kickchat engine heh.. Gets a full 7 from me .. rated :)

 Respond  
PuNkTuReD   -  Sep 10, 2008

thnx napa182
uupdated

 Respond  
napa182   -  Sep 10, 2008

nice lil dialog.
on this line

set %drive $did(drive.properties,3)

no real need to make it a global var when a local will do the job.

also you may just as well change this line

dialog -dm drive.properties drive.properties

to

dialog $iif($dialog(drive.properties),-v,-dm) drive.properties drive.properties

just incase you have morons trying to opening it while it's already open so they dont get an error ;x

 Respond  
PuNkTuReD   -  Sep 10, 2008

lol niice man i didnt even think about using the global like that
updated again.

 Respond  
Zmodem   -  Sep 10, 2008

Hey, thanks and I'm glad you enjoyed that! :-D You can also cut corners in the code in a bunch of spots. I will suggest more in the morning, but basically, in your sclick event, you've got a ton of room for space-saving. Your recursive usage of the $($+(... is completely unnecessary. In other words, you can replace your sclick dialog event with this:

on *:dialog:drive.properties:sclick:*: {
  var %a = did -a drive.properties 5
  if (($did = 4) && ($disk($did(drive.properties,3)))) {
    did -r drive.properties 5
    set %drive $did(drive.properties,3)
    %a Listing %drive Properties
    %a ------------------------
    %a Path: $disk(%drive).path
    %a Type: $disk(%drive).type
    %a Label: $disk(%drive).label
    %a Size: $bytes($disk(%drive).size,g) Gbs
    %a Free: $bytes($disk(%drive).free,g) Gbs
  }
}
 Respond  
PuNkTuReD   -  Sep 10, 2008

nice suggestions Zmodem
updated.

cheers nice suggestion.

 Respond  
Zmodem   -  Sep 10, 2008

And, oh my god, guess what? I have a few suggestions! :-D

First off, you are going to want to make sure that the drive they enter is valid! There is a bunch of stuff that will pertain to this, but your main area of concern should be the dialog event. After your main dialog code, replace everything else with this:

on *:dialog:drive.properties:init:*: {
  did -b $dname 4
}
on *:dialog:drive.properties:edit:3: {
  did - $+ $iif($disk($did(3)),e,b) $dname 4
}
on *:dialog:drive.properties:sclick:*: {
  if (($did = 4) && ($disk($did(drive.properties,3)))) {
    did -r drive.properties 5
    set %drive $did(drive.properties,3)
    did -a drive.properties 5 Listing %drive Properties 
    did -a drive.properties 5 ------------------------
    did -a drive.properties 5 Path: $disk($($+(%,drive),2)|0).path
    did -a drive.properties 5 Type: $disk($($+(%,drive),2)|0).type
    did -a drive.properties 5 Label: $disk($($+(%,drive),2)|0).label
    did -a drive.properties 5 Size: $bytes($disk($($+(%,drive),2)|0).size,g) Gbs
    did -a drive.properties 5 Free: $bytes($disk($($+(%,drive),2)|0).free,g) Gbs
  }
}

The info button will be disabled until a valid drive is entered. I hope you can understand this. If not, let me know, I would be more than happy to outline the details. Good luck! :-D

 Respond  
EL   -  Sep 10, 2008

Same with this one its neat not real useful but works.Well donw."Rate it or Hate it?"...5/10.`-.-´

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.