6.4.5.1. Assign Random Selected Attributes to your BLOCKS

Assign random

Customer Order #'s and

Colors (red, green and blue)

to the blocks in your SCHEDULE region.

Tip: Don't forget to use the .modify method after making the changes or the block's attributes won't be changed.

  1. Add the following code to the script.

'****Random cust. order numbers and colors***************

Order$ = " "

Color$ = " "

Randomize

Number = Random(5000,9999)

Order$ = Number

If(Number Mod 3) = 0 Then

Color$ = "RED"

ElseIf(Number Mod 3) = 1 Then

Color$ = "GREEN"

Else

Color$ = "BLUE"

End If

'***End Random generation***************************

  1. Add two specific values to the .modify method

Region.Item(j).SetAttr A1$, Order$

Region.Item(j).SetAttr A2$, Color$

  1. Compile your script.

  2. Close the Edit Script window.

  3. Close the Properties - Object dialog box.

More information