Relocate Object From One Page Layout To Another

// Relocates a page layout object from one layout to another.
// If destObjectName is different from sourceObjectName, renames the object during the relocation.
// In this case, it is up to you to make sure that destObjectName is valid and not in conflict.
Function RelocateLayoutObject(sourceLayoutName, sourceObjectName, destLayoutName, destObjectName)
    String sourceLayoutName, sourceObjectName
    String destLayoutName, destObjectName

    String sourceInfo = LayoutInfo(sourceLayoutName, sourceObjectName)
   
    RemoveLayoutObjects /W=$sourceLayoutName $sourceObjectName
   
    if (CmpStr(sourceObjectName,destObjectName) != 0)
        DoWindow /C /W=$sourceObjectName $destObjectName
    endif
   
    Variable fidelity = NumberByKey("FIDELITY", sourceInfo)
    Variable frame = NumberByKey("FRAME", sourceInfo)
    Variable trans = NumberByKey("TRANS", sourceInfo)
    Variable left = NumberByKey("LEFT", sourceInfo)
    Variable top = NumberByKey("TOP", sourceInfo)
    Variable width = NumberByKey("WIDTH", sourceInfo)
    Variable height = NumberByKey("HEIGHT", sourceInfo)
    Variable right = left + width
    Variable bottom = top + height
    String objectType = StringByKey("TYPE", sourceInfo)
   
    AppendLayoutObject /W=$destLayoutName /D=(fidelity) /F=(frame) /R=(left,top,right,bottom) /T=(trans) $objectType $destObjectName
End


Forum

Support

Gallery

Igor Pro 8

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More