Guest User

Untitled

a guest
Feb 19th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.93 KB | None | 0 0
  1.  
  2. dialog acronyms {
  3. title "Acronyms Editor"
  4. size -1 -1 220 165
  5. option dbu
  6. list 1, 1 9 152 141, size
  7. button "Add Acronym", 2, 1 151 50 12
  8. button "Delete Acronym", 3, 52 151 50 12
  9. text "flupScript Acronyms", 4, 2 1 52 8
  10. check "Acronyms Enabled", 6, 103 151 55 12,
  11. text "Edit", 7, 156 10 25 8
  12. edit "", 8, 155 26 63 10
  13. text "Short Acro", 9, 156 18 27 8
  14. text "Long Acro", 10, 156 37 25 8
  15. edit "", 11, 155 46 63 10, autohs
  16. button "Make Changes", 12, 155 58 37 12
  17.  
  18. }
  19. on *:dialog:acronyms:init:0:{
  20. did -m acronyms 8
  21. did -r acronyms 1
  22. var %x 1
  23. while (%x <= $hget(acronyms,0).item) {
  24. did -a acronyms 1 $gettok($hget(acronyms,%x).item,1,32)
  25. inc %x
  26. }
  27. if (%acronyms.on == $true) {
  28. did -c acronyms 6
  29. }
  30. if (%acronyms.on != $true) {
  31. did -u acronyms 6
  32. }
  33. }
  34. on *:dialog:acronyms:sclick:1:{
  35. if ($did(1).sel != $null) {
  36. did -ra acronyms 8 $hget(acronyms,$did(1).sel).item
  37. did -ra acronyms 11 $hget(acronyms,$did(1).sel).data
  38. }
  39. }
  40. on *:dialog:acronyms:sclick:2:{
  41. var %acroshort $$?="Short Acronym. (Eg: lol)"
  42. if ($hget(acronyms,$gettok(%acroshort,1,32)) != $null) {
  43. echo -a You already have an acronym for that. Edit it instead.
  44. }
  45. else {
  46. var %acrolong $$?="Long Acronym. (Eg: Laughing out Loud)"
  47. hadd acronyms $gettok(%acroshort,1,32) %acrolong
  48. did -r acronyms 1
  49. var %x 1
  50. while (%x <= $hget(acronyms,0).item) {
  51. did -a acronyms 1 $gettok($hget(acronyms,%x).item,1,32)
  52. inc %x
  53. }
  54. }
  55. }
  56. on *:dialog:acronyms:sclick:3:{
  57. hdel acronyms $did(1).seltext
  58. did -r acronyms 1
  59. did -r acronyms 8
  60. did -r acronyms 11
  61. var %x 1
  62. while (%x <= $hget(acronyms,0).item) {
  63. did -a acronyms 1 $gettok($hget(acronyms,%x).item,1,32)
  64. inc %x
  65. }
  66. }
  67. on *:dialog:acronyms:sclick:6:{
  68. if ($did(6).state == 1) {
  69. set %acronyms.on $true
  70. }
  71. if ($did(6).state == 0) {
  72. set %acronyms.on $false
  73. }
  74. }
  75. on *:dialog:acronyms:sclick:12:{
  76. hadd acronyms $did(1).seltext $did(11).text
  77. }
  78. on *:input:*:{
  79. if (%acronyms.on == $true) {
  80. if ($left($1,1) != /) && (!$ctrlenter) {
  81. var %acrotext = $1-
  82. var %acrotext.send = $1-
  83. var %acronum2 = 1
  84. while (%acronum2 <= $numtok(%acrotext,32)) {
  85. if ($hget(acronyms,$gettok(%acrotext,%acronum2,32))) {
  86. var %1 = $gettok(%acrotext,%acronum2,32))
  87. var %2 = $hget(acronyms,$gettok(%acrotext,%acronum2,32))
  88. var %acrotext.send = $reptok(%acrotext.send,%1,%2,1,32)
  89. inc %acronum2
  90. }
  91. if (!$hget(acronyms,$gettok(%acrotext,%acronum2,32)) {
  92. inc %acronum2
  93. }
  94. }
  95. msg $active %acrotext.send
  96. halt
  97. }
  98. }
  99. }
  100. on *:disconnect:{ hsave acronyms acronyms.txt }
  101. on *:START:{
  102. if (!$hget(acronyms)) { hmake acronyms 10 }
  103. if ($isfile(acronyms.txt)) { hload acronyms acronyms.txt }
  104. }
  105. alias acro dialog -m acronyms acronyms
  106. menu channel,menubar {
  107. ..Acronyms:acro
  108. }
Add Comment
Please, Sign In to add comment