home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2002 March
/
PCWMAR02.iso
/
software
/
turbocad
/
V4
/
tcw.z
/
colors.bas
< prev
next >
Wrap
BASIC Source File
|
1997-10-28
|
1KB
|
65 lines
'Script that will select by color and then save selection as new file.
Sub Main()
Dim hDrawing As Long
Dim g As Long
Dim Result As Long
Dim q As Long
Dim dName As String
Dim dName1 As String
Dim pos As Integer
Dim L As Integer
hDrawing = TCWDrawingActive()
if hDrawing = 0 then
MsgBox "Must have an active drawing"
Stop
end if
q=0
TCWDrawingName dName1
L=len(dName1)
pos=InStr(1,dName1,".")
if (pos<>L-3) Then
dName=dName1 +".tcw"
else
dName=dName1
end if
g = TCWSelectByQuery("PenColor = Red")
if g <> 0 then
q=1
Result = TCWDrawingSaveAs("Red.tcw", True)
end if
g = TCWSelectByQuery("PenColor=Blue")
if g <> 0 then
Result = TCWDrawingSaveAs("Blue.tcw", True)
q=1
end if
Dim clr as string
Dim Dg
'Dark Green needs to be quoted, so we have to build our
'query string Color = "Dark Green"
clr = "PenColor = " & chr(34) & "Dark Green" & chr(34)
g = TCWSelectByQuery(clr)
if g <> 0 then
Result = TCWDrawingSaveAs("Green.tcw", True)
q=1
end if
S$="TurboCAD"
if q=0 Then
result = MsgBox ("Need to have at least one graphic Red, Blue or Dark Green",0,S$)
' MsgBox "No grafics found"
Stop
end if
result=TCWDeselectAll()
Result = TCWDrawingSaveAs(dName,True)
result=MsgBox ("Finished",0,S$)
End Sub