Possible to check if an add-in is enabled using API ?

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?

Reply to
SW Monkey
Loading thread data ...

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-

Reply to
Heikki Leivo

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.

Reply to
SW Monkey

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-

Reply to
Heikki Leivo

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.