I know but pierre said old methods shouldn’t be broken by this, and also this is getting on my nerves. I have to set for every item the label as name to access it. Crap.
Trying to understand: this is a script is using getItemByLabel with newly created shortcuts or folders, s this right ?
If my assumption is correct, then getItemByLabel works with existing item because the update included some migration code that copied the old unique label over label AND name. Newly created items use fully distinct name and label, as a consequence the name is not set by default with the label.
A workaround would be to use the label if name is not set. I think that Lutz Linke suggested this but I forgot to handle this case.
Pierre Hébert Yes, I think this fallback would be added. Name can be used in special cases to differentiate shortcuts, but in many (most?) cases the label should be used as name of not overridden.
< ![CDATA[
getItemByLabel is depricated.. You’ll want to switch to getItemByName
]]>
< ![CDATA[
I know but pierre said old methods shouldn’t be broken by this, and also this is getting on my nerves. I have to set for every item the label as name to access it. Crap.
]]>
< ![CDATA[
make a script 🙂
]]>
< ![CDATA[
Done that oc
]]>
< ![CDATA[
Trying to understand: this is a script is using getItemByLabel with newly created shortcuts or folders, s this right ?
If my assumption is correct, then getItemByLabel works with existing item because the update included some migration code that copied the old unique label over label AND name. Newly created items use fully distinct name and label, as a consequence the name is not set by default with the label.
A workaround would be to use the label if name is not set. I think that Lutz Linke suggested this but I forgot to handle this case.
]]>
< ![CDATA[
Pierre Hébert Yes, I think this fallback would be added. Name can be used in special cases to differentiate shortcuts, but in many (most?) cases the label should be used as name of not overridden.
]]>
< ![CDATA[
Pierre Hébert Just to make sure: getLabel and setLabel for shortcuts will still remain, only getItemByLabel is deprecated, right?
]]>
< ![CDATA[
Yes
]]>