×
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

Set SW system options by external software

Set SW system options by external software

Set SW system options by external software

(OP)
Hi everybody ;

I'm looking for a way to set the system options of Solidworks. I think the best way is to modify the Windows registery.
If this way is the best, I'm not able to know in which path find this or this option, and I would need some help or doc.

In fact, I'm really want to set the SW options massively on the workstations of my company.
And I think to do that with a visual basic script on a windows logon.

I let you tell me your point of view or tips.

Thanks in advance.

SW2007 SP4
Worksatation HP wx4300 2GB
NVidia Quadro FX 3450

RE: Set SW system options by external software

(OP)
I didn't think to ask if a software exists to manage SW installations on network (which could be call "Administrator tool")

I don't want to pass by the default tool which allows you to save or restore settings because I want users keep their personnal environement which have no influence on the SW system.

SW2007 SP4
Worksatation HP wx4300 2GB
NVidia Quadro FX 3450

RE: Set SW system options by external software

All optons can be accessed with VB through the API.  Look at API commands SetUserPreferenceToggle, SetUserPreferenceTextFormat, SetUserPreferenceStringValue, etc.

RE: Set SW system options by external software

(OP)
@TheTick ;

maybe this way will be the easiest. But, It forces me to run SW ???

Also, I'm not sure that all options are available by the API.

A graphical application would be wonderfull... Maybe it can be a suggest to SW.

Am I alone to think about this tool ?

SW2007 SP4
Worksatation HP wx4300 2GB
NVidia Quadro FX 3450

RE: Set SW system options by external software

Can this not be achieved using the Admin Image when installing and updating?

I usually use an exported ".reg" file to set the settings (like File Locations) from one version to another.

HKEY_CURRENT_USER\Software\SolidWorks\SolidWorks 2007\ExtReferences

cheers

RE: Set SW system options by external software

(OP)
Yes, but as you (CorBlimeyLimey) said it, your solution is on the installation or update.

I want to do this sets punctually, when my VAR suggests me somes.

And I think it can be useful to check settings on distant PCs.


But your suggest interess me : If I understand well  it's possible to set some options directly in the Admin Image ?
Maybe, this action is explained in "SolidWorks Installation and Administration Overview", I'll search, Thanks.

SW2007 SP4
Worksatation HP wx4300 2GB
NVidia Quadro FX 3450

RE: Set SW system options by external software

There is also the "Copy Options Wizard".  I think there is also "Administrator Image" which can be managed.

RE: Set SW system options by external software

The last time that I worked with the copy options wizard, it saves out what is essentially a .reg file.  This is a text file and you can (if you are careful) edit it to include only the option(s) that you are interested in.  Then you can set up a system that automatically loads the .reg file when the user logs in.

There exists software for corporate IT departments to use to remotely manage registry settings.  Unless you have a ton of workstations, they would be serious overkill.  However, depending on the size of your organization, something may be in place.

Another approach would be to us a VB script that was run when SW starts up.  You would not have to run it yourself; it would just get run whenever the user started SW next.

Eric

RE: Set SW system options by external software

Below is VBScript code to change SolidWorks user preference settings by API code.  This particular code turns on dimension display.  It will start SolidWorks (in the background - not visible) if it is not already running, set the preference, and then close SW again if it was not already running.  If SW is already running it will just set the preference.  To use it, create a new text file, copy the code into it, save, and rename from .txt to .vbs

It would be a simple matter to create an application (or even a VBA macro) with a GUI to programmatically write the VBScript file.  The VBScript file can then be distributed however you'd like.  The GUI program/macro could even copy all the preferences from the admin's installation, then have check boxes beside each preference to determine whether or not that preference setting gets written out to the script.  However, while it would be simple to do, it would be extremely time consuming due to the sheer number of options there are.  Of course, a VBScript file could also modify the registry directly.  However, I'd personally rather get SW to do it for me.  

CODE

'Declare Variables
Dim SldWorks
Dim SwWasOpen

'Attempt to attach to existing session of SolidWorks (in case it is running)

On Error Resume Next  
'The following line will attach to an existing session.  If
'no session exists, an error occurs.  The "resume next" line
'prevents this error from stopping the code.
Set SldWorks = GetObject(,"SldWorks.Application")

'If no session was found, create one.
If SldWorks Is Nothing Then
    SwWasOpen = False
    'Boolean flag determines whether to shut down SW after pref change
    Set SldWorks = GetObject("","SldWorks.Application")
Else
    SwWasOpen = True
End If

'This line actually sets the preference.  There are several types
'of preferences that can be changed.  This information can be
'found in the SW API help.  You can add as many lines in here
'as you wish for changing preferences.
'******************************
SldWorks.SetUserPreferenceToggle 76, True
'******************************

'Close the SW process if it was not running
'already at the time of the script execution
If SwWasOpen Then
    'do nothing
Else
    SldWorks.ExitApp
end if

Set SldWorks = Nothing

RE: Set SW system options by external software

I would say you could use remote registry (article here) to manage your workstations. Added benefit is you are not depending on either SolidWorks or a local (client pc local that is) script.

Stefan Hamminga
EngIT Solutions
CSWP/Mechanical designer
Searching Eng-Tips forums

RE: Set SW system options by external software

Use the Start\All Programs\SolidWorks 2007 SP?.?\SolidWorks Tools\Copy Settings Wizard to create the options text file. That will list all of the Registry Entries...Remember to backup your Registry before you start messing with it. :)

Ken

RE: Set SW system options by external software

(OP)
Thanks for all your answers.
In fact, in my remark of the 5th june, I didn't want to use the "Copy options Wizard" because it is to general. Some options have to be personnal.

Now, I think that the handleman proposition is the best answer for my request.

Now, I've 2 new questions :

1 - in the line "SldWorks.SetUserPreferenceToggle 76, True", I tried to use the swConst rather than its value. I wasn't able to make it work. So, is it necessary (and also possible) to include the library in a VBScript ?
The code would be more "readable" and clean, and it wouldn't force me to get the swConst value.

2 - I didn't found the swConst to set in the section "External reference" the option "Load referenced documents". This option can take 4 values: "Changed Only", ...
Doesn't anyone knows where I can find it ?

Thanks still  for your replies.

SW2007 SP4
Worksatation HP wx4300 2GB
NVidia Quadro FX 3450

RE: Set SW system options by external software

The swConst value to change the preference you're looking for is swLoadExternalReferences.  It's not a toggle preference, it's an integer preference.  If you want to be able to change all the user preferences you'll need use all of the "SetUserPreference..." functions.  

The names of these constants are contained in the swConst.tlb file, as you know.  According to the internet, you should be able to reference a tlb file in a VBScript that's in a WSF wrapper.  However, I wasn't able to get it to work with swConst.  I was able to get a dump of all of the enum names and values, so formatted them as Const declarations suitable for a VBScript.  However, the file is 4724 lines long, and can't be posted here.  Thanks to WebSense, I can't access any file sharing sites from work.  I'll try to remember to put it up when I get home.  You'll just need to paste it at the top of your VBScript code and you will be able to use the swConst names in the script.

RE: Set SW system options by external software

Quote:

I didn't want to use the "Copy Options Wizard" because it is to general. Some options have to be personnal.

To clearify, I meant use the "Copy Options Wizard" to find out the vaules for the Registry Entries, then in your boot script only add and modify the Registry Entries that you care about. I don't think you have to modify *all* the Registry Entries in the "Copy Options Wizard", and you definitely don't have to run the "Copy Options Wizard" to modify the Registry Entries.

Just a thought.
Ken

RE: Set SW system options by external software

(OP)
KenBole : Ok, but I think it would be to boring to search in this big file and know the corresponding value.

Handleman : I saw your swConst text file just 2 minutes, and I didn't get it at this time. It might be suppressed by administrator. It would be very useful to have it.


SW2007 SP4
Worksatation HP wx4300 2GB
NVidia Quadro FX 3450

RE: Set SW system options by external software

Sorry, Florent.  I requested that it be removed because the post was incredibly long and it still only got about 1/4 of the lines.  As I said in my re-post, it's 4724 lines long.  I had intended to send it to myself at home and post it to a filesharing site, but I forgot to send it.  I'll try to remember to do it today.

RE: Set SW system options by external software

handleman ... you could make an FAQ and place the complete file there.

cheers

RE: Set SW system options by external software

Well, I'm not sure how F that Q is A'd.  I haven't heard of anyone trying to use VBScript to automate SW other than this thread (and one other).  Here is a link to download the complete text file.  Enjoy!

RE: Set SW system options by external software

(OP)
Thanks a lot, Handelman. It'll be helpful.

SW2007 SP4
Worksatation HP wx4300 2GB
NVidia Quadro FX 3450

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