scripting@wanadoo.nl




ValidColor()

http://www.scriptlogic.com/kixtart/FunctionLibrary_FunctionList.aspx


actual FunctionLibrary list on 'Scriptlogic' site printer-friendly mirror of UDF topic on 'scripting@wanadoo.nl' site close
25 March 2002 ValidColor()
AuthorHumberto Roche-García(Puerto Rico)
Action Validates Colors for Foreground and Background.
SyntaxValidColor ("ForegroundColor")
-or-
ValidColor ("ForegroundColor", "BackgroundColor") 
Parameters
  • ForegroundColor (Optional / String) ForeGround Color
  • BackgroundColor (Optional / String) BackGroundColor 
  • RemarksValidates Colors for Foreground and Background 
    ReturnsColors 
    DependenciesNone. 
    Examples
    ValidColor("w+","r")
    ValidColor("w-","w")
    ValidColor("w+","w")
    
     
    Source
    FUNCTION ValidColor (OPTIONAL $fforcolor, OPTIONAL $fbaccolor)
      ;
      ; Created by Humberto Roche-García
      ; Senior Programmer Analyst
      ; Citibank, N. A. - Technology Division, Puerto Rico
      ; E-Mail = hrgymcmm@caribe.net or hrgymcmm@hotmail.com
      ; Home Tel. (787) 703-1579
      ; Off. Tel. (787) 766-3870 X. 3397
      ; Created at my home PC
      ;
      ;Valid Colors for Foreground and Background
      $fforcolarray = Split("w,w+,n,n+,b,b+,g,g+,c,c+,r,r+,m,m+,y,y+", ",")
      $fbaccolarray = Split("w,w+,n,n+,b,b+,g,g+,c,c+,r,r+,m,m+,y,y+", ",")
      IF (alltrim($fforcolor) = "+") ; Check for set on Foreground set only as "+"
        $fforcolfind = "w"
      ELSE
        IF (alltrim($fforcolor) <> "") ; Check for Null Color set on Foreground
          $fforcolfind = Lcase($fforcolor)
        ENDIF
      ENDIF
      IF (alltrim($fbaccolor) = "+") ; Check for set on Background set only as "+"
        $fbaccolfind = "n"
      ELSE
        IF (alltrim($fbaccolor) <> "") ; Check for Null Color set on Background
          $fbaccolfind = Lcase($fbaccolor)
        ENDIF
      ENDIF
      $valforcolelement = 0 ; Set find to Off=0 on Foreground Color
      $valbaccolelement = 0 ; Set find to Off=0 on Background Color
      FOR EACH $colorelement IN $fforcolarray
        IF (InStr($colorelement,$fforcolfind) > 0)
          $valforcolelement = 1 ; Valid color is found on Foreground array
          IF (Ucase($debugfunc) = "Y")
            At(22,30) "ValForColElement"
            At(22,48) "  "
            At(22,48) "$ValForColElement"
          ENDIF
        ENDIF
      NEXT
      FOR EACH $colorelement IN $fbaccolarray
        IF (InStr($colorelement,$fbaccolfind) > 0)
          $valbaccolelement = 1 ; Valid color is found on Background array
          IF (Ucase($debugfunc) = "Y")
            At(22,55) "ValBacColElement"
            At(22,72) "  "
            At(22,72) "$ValBacColElement"
          ENDIF
        ENDIF
      NEXT
      IF ($valforcolelement = 0) ; Invalid color on Foreground array
        $fforcolfind = "w"
      ENDIF
      IF ($valbaccolelement = 0) ; Invalid color on Background array
        $fbaccolfind = "n"
      ENDIF
      IF (Substr(Ucase($fforcolor),1,1) = Substr(Ucase($fbaccolor),1,1)) ; Colors are same set
        $fforcolfind = "w"
        $fbaccolfind = "n"
      ENDIF
      $validcolor = $fforcolfind + "/" + $fbaccolfind
    ENDFUNCTION ; - ValidColor -
     
      original source of UDF topic. show actual FunctionLibrary list on Scriptlogic site close top
              printer-friendly mirror of UDF topic on scripting@wanadoo.nl site  




    Copyright © 2003 www.scriptlogic.com & scripting@wanadoo.nl - last updated on 20 May 2003


    Site Meter