Welcome, Guest. Please Login
vTask Homepage
 
 
Home Help Search Login


Pages: 1 2 
Send Topic Print
Enumerate only UNUSED drive letters (Read 2727 times)
Orionizer
Full Member (10+)
*
Offline



Posts: 17
North Carolina, US
Enumerate only UNUSED drive letters
Jan 18th, 2008 at 11:29am
 
Is there any way to retrieve a list of unused drive letters (for use in mapping drives)?
Back to top
 
WWW 82065582  
IP Logged
 
vTask Support
Moderator
*
Offline



Posts: 3596
Tucson, AZ
Re: Enumerate only UNUSED drive letters
Reply #1 - Jan 18th, 2008 at 7:46pm
 

There's no intrinsic method in vTask to do this (it would have use to few people), but there may be other ways to accomplish the same thing.  For example, one way might be to use a Loop from A - Z and use IF File Exists with the drive letter + *.*, such as "IF File Exists H:\*.*", if it fails, it's not a valid drive yet.  Then you will have a list of unmapped drives.

That's one idea, another is perhaps you could call DlgDirList(), and there might be even more ways to get the list of unmapped drives.
Back to top
 

Thank you for using vTask Studio!
WWW  
IP Logged
 
vTask Support
Moderator
*
Offline



Posts: 3596
Tucson, AZ
Re: Enumerate only UNUSED drive letters
Reply #2 - Jan 18th, 2008 at 7:58pm
 

Since I was curious to see if my suggestion was feasible, I put together a script that shows it in action.  On this particular computer, there's only a C: drive and a cd-rom at D: without a cd, and the results are accurate.  This should do just what you want, and you can easily change the formatting, start at a drive past E:, etc.

...


...


VXM Script:   (Copy and Paste into vTask)
<step>
<action>Set Variable</action>
<output value="%unmapped">Variable</output>
</step>
<step>
<action>Start 'For' Loop</action>
<text>26</text>
<value1>1</value1>
<value2>1</value2>
</step>
<step>
<action>Format Number</action>
<text>={loopcount}+64</text>
<value1>%C</value1>
<indents>1</indents>
<output value="%drive">Variable</output>
<comment>'A' + loop</comment>
</step>
<step>
<action>IF File Exists</action>
<text>%drive:\*.*</text>
<options>IF NOT</options>
<indents>1</indents>
</step>
<step>
<action>Set Variable</action>
<text>%unmapped%drive:;</text>
<indents>2</indents>
<output value="%unmapped">Variable</output>
<comment>concatenate</comment>
</step>
<step>
<action>END IF</action>
<indents>1</indents>
</step>
<step>
<action>NEXT LOOP</action>
</step>
<step>
<action>Choose from a List</action>
<text>Unmapped Drives:;%unmapped</text>
<value1>Unmapped Drives</value1>
</step>
Back to top
 

Thank you for using vTask Studio!
WWW  
IP Logged
 
Orionizer
Full Member (10+)
*
Offline



Posts: 17
North Carolina, US
Re: Enumerate only UNUSED drive letters
Reply #3 - Jan 18th, 2008 at 8:42pm
 
Wow!  Thanks alot!!!

I'll be working on this all weekend now I have a place to start!   Smiley
Back to top
 
WWW 82065582  
IP Logged
 
vTask Support
Moderator
*
Offline



Posts: 3596
Tucson, AZ
Re: Enumerate only UNUSED drive letters
Reply #4 - Jan 18th, 2008 at 9:01pm
 

good luck with your scripts  Smiley
Back to top
 

Thank you for using vTask Studio!
WWW  
IP Logged
 
Orionizer
Full Member (10+)
*
Offline



Posts: 17
North Carolina, US
Re: Enumerate only UNUSED drive letters
Reply #5 - Jan 18th, 2008 at 9:05pm
 
Ok, after trying that, I am getting some errors (relating to drive not available - it's throwing an exception).

The exact exception message I'm getting is:

Windows - No Disk

Exception Processing Message 0xc0000013 Parameters 0x75F6023C
0x8490884C 0x75F6023C 0x75F6023C

[Cancel] [Try Again] [Continue]

I tried modifying the code a little as shown here (to skip drives A: - F: ):

VXM Script:   (Copy and Paste into vTask)
<step>
<action>Set Variable</action>
<output value="%unmapped">Variable</output>
</step>
<step>
<action>Start 'For' Loop</action>
<text>20</text>
<value1>1</value1>
<value2>1</value2>
</step>
<step>
<action>Format Number</action>
<text>={loopcount}+70</text>
<comment>'G' + loop</comment>
<value1>%C</value1>
<indents>1</indents>
<output value="%drive">Variable</output>
</step>
<step>
<action>IF File Exists</action>
<text>%drive:\*.*</text>
<options>IF NOT</options>
<indents>1</indents>
</step>
<step>
<action>Set Variable</action>
<text>%unmapped%drive:;</text>
<comment>concatenate</comment>
<indents>2</indents>
<output value="%unmapped">Variable</output>
</step>
<step>
<action>END IF</action>
<indents>1</indents>
</step>
<step>
<action>NEXT LOOP</action>
</step>
<step>
<action>Custom Dialog</action>
<text>Drive Letter;%unmapped|\\server\share|Sample Button: Jumps to Label|Sample List:;Option A;Option B;Option C|&lt;a href="http://www.vtaskstudio.com"&gt;This is a Sample Link&lt;/a&gt;</text>
<value1>Map Drive</value1>
<value2>LIST</value2>
<value3>EDIT</value3>
</step>


But I'm still getting the exception...  Is there an exception wrapper available?  I can't seem to find one.
Back to top
« Last Edit: Jan 18th, 2008 at 10:45pm by vTask Support »  
WWW 82065582  
IP Logged
 
vTask Support
Moderator
*
Offline



Posts: 3596
Tucson, AZ
Re: Enumerate only UNUSED drive letters
Reply #6 - Jan 18th, 2008 at 10:40pm
 

...


Your script works perfectly on my PC.  The exception you're seeing is not coming from vTask (vTask doesn't throw exceptions).

What version of Windows are you using?  Clearly the OS or something doesn't like doing a file exist Z:\*.* if the drive/mapping is non existent, as is obvious from the "Windows - No Disk" error message that is showing.

Assuming that your setup won't allow this approach, another method would be to use the "Get File Info" action with the "Free Drive Space" option (requires vTask version 7.16 or greater).
Back to top
 

Thank you for using vTask Studio!
WWW  
IP Logged
 
vTask Support
Moderator
*
Offline



Posts: 3596
Tucson, AZ
Re: Enumerate only UNUSED drive letters
Reply #7 - Jan 19th, 2008 at 2:50am
 

Thomas
(aka IT troubleshooter extraordinaire) was kind enough to investigate this issue, and discovered that apparently this is a Windows thing (not to pass the buck, but that's how it needs to be fixed).  He was able to duplicate it, and said, "After I returned the virtual drive, with image mounted or unmounted the problem is now gone.  This is "consistent" with the reports of renaming the problem drive to something else, then renaming them back if you want, fixing the problem."

A links he found that directly address this oddity:

http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Windows/XP/Q_2289...
Back to top
 

Thank you for using vTask Studio!
WWW  
IP Logged
 
Orionizer
Full Member (10+)
*
Offline



Posts: 17
North Carolina, US
Re: Enumerate only UNUSED drive letters
Reply #8 - Jan 19th, 2008 at 6:55am
 
The OS I was running that script on was Vista/32.

I just tried it on WinXP and no error.

THOUGH A COUPLE OF THOUGHTS:

My Vista machine has built-in flash card readers - which might be part of the fixed drives I'm scanning - I'm going to modify the code to skip everything on my machine and try again.  If that works, it could be the flash reader driver throwing the exception...

I'll let you know what I find.
Back to top
 
WWW 82065582  
IP Logged
 
Orionizer
Full Member (10+)
*
Offline



Posts: 17
North Carolina, US
Re: Enumerate only UNUSED drive letters
Reply #9 - Jan 19th, 2008 at 6:56am
 
PS - I forgot to thank you for the links!  I'll check those as well!
Back to top
 
WWW 82065582  
IP Logged
 
Orionizer
Full Member (10+)
*
Offline



Posts: 17
North Carolina, US
Re: Enumerate only UNUSED drive letters
Reply #10 - Jan 19th, 2008 at 5:42pm
 
Ok, after excluding the flash drives on the reader, I no longer get the error message!  So I imagine it must be the driver throwing the exception...

Now, to try to figure out a way around it...  I'm going to look at creating an external .DLL to handle the drive validity and try a call to it.

Thanks for your help!!!
Back to top
 
WWW 82065582  
IP Logged
 
vTask Support
Moderator
*
Offline



Posts: 3596
Tucson, AZ
Re: Enumerate only UNUSED drive letters
Reply #11 - Jan 23rd, 2008 at 6:57am
 
The new feature described in this post added to
version 7.16
.
Back to top
 

Thank you for using vTask Studio!
WWW  
IP Logged
 
Orionizer
Full Member (10+)
*
Offline



Posts: 17
North Carolina, US
Re: Enumerate only UNUSED drive letters
Reply #12 - Jan 23rd, 2008 at 7:05am
 
You guys are the GREATEST!!!

I'm glad my search for automation software found (and ended with) VTask!!!   Smiley
Back to top
 
WWW 82065582  
IP Logged
 
vTask Support
Moderator
*
Offline



Posts: 3596
Tucson, AZ
Re: Enumerate only UNUSED drive letters
Reply #13 - Jan 23rd, 2008 at 7:08am
 
Smiley  Thanks for the kind words
Back to top
 

Thank you for using vTask Studio!
WWW  
IP Logged
 
Orionizer
Full Member (10+)
*
Offline



Posts: 17
North Carolina, US
Re: Enumerate only UNUSED drive letters
Reply #14 - Jan 28th, 2008 at 6:48am
 
If anyone is interested, here is what I've figured out to give you ONLY the unused drives on your system (for use in a drive map, etc.):

...


...


VXM Script:   (Copy and Paste into vTask)
<step>
<action>Set Variable</action>
<output value="%unmapped">Variable</output>
</step>
<step>
<action>Start 'For' Loop</action>
<text>26</text>
<value1>1</value1>
<value2>1</value2>
</step>
<step>
<action>Set Variable</action>
<indents>1</indents>
<output value="%drvtype">Variable</output>
</step>
<step>
<action>Set Variable</action>
<text>-1</text>
<indents>1</indents>
<output value="%drvspc">Variable</output>
</step>
<step>
<action>Format Number</action>
<text>={loopcount}+64</text>
<value1>%C</value1>
<indents>1</indents>
<output value="%drive">Variable</output>
<comment>'G' + loop</comment>
</step>
<step>
<action>Get File Info</action>
<options>Drive Total Space</options>
<value1>%drive:</value1>
<indents>1</indents>
<output value="%drvspc">Variable</output>
<onfail>Ignore/Continue</onfail>
</step>
<step>
<action>Get File Info</action>
<options>Drive Type</options>
<value1>%drive:</value1>
<indents>1</indents>
<output value="%drvtype">Variable</output>
<onfail>Ignore/Continue</onfail>
</step>
<step>
<action>IF Expression</action>
<text>%drvspc = -1</text>
<indents>1</indents>
</step>
<step>
<action>IF Expression</action>
<text>%drvtype = Unknown</text>
<indents>2</indents>
</step>
<step>
<action>Set Variable</action>
<text>%unmapped%drive:;</text>
<indents>3</indents>
<output value="%unmapped">Variable</output>
<comment>concatenate</comment>
</step>
<step>
<action>END IF</action>
<indents>2</indents>
</step>
<step>
<action>END IF</action>
<indents>1</indents>
</step>
<step>
<action>NEXT LOOP</action>
</step>
<step>
<action>Custom Dialog</action>
<text>Drive Letter;%unmapped|\\server\share|Sample Button: Jumps to Label|Sample List:;Option A;Option B;Option C|&lt;a href="http://www.vtaskstudio.com"&gt;This is a Sample Link&lt;/a&gt;</text>
<value1>Map Drive</value1>
<value2>LIST</value2>
<value3>EDIT</value3>
<indents>1</indents>
</step>

Back to top
« Last Edit: Jan 28th, 2008 at 8:21am by vTask Support »  
WWW 82065582  
IP Logged
 
Pages: 1 2 
Send Topic Print