Random Sequential Colors in a Dialog

General Macro Scheduler discussion

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
JRL
Automation Wizard
Posts: 3529
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Random Sequential Colors in a Dialog

Post by JRL » Sat Mar 28, 2009 5:19 am

Try it. Watch it for a while. The concept might be useful to someone. Uses the SetDialogObjectColor> function introduced in release 11.

Code: Select all

GetScreenRes>Width,Height

Dialog>White
   Caption=Close
   Width=%width%
   Height=%height%
   Top=0
   Left=CENTER
   Max=0
   Min=0
   Close=1
   Resize=1
   label= ,10,20,true
EndDialog>White

Show>White

Label>Loop
  GetDialogAction>White,reswhite
  If>reswhite=2
    Exit>0
  EndIF
  Wait>0.01
  GoSub>ColorFlow
Goto>Loop



SRT>ColorFlow
  Assigned>rednum,redres
  If>redres=FALSE
    Random>255,rednum
    Random>255,greennum
    Random>255,bluenum
    Random>2,RedDirection
    Random>2,GreenDirection
    Random>2,BlueDirection
  EndIf
  Random>3,Hue
  Random>3,step
  If>%rednum%<%step%
    Let>RedDirection=1
  EndIf
  If>%greennum%<%step%
    Let>GreenDirection=1
  EndIf
  If>%bluenum%<%step%
    Let>BlueDirection=1
  EndIf
  If>{%rednum%>(255-%step%)}
    Let>RedDirection=0
  EndIf
  If>{%greennum%>(255-%step%)}
    Let>GreenDirection=0
  EndIf
  If>{%bluenum%>(255-%step%)}
    Let>BlueDirection=0
  EndIf
  If>RedDirection=1
    If>{(%Hue%=2) and (%rednum%<(255-%step%))}
      Let>rednum=%rednum%+%step%
    EndIf
  EndIf
  If>GreenDirection=1
    If>{(%Hue%=1) and (%greennum%<(255-%step%))}
      Let>greennum=%greennum%+%step%
    EndIf
  EndIf
  If>BlueDirection=1
    If>{(%Hue%=0) and (%bluenum%<(255-%step%))}
      Let>bluenum=%bluenum%+%step%
    EndIf
  EndIf
  If>RedDirection=0
    If>{(%Hue%=2) and (%rednum%>(0+%step%))}
      Let>rednum=%rednum%-%step%
    EndIf
  EndIf
  If>GreenDirection=0
    If>{(%Hue%=1) and (%greennum%>(0+%step%))}
      Let>greennum=%greennum%-%step%
    EndIf
  EndIf
  If>BlueDirection=0
    If>{(%Hue%=0) and (%bluenum%>(0+%step%))}
      Let>bluenum=%bluenum%-%step%
    EndIf
  EndIf
  RGB>rednum,greennum,bluenum,colorwhite
  SetDialogObjectColor>White,,%colorwhite%
  Let>White.mslabel1=%RedNum%,%GREENNum%,%BlueNum%,%colorwhite%
END>ColorFlow

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sat Mar 28, 2009 6:10 pm

Wow - never know what you are going to show us next.

I think my favorite one was number 217.

Will save for later autopsy, thanks.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts