Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Wed Nov 13, 2019 4:48 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: List Physical disk info.
PostPosted: Wed Sep 21, 2011 7:20 pm 
Offline
User avatar

Joined: Mon Aug 29, 2011 5:43 pm
Posts: 62
I have been contracted to write a gui front end to this application http://www.thekillerinstinctproject.com/kiproject/chdman.html It will be very simple. I will have a list box that lists all of the available hard disk images and a text box to enter a file name for a new image.

Image

That is the form I have drawn up.

I have a vbscript that will give the output I need but I need to generate that output and have it displayed in the popupmenu.

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colDiskDrives = objWMIService.ExecQuery _
("Select * from Win32_DiskDrive")

For each objDiskDrive in colDiskDrives

Wscript.Echo objDiskDrive.Name

Next


that is the vbscript

the output I need is this
\\.\PHYSICALDRIVE0
\\.\PHYSICALDRIVE1
...


If I can have that in the popupmenu then I can just pass popupmenu1.text to chdman.exe

Any help is appreciated.

_________________
"I am learning, until my last day."
http://facebook.com/turnerdistributed


Top
 Profile  
Reply with quote  
 Post subject: Re: List Physical disk info.
PostPosted: Wed Sep 21, 2011 9:12 pm 
Offline
User avatar

Joined: Mon Aug 29, 2011 5:43 pm
Posts: 62
OK I have the WMI query that I need to execute. it is
wmic path Win32_DiskDrive get DeviceID

this outputs the following
DeviceID
\\.\PHYSICALDRIVE0
\\.\PHYSICALDRIVE1


I can live with the DeviceID header and I am sure that can be removed in a programmatic fashion. So I guess what would need to bee done is run that command from RB and then parse the output into an array for the popupmenu.

_________________
"I am learning, until my last day."
http://facebook.com/turnerdistributed


Top
 Profile  
Reply with quote  
 Post subject: Re: List Physical disk info.
PostPosted: Wed Sep 21, 2011 9:25 pm 
Offline
User avatar

Joined: Mon Aug 29, 2011 5:43 pm
Posts: 62
dim s As new Shell, Result as String
s.Execute "wmic path Win32_DiskDrive get DeviceID"
Result=s.ReadAll
MsgBox(Result)


that allows me to show the results of the command. ref http://forums.realsoftware.com/viewtopic.php?f=6&t=28944 post 2.

Now is there a way to get that info into an itemized list?

_________________
"I am learning, until my last day."
http://facebook.com/turnerdistributed


Top
 Profile  
Reply with quote  
 Post subject: Re: List Physical disk info.
PostPosted: Wed Sep 21, 2011 11:32 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
Try
dim DriveList() as String
DriveList = Split(Result, EndOfLine)
for i = 1 to Ubound(DriveList)
MsgBox DriveList(i)
next


Top
 Profile  
Reply with quote  
 Post subject: Re: List Physical disk info.
PostPosted: Wed Sep 21, 2011 11:37 pm 
Offline
User avatar

Joined: Mon Aug 29, 2011 5:43 pm
Posts: 62
dim DriveList() as String
dim i As Integer
DriveList = Split(Result, EndOfLine)
for i = 1 to Ubound(DriveList)
MsgBox DriveList(i)
next



thanks again timhare, always to the rescue. now I will try and put that into my list.

Could you explain the Unbound part?

_________________
"I am learning, until my last day."
http://facebook.com/turnerdistributed


Top
 Profile  
Reply with quote  
 Post subject: Re: List Physical disk info.
PostPosted: Wed Sep 21, 2011 11:40 pm 
Offline
User avatar

Joined: Mon Aug 29, 2011 5:43 pm
Posts: 62
dim DriveList() as String
dim i As Integer
DriveList = Split(Result, EndOfLine)
for i = 1 to Ubound(DriveList)
PopupMenu2.AddRow(DriveList(i))
'MsgBox DriveList(i)
next

that adds it to my list.

Is there a way to remove the two empty lines that it for some reason has?

_________________
"I am learning, until my last day."
http://facebook.com/turnerdistributed


Top
 Profile  
Reply with quote  
 Post subject: Re: List Physical disk info.
PostPosted: Thu Sep 22, 2011 12:42 am 
Offline
User avatar

Joined: Mon Aug 29, 2011 5:43 pm
Posts: 62
http://ge.tt/9hw9h18?c

This is my app so far. the buttons do NOT execute anything yet. but I feel that it is a good example of BevelButtons and WMI+RB

_________________
"I am learning, until my last day."
http://facebook.com/turnerdistributed


Top
 Profile  
Reply with quote  
 Post subject: Re: List Physical disk info.
PostPosted: Thu Sep 22, 2011 2:10 am 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
xandout wrote:
Could you explain the Ubound part?

Ubound returns the Upper Bound of the array. Ie., the highest array index. The problem with Split() is that it returns an array, but you don't know how big it is - how many entries it has. Ubound solves that problem.

Quote:
Is there a way to remove the two empty lines that it for some reason has?

dim DriveList() as String
dim i As Integer
DriveList = Split(Result, EndOfLine)
for i = 1 to Ubound(DriveList)
if DriveList(i) <> "" then
PopupMenu2.AddRow(DriveList(i))
end
next


Top
 Profile  
Reply with quote  
 Post subject: Re: List Physical disk info.
PostPosted: Thu Sep 22, 2011 12:21 pm 
Offline
User avatar

Joined: Mon Aug 29, 2011 5:43 pm
Posts: 62
thanks timhare. Do you work for RB?

_________________
"I am learning, until my last day."
http://facebook.com/turnerdistributed


Top
 Profile  
Reply with quote  
 Post subject: Re: List Physical disk info.
PostPosted: Thu Sep 22, 2011 1:22 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
No, I do not work for RB. I develop software using RB for the SMB marketplace and do a little RB consulting.


Top
 Profile  
Reply with quote  
 Post subject: Re: List Physical disk info.
PostPosted: Thu Sep 22, 2011 11:26 pm 
Offline
User avatar

Joined: Mon Aug 29, 2011 5:43 pm
Posts: 62
I would love to see some of your work if possible, not code of course but just see what a good dev can do with this platform.

_________________
"I am learning, until my last day."
http://facebook.com/turnerdistributed


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group