on *:INPUT:*:{ if (($left($1,1) != /) && (!$ctrlenter)) { acro $1- } }
;
alias -l acro { if ($getacro($1-)) { say $v1 | halt } }
;
alias -l getacro {
if (!$hget(amacros) || $hget(amacroset, am_acro)) { return }
tokenize 32 $1-
var %i = $0 , %r
while (%i) {
var %w = $($+($,%i),2)
if ($hget(amacros,%w)) {
var %w = $v1
if ($hget(amacroset, am_Acrocaps)) { %w = $acaps(%w) }
elseif ($hget(amacroset, am_Acroccaps)) { %w = $ccap(%w) }
elseif ($hget(amacroset, am_Acrorcaps)) { %w = $rccap(%w) }
if ($hget(amacroset, ama_Bold)) { %w = $+(,%w,) }
if ($hget(amacroset, ama_Underline)) { %w = $+(,%w,) }
if ($hget(amacroset, ama_Reverse)) { %w = $+(,%w,) }
}
var %r = %w %r
dec %i
}
return %r
}
alias -l acaps {
tokenize 32 $1- | var %i = $0 , %r , %w
while (%i) { %w = $($+($,%i),2) | %r = $+($upper($left(%w,1)),$mid(%w,2)) %r | dec %i }
return %r
}
alias -l ccap {
tokenize 32 $1- | var %i = $0 , %r , %w
while (%i) { %w = $($+($,%i),2) | %r = $+(%am_ac1,$upper($left(%w,1)),%am_ac2,$mid(%w,2),) %r | dec %i }
return %r
}
alias -l rccap {
tokenize 32 $1- | var %i = $0 , %r , %w
while (%i) { %w = $($+($,%i),2) | %r = $+(,$rand(3,14),$upper($left(%w,1)),,$rand(3,14),$mid(%w,2),) %r | dec %i }
return %r
}
dialog options {
title (A)(M) OPTIONS
size -1 -1 97 119
option dbu
radio "Disable Acros", 1, 10 8 43 9
radio "Activate caps", 2, 10 20 43 9
radio "Activate Sel colors", 3, 10 31 53 9
radio "Activate Rand Colors", 4, 10 42 61 9
check "Make Acros Bold", 5, 11 60 54 10
check "Underline Acros", 6, 11 72 50 10
check "Reverse Acros", 7, 11 85 50 10
button "Save", 8, 28 103 37 12, ok
}
on *:dialog:options:*:*: {
if ($devent == init) {
if ($hget(amacroset, am_Acro)) { did -c $dname 1 }
if ($hget(amacroset, am_Acrocaps)) { did -c $dname 2 }
if ($hget(amacroset, am_Acroccaps)) { did -c $dname 3 }
if ($hget(amacroset, am_Acrorcaps)) { did -c $dname 4 }
if ($hget(amacroset, ama_Bold)) { did -c $dname 5 }
if ($hget(amacroset, ama_Underline)) { did -c $dname 6 }
if ($hget(amacroset, ama_Reverse)) { did -c $dname 7 }
}
if (($devent == sclick) && ($did == 8)) {
.hadd -m amacroset am_Acro $did(1).state
.hadd amacroset am_Acrocaps $did(2).state
.hadd amacroset am_Acroccaps $did(3).state
.hadd amacroset am_Acrorcaps $did(4).state
.hadd amacroset ama_Bold $did(5).state
.hadd amacroset ama_Underline $did(6).state
.hadd amacroset ama_Reverse $did(7).state
}
}