home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Misc / HYPERBOOK2.DMS / in.adf / Macros / sample / CloneItem < prev    next >
Encoding:
Text File  |  1990-09-02  |  864 b   |  41 lines

  1. /* CloneItem - clones the Initiator() item from 'clone list 1' to
  2.    'clone list 2' or vice versa. This is used in the ARexx commands
  3.    hyperbook as part of the demonstration of the clone() function.
  4. */
  5.  
  6. call searchstart(':')
  7. list1 = searchname('clone list 1')
  8.  
  9. call searchstart(':')
  10. list2 = searchname('clone list 2')
  11.  
  12. init = initiator()
  13.  
  14. launch_ok = 1
  15.  
  16. if length(init) == 0 then do
  17.    launch_ok = 0
  18.    say failed 1
  19.    end
  20. else do
  21.    if gettype(init) ~= 'Item' then do
  22.       launch_ok = 0
  23.       say failed 2
  24.       end
  25.    end
  26.  
  27. if launch_ok == 0 then do
  28.    say 'This macro must be launched from a list item.'
  29.    say 'The initiator was:' init
  30.    EXIT
  31.    end
  32.  
  33. plist = parent(init)
  34.  
  35. if plist == list1 then call clone(init, list2)
  36. else do
  37.  
  38.    if plist == list2 then call clone(init, list1)
  39.    else say 'Use this macro with the two lists on the ''clone'' page.'
  40.    end
  41.