Hotstring
Platform: mIRC
Published Feb 06, 2009
Updated Feb 22, 2009
HotString v0.1
Type /hotstring to start it.
This script basically acts, well like the title says, a hotstring.
I'll show a screenie so you can see it better:
On the bottom-left you can add a hotstring (No Spaces!). Click add to add it, and you should see it come up in the list on the left side.
The edit box on the right lets you change the text you want to replace. To do so, first click a hotstring and then type the text to replace.
;Hotstring v0.2
;Made by Firstmate
on 1:INPUT:#:{
if ($left($1,1) !== / && !$ctrlenter) {
if (%hs == 1) { msg $active $hs.replace($1-) | halt }
}
}
alias hotstring { dialog $iif($dialog(hs),-v,-dom) hs hs hs | if (!%hs) { set %hs 0 } }
dialog hs {
title "Hotstring v0.1"
size -1 -1 350 170
text "Hotstrings",1,5 5 50 20
list 2, 5 25 100 140
text "Text",3, 120 5 50 20
edit "",4, 120 25 200 20, authos
button "Add",5, 120 60 50 20
button "Remove",6,120 80 50 20
text "",8,180 60 150 200
text "",9, 200 150 200 20
radio "On",7,120 100 50 20, group
radio "Off",10,120 120 50 20
edit "",11,5 145 100 20
}
on *:dialog:hs:init:0: {
if ($lines($hs.txt) > 0) { hs.load 2 }
did -a hs 8 Hi, this script will automatically replace your text. To start using it, add a hotstring (editbox at bottom-left), turn it on, and then the text it will replace.
did -c hs $iif(%hs == 1,7,10)
}
on *:dialog:hs:sclick:*: {
if ($did == 2) {
did -r hs 4
var %a = $did(hs,2,$did(hs,2).sel).text
if ($read($hs.txt,s,%a)) { did -a hs 4 $read($hs.txt,s,%a) }
}
if ($did == 5) {
var %a = $did(hs,11)
if (!%a) { did -a hs 9 Please enter a hotstring }
elseif ($numtok(%a,32) !== 1) { did -a hs 9 Script doesn't support spaces }
elseif ($read($hs.txt,s,%a)) { did -a hs 9 Hotstring already exists }
else { write $hs.txt %a | hs.load 2 }
}
if ($did == 6) {
var %a = $did(hs,2,$did(hs,2).sel).text
if (!%a) { did -a hs 9 Please select a hotstring }
else { write -ds %a $qt($hs.txt) | did -a hs 9 Deleted! | hs.load 2 }
}
if ($did == 7) { set %hs 1 }
if ($did == 10) { set %hs 0 }
}
on *:dialog:hs:edit:4: {
var %a = $did(hs,2,$did(hs,2).sel).text
if (%a) {
write -ds %a $hs.txt
write $hs.txt %a $did(hs,4).text
}
}
alias hs.load {
var %i = 1, %x = $calc($lines($hs.txt) + 1)
if (%x == 1) { did -r hs $1 | halt }
else {
did -r hs $1
while (%i < %x) {
did -a hs $1 $gettok($read($hs.txt,%i),1,32)
inc %i
}
}
}
alias hs.replace {
var %a $1-
var %i = 1, %x = $calc($lines($hs.txt) + 1)
if (%x == 1) { halt }
else {
while (%i < %x) {
var %search = $+(/\b,$gettok($read($hs.txt,%i),1,32),\b/g)
var %replace = $gettok($read($hs.txt,%i),2-,32)
if (%replace) { noop $regsub(%a,%search,%replace,%a) }
inc %i
}
}
return %a
}
alias hs.txt return $qt($+($scriptdir,hs.txt))