udfRulerScale
str udfRulerScale (int, int, int)
;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfRulerScale (intLength, intModeBase, intModeDigit)
If intLength < 1 Then Return ""
intModeBase = Min (1, Max (0, intModeBase))
intModeDigit = Min (1, Max (0, intModeDigit))

intPMax = 0
intN = intLength
While @TRUE
   intN = intN / 10
   If !intN Then Break
   intPMax = intPMax + 1
EndWhile

strRuler = StrSub (StrFill ("0123456789", intLength + 1), 1 + intModeBase, intLength) : @CRLF

For intP = 1 To intPMax
   strRow = ""
   intNMax = intLength / (10 ** intP)
   For intN = 0 To intNMax
      intDigit = intN mod 10
      strFiller = "_"
      If intModeDigit Then strFiller = intDigit
      strFiller = StrFill (strFiller, (10 ** intP) - 1)
      strRow = strRow : intDigit : strFiller
   Next
   strRow = StrSub (strRow, 1 + intModeBase, intLength)
   strRuler = strRow : @CRLF : strRuler
Next

Return strRuler
;..........................................................................................................................................
; This UDF "udfRulerScale" creates row/s with scaled text strings with numbered columns for different purposes.
;..........................................................................................................................................
;
; For example: udfRulerScale (32, 0, 1)
;
; 00000000001111111111222222222233
; 01234567890123456789012345678901
;
;..........................................................................................................................................
;
; For example: udfRulerScale (32, 1, 0)
;
; _________1_________2_________3__
; 12345678901234567890123456789012
;
;..........................................................................................................................................
;
; Parameters:
;
; intLength ........ The length resp. width of the ruler string.
; intModeBase=0  ... Zero based ruler string     e.g. "01234"
; intModeBase=1  ... One  based ruler string     e.g. "12345"
; intModeDigit=0 ... Use Underline character     e.g. "_________1_________2"
; intModeDigit=1 ... Use digits to fill the row  e.g. "00000000011111111112"
;
;..........................................................................................................................................
; Detlev Dalitz.20020725.20100205.
;------------------------------------------------------------------------------
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------


; Test.

strMsgTitle = "Demo udfRulerScale (intLength, intModeBase, intModeDigit)"

strTmpFile = FileCreateTemp ("TMP")
hdlFA = FileOpen (strTmpFile, "APPEND")

strMsgText = "Test1: udfRulerScale (7,1,1)" : @CRLF : udfRulerScale (7, 1, 1) : @CRLF
FileWrite (hdlFA, strMsgText)
Pause (strMsgTitle, strMsgText)

strMsgText = "Test2: udfRulerScale (64,0,0)" : @CRLF : udfRulerScale (64, 0, 0) : @CRLF
FileWrite (hdlFA, strMsgText)
Pause (strMsgTitle, strMsgText)

strMsgText = "Test3: udfRulerScale (64,0,1)" : @CRLF : udfRulerScale (64, 0, 1) : @CRLF
FileWrite (hdlFA, strMsgText)
Pause (strMsgTitle, strMsgText)

strMsgText = "Test4: udfRulerScale (64,1,0)" : @CRLF : udfRulerScale (64, 1, 0) : @CRLF
FileWrite (hdlFA, strMsgText)
Pause (strMsgTitle, strMsgText)

strMsgText = "Test5: udfRulerScale (64,1,1)" : @CRLF : udfRulerScale (64, 1, 1) : @CRLF
FileWrite (hdlFA, strMsgText)
Pause (strMsgTitle, strMsgText)

strMsgText = "Test6: udfRulerScale (132,1,0)" : @CRLF : udfRulerScale (132, 1, 0) : @CRLF
FileWrite (hdlFA, strMsgText)
Pause (strMsgTitle, strMsgText)

strMsgText = "Test7: udfRulerScale (1024,1,0)" : @CRLF : udfRulerScale (1024, 1, 0) : @CRLF
FileWrite (hdlFA, strMsgText)
Pause (strMsgTitle, strMsgText)

strMsgText = "Test8: udfRulerScale (1024,1,1)" : @CRLF : udfRulerScale (1024, 1, 1) : @CRLF
FileWrite (hdlFA, strMsgText)
Pause (strMsgTitle, strMsgText)

hdlFA = FileClose (hdlFA)
If FileExist (strTmpFile)
   ; Take a look and wait for closing notepad.
   RunZoomWait ("notepad.exe", strTmpFile)
   FileDelete (strTmpFile)
EndIf

:CANCEL
Exit
;------------------------------------------------------------------------------------------------------------------------------------------
;
;   Test1: udfRulerScale (7, 1, 1)
;   1234567
;
;------------------------------------------------------------------------------------------------------------------------------------------
;
;   Test2: udfRulerScale (64, 0, 0)
;   0_________1_________2_________3_________4_________5_________6___
;   0123456789012345678901234567890123456789012345678901234567890123
;
;------------------------------------------------------------------------------------------------------------------------------------------
;
;   Test3: udfRulerScale (64, 0, 1)
;   0000000000111111111122222222223333333333444444444455555555556666
;   0123456789012345678901234567890123456789012345678901234567890123
;
;------------------------------------------------------------------------------------------------------------------------------------------
;
;   Test4: udfRulerScale (64, 1, 0)
;   _________1_________2_________3_________4_________5_________6____
;   1234567890123456789012345678901234567890123456789012345678901234
;
;------------------------------------------------------------------------------------------------------------------------------------------
;
;   Test5: udfRulerScale (64, 1, 1)
;   0000000001111111111222222222233333333334444444444555555555566666
;   1234567890123456789012345678901234567890123456789012345678901234
;
;------------------------------------------------------------------------------------------------------------------------------------------
;
;   Test6: udfRulerScale (132, 1, 0)
;   ___________________________________________________________________________________________________1________________________________
;   _________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3__
;   123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012
;
;------------------------------------------------------------------------------------------------------------------------------------------
;
;   Test7: udfRulerScale (1024, 1, 0)
;   _______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________1________________________
;   ___________________________________________________________________________________________________1___________________________________________________________________________________________________2___________________________________________________________________________________________________3___________________________________________________________________________________________________4___________________________________________________________________________________________________5___________________________________________________________________________________________________6___________________________________________________________________________________________________7___________________________________________________________________________________________________8___________________________________________________________________________________________________9___________________________________________________________________________________________________0________________________
;   _________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2____
;   1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234
;
;------------------------------------------------------------------------------------------------------------------------------------------
;
;   Test8: udfRulerScale (1024,1,1)
;   0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111
;   0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222233333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333334444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555566666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666667777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888899999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990000000000000000000000000
;   0000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999000000000011111111112222222222333333333344444444445555555555666666666677777777778888888888999999999900000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122222
;   1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234
;
;------------------------------------------------------------------------------------------------------------------------------------------