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.
Thanks.






RE: Clear File Locations Entered in System Options
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
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
RE: Clear File Locations Entered in System Options
RE: Clear File Locations Entered in System Options
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