Hello everyone,
I tried to start creating a python script and used the snippets and tutorials. But I am always getting an error with the example of the vcHelpers.VcmFile API. I can’t change the metadata of a local component file. For example if I would like to change the description of a vcmx file.
Can someone help? Thank you very much.
from vcCommand import *
from vcScript import *
from vcHelpers.VcmFile import *
def letsprint(prop):
hProp = getProperty(‘Print’)
print (hProp.Value)
app = getApplication()
cmd = getCommand()
#Getting error on line 13 - ReferenceError: Method called without object.
cd = ComponentData(getComponent().Uri[8:])
cd.Description = ‘A high volume feeder’
print cd
The script is working if i remove the lines 13, 14 & 15
hello = cmd.createProperty(VC_STRING, ‘Print’)
prop = cmd.createProperty(VC_BUTTON,“btnPropName”)
prop.OnChanged = letsprint
def state():
executeInActionPanel()
cmd.addState(state)