home *** CD-ROM | disk | FTP | other *** search
/ The Best of Windows 95.com 1996 September / WIN95_09962.iso / auto / cm95-10.zip / DEMO.WIL < prev    next >
Text File  |  1996-08-30  |  4KB  |  133 lines

  1. szTitle = "WIL Language Demonstration"
  2. szText1 = "The WIL language is the perfect balance between power and flexibility!"
  3. Message(szTitle, szText1)
  4. ;BoxOpen(szTitle, szText3)
  5. Display(3, szTitle, "String Handling...")
  6. :EnterName
  7. szUserName = AskLine("", "Please enter your name", "Francisco Domingo Carlos Andres Sebastißn d'Anconia")
  8. nNameSize = StrLen(szUserName)
  9. if nNameSize < 2 || nNameSize > 127 then
  10.     Message("Ooops@!", "Name must be between 2 and 127 characters long.")
  11.     Goto EnterName
  12. endif
  13. Display(5, szUserName, StrCat("Your name is ", nNameSize, " characters long."))
  14. nNumNames = 1
  15. StartPos = 1
  16. :Loop
  17. ;Debug(@ON)
  18. a = StrScan(szUserName, " ", StartPos, @FWDSCAN)
  19. if a == 0 
  20.     Display(4, szUserName, StrCat("You have ",nNumNames, " parts to your name..."))
  21. end if
  22. if a <> 0 
  23.     nNumNames = nNumNames + 1
  24.     StartPos = a + 1
  25.     Goto Loop
  26. endif
  27. nNameNum = 1
  28. a = 0
  29. StartPos = 1
  30. :Loop2
  31. b = a
  32. szTitle = StrCat("Name #",nNameNum)
  33. a = StrScan(szUserName, " ", StartPos, @FWDSCAN)
  34. if a <> 0 || StartPos < nNameSize
  35.     if a <> 0 then c = a - b
  36.     if a == 0 then c = nNameSize - b
  37.     nCurNam = StrSub(szUserName, StartPos, c)
  38.     StartPos = a + 1
  39.     ;Display(3, szTitle, nCurNam)
  40.     Display(2, szTitle, StrCat(nCurNam))
  41.     nNameNum = nNameNum + 1
  42.     if a <> 0 then Goto Loop2
  43. endif 
  44.  
  45. szTitle = "WIL Language Demonstration"
  46. Display(4, szTitle, "Now for some program control...")
  47. while WinExist("Notepad") == @TRUE
  48.     Message(szTitle, "This example deals with Notepad.  Please close down all instances of Notepad before proceeding.")
  49. endwhile
  50.  
  51. RunHide("Notepad.exe", "")
  52. WinPlace(17,3,385,381,`Untitled - Notepad`)
  53. WinShow(`Untitled - Notepad`)
  54.  
  55. SendKeysTo("Untitled - Notepad", "Hmmm...  This window should be larger...~~")
  56. Delay(3)
  57. WinPlace(0,0,518,501,`Untitled - Notepad`)
  58. SendKey("Much better{!}~~")
  59. Delay(2)
  60. WinPlace(0,0,600,550,`Untitled - Notepad`)
  61. SendKey("Better still{!}~~")
  62. Delay(4)
  63.  
  64. SendKey("Cruising around the screen...~~")
  65. Delay(2)
  66. For i = 1 to 6 
  67. xRand = Random(650)
  68. yRand = Random(650)
  69. WinPlace(xRand,yRand,xRand + 350,yRand + 350,`Untitled - Notepad`)
  70. Delay(1)
  71. Next i
  72. WinPlace(0,0,518,501,`Untitled - Notepad`)
  73. Sendkey("I'm tired.  I think I'll become an icon for a few seconds...")
  74. Delay(3)
  75. WinIconize(`Untitled - Notepad`)
  76.  
  77. Display(3, szTitle, "Next, we'll make the window Maximized")
  78. WinZoom(`Untitled - Notepad`)
  79. Delay(2)
  80. Display(6, szTitle, StrCat("We're back.", @CRLF, @CRLF, "ClockMan95 can wait for programs to finish before executing", @CRLF, "the next instruction in sequence."))
  81. Display(3, szTitle, "ClockMan95 can even read standard Windows message boxes...")
  82. Display(2, sztitle, "First, we'll close Notepad.")
  83. WinClose(`Untitled - Notepad`)
  84. Delay(3)
  85. MGT1 = MsgTextGet("Notepad")
  86. Display(5, szTitle, StrCat("We tried to close Notepad,", @CRLF, "but it displayed a message box which reads...", @CRLF, @CRLF, MGT1))
  87. Display(3, szTitle, `So, we'll send the "N" keystroke to respond appropriately to the message box.`)
  88. WinActivate(`Untitled - Notepad`)
  89. SendKey("n")
  90.  
  91. Display(3, szTitle, "A ClockMan95 event can even control other programs with DDE.")
  92. Display(2, szTitle, "Searching for Microsoft Excel...")
  93. fExcel = FileLocate("excel.exe") 
  94. if fExcel == "" then fExcel=IniRead("extensions","xls","")
  95. if fExcel==""
  96.     Display(2, szTitle, "Oops, so much for THAT demo - Excel not found!")
  97.     goto ExcelBreak
  98. endif
  99.  
  100. szB = strindex(fExcel," ", 0, @FWDSCAN)
  101. if szB==0 then szB = strlen(fExcel) + 1
  102. szB = strsub(fExcel, 1, szB - 1)
  103. run(szB, "")
  104. channel = DDEInitiate("Excel", "Sheet1")
  105. Numbers = "One Two Three Four Five Six Seven Eight Nine Ten"
  106. offset = 1
  107. row = 0
  108. :rowloop
  109. col = 0
  110. row = row + 1
  111. if row > 10 then goto ExcelDone
  112. ThisNum = ItemExtract(row, Numbers, " ")
  113. title = row + offset
  114. DDEPoke(channel, "R1C%title%", ThisNum)
  115. DDEPoke(channel, "R%title%C1", ThisNUm)
  116. :colloop
  117. col = col + 1
  118. if col > 10 then goto rowloop
  119. expression = "=%row%*%col%"
  120. address = strcat("R", row + offset, "C", col+offset)
  121. DDEPoke(channel, address, expression)
  122. goto colloop
  123.  
  124. :ExcelDone
  125. DDETerminate(channel)
  126.  
  127. Display(3, szTitle, "Complete")
  128. WinClose("Microsoft Excel")
  129. WinActivate("Microsoft Excel")
  130. Delay(2)
  131. MGT2 = MsgTextGet("Microsoft Excel")
  132. if MGT2 == "Save changes in 'Sheet1'?" Then Sendkey("n")
  133. :ExcelBreak