home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1998 November / PCO_1198.ISO / filesbbs / os2 / tspg202s.arj / TSPG202S.ZIP / Scripts / CHANGCAP.CWX < prev    next >
Encoding:
Text File  |  1997-05-04  |  1.5 KB  |  61 lines

  1. /*
  2.   
  3.   changcap.cwx
  4.   
  5.   This script should interate through a project and change captions
  6.   found that are one string to another string.
  7.  
  8.   You must edit the script to change the "From" and "TO" variables to
  9.   use.
  10.  
  11.  Copyright 1997 by TrueSpectra Inc.                                  
  12.                                                                      
  13.  This code is provided purely for demonstration purposes and is not  
  14.  supported or under warranty.  Feel free to modify and examine this  
  15.  example script for your own purposes.                               
  16.  
  17.   */
  18.  
  19. /* Load utility functions. */
  20. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  21. call SysLoadFuncs
  22.  
  23. /* FROM to TO change these to whatever values you want */
  24. FROM = "WORD"
  25. TO = "TWO WORDS"
  26.  
  27. /* Make sure the user wants to do this. */
  28. if RxMessageBox("Do you wish to change all the text" FROM " to " TO,"Settings","yesno") \= 6 then exit;
  29.  
  30. call text CwGetCurrentView(), FROM, TO
  31. exit
  32.  
  33. text:procedure
  34. parse arg root, FROM, TO
  35.  
  36. object = CwFindFirstObject(root)
  37.  
  38. do while CwIsHandleValid(object)
  39.  
  40.     ht = CwGetHandleType(object)
  41.     if \(ht = "Group") then 
  42.     do
  43.         region = CwGetRegion(object)
  44.         
  45.         if CwHasProperty(region, "Caption") then 
  46.         do
  47.             caption = CwGetProperty( region, "Caption")
  48.             say caption"."
  49.             say FROM"."
  50.             if caption = FROM then 
  51.             do
  52.                 say caption
  53.                 call CwSetProperty region, "Caption", TO
  54.             end
  55.         end
  56.     end
  57.     object = CwFindNextObject(object)
  58. end 
  59. return
  60.  
  61.