home *** CD-ROM | disk | FTP | other *** search
/ BUG 11 / BUGCD1998_02.ISO / aplic / turbocad / tcw.z / colors.bas < prev    next >
BASIC Source File  |  1997-05-05  |  792b  |  37 lines

  1. 'Script that will select by color and then save selection as new file
  2. Global Const NULL = 0
  3.  
  4. Sub Main()
  5. Dim hDrawing As Long
  6. Dim g As Long
  7. Dim Result As Long
  8.  
  9. hDrawing = TCWDrawingActive()
  10.  
  11. if hDrawing = NULL then
  12.    MsgBox "Must have an active drawing"
  13.    Stop
  14. end if
  15.  
  16. g = TCWSelectByQuery("Color = Red")
  17. if g <> NULL then
  18.    Result = TCWDrawingSaveAs("Red.tcw", True)
  19. end if
  20.  
  21. g = TCWSelectByQuery("Color=Blue")
  22. if g <> NULL then
  23.    Result = TCWDrawingSaveAs("Blue.tcw", True)
  24. end if
  25.  
  26. Dim clr as string
  27. 'Dark Green needs to be quoted, so we have to build our
  28. 'query string Color = "Dark Green"
  29. clr = "Color = " & chr(34) & "Dark Green" & chr(34)
  30. g = TCWSelectByQuery(clr)
  31. if g <> NULL then
  32.    Result = TCWDrawingSaveAs("Green.tcw", True)
  33. end if
  34.  
  35. End Sub
  36.  
  37.