Possible to check if an add-in is enabled using API ?
Jun 15, 2006 4 Replies
S
SW Monkey
I have a PDF macro that relys on the "Save As PDF" addin in SW 2005. If the user doesnt have the addin enabled, and runs the macro, it acts like it saves the PDF, but it doesnt generate the PDF.
Is there a way to check if the addin is enabled, so I can give a warning message if it isnt?
Didn't find your answer? Ask the community — no account required.
H
Heikki Leivo
Refer to API help, the SldWorks::GetAddinObject() function. By calling it you can grab any addin object (and call it's methods, btw). If it returns nothing, the specified add-in is not loaded, obviously.
Hope this helps!
-h-
S
SW Monkey
Any idea what thecall for SaveAsPDF addin is? I just want to make sure its loaded, otherwise the user wont know why the macro button didnt save a pdf.
T
TOP
H
Heikki Leivo
Good question indeed - it is not an addin no more in SW2006, so it's hard for me to find it out. I assume, that one way to find it out could be following:
- Open registry editor
- Browse to HKEY_LOCAL_MACHINE\Software\SolidWorks\Add-Ins
- Browse through add-in keys (named{xxxx.xxx..}) and find the one with correct Description value
- Copy the addin key GUID to clipboard (long number in curly brackets)
- Use the find tool in registry editor and try to find that key in HKEY_CLASSES_ROOT folder
You should be able to find a folder with same key name, and under that a folder named ProgID. For example, the GUID for HarnessWorks dll seems to be {5D4259AC-8693-4423-88C4-14618B5E9151}, and the ProgID is HWorks.HarnessWorks.1, therefore the function call for that add-in would be
Dim foo as Object set foo = swApp.GetAddinObject("HWorks.HarnessWorks.1")
Hope this helps, sorry that I could not be more specific regarding PDF add-in!
-h-
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required
Report Content
You are reporting this content to the moderators. They will look at it
ASAP.