home *** CD-ROM | disk | FTP | other *** search
- /*
- objprop.cwx
-
- This script displays the properties of the currently selected object.
-
- Copyright 1997 by TrueSpectra Inc.
-
- This code is provided purely for demonstration purposes and is not
- supported or under warranty. Feel free to modify and examine this
- example script for your own purposes.
-
- */
-
-
- /* Get the currently selected object. */
-
- handle = CwGetSelectedObject();
-
- if \CwIsHandleValid(handle) then do
- say "No object selected."
- exit
- end
-
-
- /* Currently, there's no way to do multiline output, so I'm going to try something
- cute here. */
- cr = x2c('0A');
-
- /* Get info about the object. */
- name = 'Name:' CwGetName(handle);
-
- call CwGetPosition handle, pos;
- position = 'Position:' pos.x||', '||pos.y||cr||'Dim:' pos.width||'X'||pos.height ,
- cr||'Rotation:' pos.rotation||cr||'Shear:' pos.xshear;
-
- property = getProps(handle)
-
- if CwGetHandleType(handle) \= "Group" then do
- toolprop = getProps(CwGetTool(handle))
- regprop = getProps(CwGetRegion(handle))
- end
-
- /* Display results. */
- say name||cr||position||cr||'Properties: '||cr||property
-
- if CwGetHandleType(handle) \= "Group" then do
- say 'Tool properties:'||cr||toolprop
- say 'Region properties:'||cr||regprop
- end
- exit
-
-
-
-
- getprops:procedure expose cr
- arg handle
-
- p = CwGetFirstProperty(handle)
- property=''
- do while p \= ''
- property = property||" '" || p || "' = '"||CwGetProperty(handle,p)||"'" ,
- '('|| CwGetPropertyType(handle,p) || ')' || cr;
- p = CwGetNextProperty()
- end
-
- return property
-
-