Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro to load license

Status
Not open for further replies.

biricio

Mechanical
Nov 6, 2009
54
0
0
IT
Hi,
I often charge a license in 'shareable products' such as the SPA license.
How do I create a button to activate / deactivate a license?

thanks
 
Replies continue below

Recommended for you

Hi,

Code:
Language="VBSCRIPT"

Sub CATMain()

Dim settingControllers1 As SettingControllers
Set settingControllers1 = CATIA.SettingControllers

Dim memoryWarningSettingAtt1 As SettingController
Set memoryWarningSettingAtt1 = settingControllers1.Item("CATSysMemoryWarningSettingCtrl")

Dim licenseSettingAtt1 As SettingController
Set licenseSettingAtt1 = settingControllers1.Item("CATSysLicenseSettingCtrl")

  Dim Message, Style, Title, Response, SecString
    Message = ("To get the SPA license click YES, to release it click NO" ) 
    Style = vbYesNo + vbDefaultButton1    'Define default button
    Title = "Purpose : change status of a specific license "   
    Response = MsgBox(Message, Style, Title)
If Response = vbYes Then    ' User chose Yes.
        
Dim generalSessionSettingAtt1 As SettingController        
Dim disconnectionSettingAtt1 As SettingController

''''''''''''''''''YES
licenseSettingAtt1.SetLicense "SPA.prd", "SPA.prd"
Set generalSessionSettingAtt1 = settingControllers1.Item("CATCafGeneralSessionSettingCtrl")

generalSessionSettingAtt1.SaveRepository 
Set disconnectionSettingAtt1 = settingControllers1.Item("CATSysDisconnectionSettingCtrl")

disconnectionSettingAtt1.SaveRepository 
memoryWarningSettingAtt1.SaveRepository 
licenseSettingAtt1.SaveRepository 

Else
''''''''''''''''''''''''NO
licenseSettingAtt1.SetLicense "SPA.prd", "NotRequested"
Set generalSessionSettingAtt1 = settingControllers1.Item("CATCafGeneralSessionSettingCtrl")

generalSessionSettingAtt1.SaveRepository 
Set disconnectionSettingAtt1 = settingControllers1.Item("CATSysDisconnectionSettingCtrl")

disconnectionSettingAtt1.SaveRepository 
memoryWarningSettingAtt1.SaveRepository 
licenseSettingAtt1.SaveRepository 

End If

End Sub

Regards
Fernando

 
Do you have to fix the code if the license is on another server? I tried to run this macro at my job and indicated an error on this line:

licenseSettingAtt1.SetLicense "SPA.prd", "SPA.prd"

that license is available (manually).
 
Biricio,
Any luck on getting this to work?
I have been unsuccessful trying to get the same thing to work for our Sharable Products.

Thanks
 
No, unfortunately Ferdo has not responded.
I would like to have a button to activate / deactivate a Sharable Products.

Ferdo where are you? We are waiting you.
 
CATIA doc referes to CATSysLicenseSettingCtrl for Licensing and CATSysDynLicenseSettingCtrlfor shareable product

I let you pout A and B togeteher

Eric N.
indocti discant et ament meminisse periti
 
Garzar,
I believe that I am looking for the same macro as biricio.
Catia would be open.
Run a macro to select/deselect a sharable license such as step(ST1) or space analysis(SPA).

Thanks,
Rick
 
Status
Not open for further replies.
Back
Top