home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1999 Spring / macformat-077.iso / Shareware Plus / Development / Akua Sweets 131 / Akua Sweets Examples / Misc / Modifier Keys < prev    next >
Encoding:
Text File  |  1999-03-04  |  1.0 KB  |  51 lines  |  [TEXT/ToyS]

  1. global gasProg
  2.  
  3.  
  4. on run
  5.     set gasProg to display progress titled "Modifier Key Test" subtitled "Idling…"
  6. end run
  7.  
  8.  
  9. on idle
  10.     set modKeys to (input state with «class KMod»)
  11.     
  12.     set mkeyVal to modKeys
  13.     set mkeyStr to ""
  14.     
  15.     if (modKeys ≥ 16) then
  16.         set mkeyStr to mkeyStr & "-Command"
  17.         set modKeys to modKeys - 16
  18.     end if
  19.     
  20.     if (modKeys ≥ 8) then
  21.         set mkeyStr to mkeyStr & "-Control"
  22.         set modKeys to modKeys - 8
  23.     end if
  24.     
  25.     if (modKeys ≥ 4) then
  26.         set mkeyStr to mkeyStr & "-Option"
  27.         set modKeys to modKeys - 4
  28.     end if
  29.     
  30.     if (modKeys ≥ 2) then
  31.         set mkeyStr to mkeyStr & "-Caps Lock"
  32.         set modKeys to modKeys - 2
  33.     end if
  34.     
  35.     if (modKeys ≥ 1) then
  36.         set mkeyStr to mkeyStr & "-Shift"
  37.         set modKeys to modKeys - 1
  38.     end if
  39.     
  40.     if (mkeyStr is "") then
  41.         set mkeyStr to "None"
  42.     else
  43.         set mkeyStr to the text from character 2 to -1 of mkeyStr
  44.     end if
  45.     
  46.     set test to input state with «class KOpt», «class KCmd» and «class KCtl»
  47.     display progress gasProg subtitled mkeyStr labeled (mkeyVal as string) & ":" & (test as string)
  48.     
  49.     return 1
  50. end idle
  51.