×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Clear File Locations Entered in System Options

Clear File Locations Entered in System Options

Clear File Locations Entered in System Options

(OP)
Does anyone know how to clear out all the file location entries in system options?  I would like to create a macro to enter all the correct file locations on the server whenever there is a new installation of SWorks done.  I can add locations but I can't figure out how to delete the ones already there.

Thanks.

RE: Clear File Locations Entered in System Options

It's really very simple.  The file locations are stored as strings.  Multiple locations are stored separated by a semicolon.  So if your Weldment Profiles location list looks like

M:\SolidStd\profiles
C:\Program Files\SolidWorks\data\weldment profiles

the stored string is M:\SolidStd\profiles;C:\Program Files\SolidWorks\data\weldment profiles.

You can retrieve and set these values very simply.  Here's a macro to read the current weldment profiles list and add an additionallocation:

CODE

Dim swApp As SldWorks.SldWorks
Sub main()
Dim OldLocations As String
Dim NewLocation As String
Set swApp = Application.SldWorks

NewLocation = "C:\MyWeldmentProfiles"

OldLocations = swApp.GetUserPreferenceStringValue(swFileLocationsWeldmentProfiles)
NewLocation = NewLocation & ";" & OldLocations
swApp.SetUserPreferenceStringValue swFileLocationsWeldmentProfiles, NewLocation

Debug.Print swApp.GetUserPreferenceStringValue(swFileLocationsWeldmentProfiles)
End Sub

If all you want to do is replace any that are currently there, just write a new value.  The old value will be overwritten.

RE: Clear File Locations Entered in System Options

Copy Options Wizard?

RE: Clear File Locations Entered in System Options

Otherwise, dig into the registry.  Do be careful.

RE: Clear File Locations Entered in System Options

rjason71,
Set your options in the swOption.sldreg file. Then have everyone use that file. You will not need the macro at all. However it would be nice.

We used to keep and read our common files of a server. We changed our server 4 times now. Our Visual Basic code was running and reading the files off the server. Every time we got a new server I would rewrite the code. Bad idea.

Now I copy the common files off the server to the local machines. Now when the server changes I change one line of code to point to the new server. E.g. \\myserver\SolidWorks\...

If our server goes down we can still work. If some want to work at home on a laptop, they run the program to copy the files to the C:\ drive.

I like handleman way of changing the locations. But I would suggest not pointing to a mapped drive.

Bradley
SolidWorks Premim 2007 x64 SP3.1
PDM Works, Intel(R) Pentium(R) D CPU
3.00 GHz, 4 GB RAM, Virtual memory 12577 MB, nVidia 3400

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources