Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

x mapping it's own network drive


Chris Rizzo
 Share

Recommended Posts

Here's a good one for you Bullines:

 

When selecting a file to open from X and browsing to my network drive (z:), mastercam will create a newly mapped drive of a differnt letter EVERYTIME I browse to the network. See picture.

There should only be z$ on 'kahn' (z:)

 

Computer is xp pro and a member of a domain. Server is running 2000 server.

 

 

mappeddrive.jpg

Link to comment
Share on other sites

That is strange. But I'm sure I've read something similar before, since I do recall writing a VBScript a while back to unmap the drives for a forum member using V9. I can't find the forum thread but I do still have the script that I wrote back in March on my notebook:

 

code:

'////////////////////////////////////////////////////////////////////////////////

'//

'// Author: Chris Bellini [email protected]

'// Date: 03/03/2005 1:18 PM

'// File Name: FixWeirdMcamMapping.vbs

'//

'// Description: Unmaps additional drives that Mastercam maps (for whatever

'// reason) based on a list of allowable drives

'//

'// Comments: Modify the DEF_ALLOWED_DRIVES constant with mapped drive

'// letters that are expected.

'//

'////////////////////////////////////////////////////////////////////////////////

 

Const DEF_ALLOWED_DRIVES = "Y:,Z:" ' follow this format

 

' call the main subroutine

Call Main()

 

 

' Purpose: The main subroutine

Sub Main()

Dim objNetwork ' WSH Network object

Dim objDrives ' Drives object

Dim strCurrMapDrive ' drive letter of a mapped drive

Dim arrAllowedDrives ' array containing allowable mapped drive letters

Dim iEnumIdx ' outter FOR LOOP index

Dim iAllowedIdx ' innner FOR LOOP counter

Dim bAllowedDrive ' allowed drive flag

 

 

' Create a WSH Network object

Set objNetwork = CreateObject("WScript.Network")

 

' Enumerate the mapped drives

Set objDrives = objNetwork.EnumNetworkDrives

 

' Prepare our array of allowable drives

arrAllowedDrives = Split(DEF_ALLOWED_DRIVES, ",")

 

' Check each enumerated network drive to see if it's a good one

' or one that Mastercam mysteriously created. If Mastercam mapped it,

' unmap the drive. We must increment the outter loop by 2 because the

' Item method returns a drive letter, then the network path and so on...

For iEnumIdx = 0 to objDrives.Count - 1 Step 2

' Init allowed drive flag

bAllowedDrive = False

 

' Retrieve the drive letter of the mapped drive

strCurrMapDrive = objDrives.Item(iEnumIdx)

 

' Test to see if the map drives is an allowed one

For iAllowedIdx = 0 To UBound(arrAllowedDrives)

If (strCurrMapDrive = arrAllowedDrives(iAllowedIdxy)) Then

bAllowedDrive = True

Exit For

End If

Next

 

' If the mapped drive isn't allowed, unmap it

If (bAllowedDrive = False) And (strCurrMapDrive <> vbNullString) Then

objNetwork.RemoveNetworkDrive (strCurrMapDrive)

End If

Next

 

' cleanup

Set objNetwork = Nothing

Set objDrives = Nothing

 

' all done

ShowString "Extraneous network drives created by Mastercam have been unmapped."

End Sub

This script will unmap all network drives that you don't want. You inform it which drives you want to be mapped. So for example, if your Y and Z drives are network drives that should be mapped, modify this line like this:

 

code:

Const DEF_ALLOWED_DRIVES = "Y:,Z:"   ' follow this format

Save it and run the script. It should unmap all network drives that aren't Y or Z.

 

As to why this even happens in the first place, I'm not sure. Are those Mastercam-created network drives browsable? If so, what are their contents?

 

HTH

Link to comment
Share on other sites
  • 7 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...