home *** CD-ROM | disk | FTP | other *** search
/ Corel Draw 6 / corel-draw-6-cd1.iso / draw / card.csc < prev    next >
Text File  |  1995-08-18  |  5KB  |  125 lines

  1. REM Business Card Helper
  2. REM Card.csc July 21, 1995
  3.  
  4. REM This Script generates a page of business cards.
  5. REM It will ask you for all the relevant information, generate the 
  6. REM card with the logo you specify, and then fill the page with
  7. REM as many as possible.
  8.  
  9. REM It uses the "AvantGarde Bk BT" font, so it may run into problems if you don't have that font.
  10. REM Try changing the variable FontName to another value to get it to work.
  11.  
  12. FontName$ = "AvantGarde Bk BT"
  13.  
  14. DIM Width#, Height#
  15. BEGIN DIALOG Dialog1 264, 203, "Business Card Helper"
  16.     CHECKBOX  28, 19, 50, 9, "Name", NameBool%
  17.     TEXTBOX  100, 19, 101, 13, Name$
  18.     CHECKBOX  28, 41, 50, 10, "Title", TitleBool%
  19.     TEXTBOX  100, 41, 101, 13, Title$
  20.     CHECKBOX  28, 63, 50, 9, "Company", CompBool%
  21.     TEXTBOX  100, 60, 101, 13, Company$
  22.     CHECKBOX  28, 84, 50, 10, "Address", AddBool%
  23.     TEXTBOX  100, 83, 101, 13, Address$
  24.     CHECKBOX  28, 105, 50, 10, "City", CityBool%
  25.     TEXTBOX  100, 105, 54, 13, City$
  26.     CHECKBOX  28, 128, 50, 10, "State", StateBool%
  27.     TEXTBOX  100, 127, 54, 13, State$
  28.     CHECKBOX  28, 150, 50, 10, "Zip Code", ZipBool%
  29.     TEXTBOX  100, 150, 54, 13, ZipCode$
  30.     OKBUTTON  198, 104, 58, 15
  31.     CANCELBUTTON  198, 145, 58, 15
  32.     PUSHBUTTON  198, 124, 58, 16, "Logo..."
  33.     TEXT  17, 181, 70, 8, "Width (1/1000" + CHR(34) + ")"
  34.     SPINCONTROL  75, 181, 40, 12, Width#
  35.     TEXT  126, 181, 70, 8, "Height (1/1000" + CHR(34) + ")"
  36.     SPINCONTROL  185, 181, 40, 12, Height#
  37. END DIALOG
  38.  
  39. REM Defaults
  40. Width = 3500
  41. Height = 2000
  42.  
  43. RETRY:
  44. Ret = DIALOG(dialog1)
  45. IF CANCEL THEN STOP
  46. IF Ret = 3 THEN    'Get logo and return
  47.     currfolder = "C:\"
  48.     Logo$ = GETFILEBOX("*.BMP", "Choose your favorite BITMAP file")
  49.     GOTO RETRY
  50. END IF
  51.  
  52. REM Assemble the text for the card
  53. DIM CardText$
  54. IF NameBool = 1 THEN CardText = CardText$ + Name + CHR(13) + CHR(10)
  55. IF TitleBool = 1 THEN CardText = CardText$ + Title + CHR(13) + CHR(10)
  56. IF CompBool = 1 THEN CardText = CardText$ + Company + CHR(13) + CHR(10)
  57. IF AddBool = 1 THEN CardText = CardText$ + Address + CHR(13) + CHR(10)
  58. IF CityBool = 1 THEN CardText = CardText$ + City + CHR(13) + CHR(10)
  59. IF StateBool = 1 THEN CardText = CardText$ + State + CHR(13) + CHR(10)
  60. IF ZipBool = 1 THEN CardText = CardText$ + ZipCode + CHR(13) + CHR(10)
  61. DIM FirstLine%
  62. FirstLine = INSTR(CardText$, CHR(13))        'Parses the length of the first line
  63.  
  64. HeightInch# = Height / 1000
  65. WidthInch# = Width / 1000
  66. WITHOBJECT DRAW
  67.     .FileNew
  68.  
  69. REM Create the actual rectangle for the card
  70.     .CreateRectangle FROMINCHES(HeightInch / 2), -FROMINCHES(WidthInch / 2), -FROMINCHES(HeightInch / 2), FROMINCHES(WidthInch / 2), 0
  71.  
  72. REM Insert Logo
  73. IF Logo <> "" THEN
  74.     .FileImport Logo$
  75.     .SetSize FROMINCHES(WidthInch / 2), FROMINCHES(HeightInch / 2)
  76.     .SetReferencePoint 1
  77.     .SetPosition FROMINCHES(-WidthInch / 2), FROMINCHES(HeightInch / 2)
  78. END IF
  79.  
  80. REM Insert two bars for effect
  81.     .CreateRectangle FROMINCHES((HeightInch / 2) - HeightInch *.1), FROMINCHES(0), FROMINCHES((HeightInch / 2) - HeightInch *.2), FROMINCHES(WidthInch * 6/13), 0    
  82.         .ApplyFountainFill 0, 0, 0, -300, 50, 0, 3, 0
  83.         .SetFountainFillColor 0, 5, 255, 255, 255, 0
  84.         .SetFountainFillColor 20, 5, 255, 255, 255, 0
  85.         .SetFountainFillColor 100, 5, 255, 0, 0, 0
  86.         .ApplyOutline 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  87.     .CreateRectangle FROMINCHES((HeightInch / 2) - HeightInch *.3), FROMINCHES(0), FROMINCHES((HeightInch / 2) - HeightInch *.4), FROMINCHES(WidthInch * 6/13), 0    
  88.         .ApplyFountainFill 0, 0, 0, -300, 50, 0, 3, 0
  89.         .SetFountainFillColor 0, 5, 255, 255, 255, 0
  90.         .SetFountainFillColor 10, 5, 255, 255, 255, 0
  91.         .SetFountainFillColor 100, 5, 255, 0, 0, 0
  92.         .ApplyOutline 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  93.  
  94. REM Insert the text of the card
  95.     .CreateTextString 0, 0, FROMINCHES(-HeightInch / 2), FROMINCHES(WidthInch / 2), CardText$
  96.     .SelectPreviousObject 0'sInRect 0, 0, FROMINCHES(-HeightInch / 2), FROMINCHES(WidthInch / 2), 0
  97.     .SetCharacterAttributes 0, LEN(CardText$)-1, FontName, 12, 100, 0, 0, 0, 0, 0, 1000, 750, 0
  98.     .SetCharacterAttributes 0, FirstLine, FontName, 12, 120, 0, 0, 0, 0, 0, 1000, 750, 0            'Punches up the first line a little
  99.  
  100. REM Rotate all
  101.     .SelectAllObjects
  102.     .Group
  103.     .RotateObject 90000000, -1, 0, 0
  104.     .CopyToClipboard
  105.     .DeleteObject
  106.  
  107. REM Fill The Page
  108.     .SetPageSize FROMINCHES(8.5), FROMINCHES(11)
  109.     NumRow% = INT(11 / WidthInch)
  110.     NumCol% = INT(8.5 / HeightInch)
  111.  
  112.     For Row% = 0 to NumRow - 1
  113.         For Col% = 0 to NumCol - 1
  114.             Topedge& = FROMINCHES(5.25 - Row * WidthInch)
  115.             LeftEdge& = FROMINCHES(-4.0 + Col * HeightInch)
  116.             .PasteFromClipboard
  117.             .SetPosition LeftEdge&, TopEdge&
  118.         NEXT COL
  119.     NEXT ROW
  120.  
  121. END WITHOBJECT
  122.  
  123.  
  124.  
  125.