Top

Hotstring


mIRC Code
+ 2 likes
Please Register to submit score.
Bookmark and Share
Average Score  5.5 (of 4 scores)
Date Added  Feb 06, 2009
Last Updated  Feb 22, 2009
Tags  hotstring  macro 

Description

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.

Grab the Code

;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))
 
 
 

Comments

  (27)  RSS
Firstmate
Comments: 125
 
mIRC Snippet:  Hotstring
Posted on Feb 6, 2009 12:35 am
Dam, it submitted it twice. Please delete one of them :x
ProIcons
Comments: 54
 
mIRC Snippet:  Hotstring
Posted on Feb 6, 2009 12:39 am
7/10 :D Now Answer to mine:D http://www.hawkee.com/snippet/5725/ :D lol
Jamiie
Comments: 167
 
mIRC Snippet:  Hotstring
Posted on Feb 6, 2009 1:04 am
Neatly done, works great for me.


6/10+like
PunkTuReD
Comments: 489
 
mIRC Snippet:  Hotstring
Posted on Feb 6, 2009 1:07 am
you should add to your description, how to open the dialog.

i cant get it to add.
no errors show
Jamiie
Comments: 167
 
mIRC Snippet:  Hotstring
Posted on Feb 6, 2009 1:11 am
Punktured, use /hs
Firstmate
Comments: 125
 
mIRC Snippet:  Hotstring
Posted on Feb 6, 2009 1:11 am
lol, My bad I guess.

I fixed the glitch where the script and text are stored elsewhere...
PunkTuReD
Comments: 489
 
mIRC Snippet:  Hotstring
Posted on Feb 6, 2009 1:12 am
yea i figured out how to open it by looking at the code, but some people wont be able to do so.

very neat dialog btw
Jamiie
Comments: 167
 
mIRC Snippet:  Hotstring
Posted on Feb 6, 2009 1:14 am
Punktured, what persuaded you into getting that image? Just out of curiosity.
Firstmate
Comments: 125
 
mIRC Snippet:  Hotstring
Posted on Feb 6, 2009 1:16 am
Still weird that it's having that glitch, I thought I fixed it by making it save to a .txt where the script is stored. I have the alias hs.txt for that.
PunkTuReD
Comments: 489
 
mIRC Snippet:  Hotstring
Posted on Feb 6, 2009 1:21 am
lol jamiie
the sort of judgemental comments i get when i do, the comments i got when i uploaded it were quite amusing.

yea ive unloaded it now cos none of my messages are going through.
Aucun50
Comments: 568
 
mIRC Snippet:  Hotstring
Posted on Feb 6, 2009 3:12 pm
Looks neat and good coding
Kirbeh_Pr0nz
Comments: 150
 
mIRC Snippet:  Hotstring
Posted on Feb 7, 2009 6:50 pm
It didnt work for me, i would type in the hotstring,
and click 'Add'
but it wouldnt add it.
plz help if you can
Kirby
Comments: 480
 
mIRC Snippet:  Hotstring
Posted on Feb 7, 2009 9:01 pm
Some things I would like to note:

  • Radios
    Code:
      if ($did == 7) { set %hs 1 }
      if ($did == 10) { set %hs 0 }

    You can use $did(id).state and some $iif's to see whether something is checked or not, and perform various actions on each check, without the use of variables. Also note that those variables can easily be unset. So normally, you wouldn't need to perform an action when you sclick on those $did's (radios, checkboxes, etc).

  • Aliases
    The first alias that I see is:
    Code:
    alias hs { dialog $iif($dialog(hs),-v,-dom) hs hs hs | if (!%hs) { set %hs 0 } }

    As I said earlier, you wouldn't need variables for radios. Also, to open a dialog, you only need two dialog id's after the $iif. So you can basically recode this as:
    Code:
    alias hs dialog $iif($dialog(hs),-v,-dom) hs hs

    This might be my habit, but I find it awkward to have multiple aliases pertaining to the script that perform different functions.
    I see three different aliases:
    Code:
    alias hs.load, hs.replace, hs.txt

    Kinda confused me, but I guess you can ignore me on this part and leave it alone.

  • Dialog
    No offense but, this dialog is f&(@#$.
    I am sorry, I apologize.

    You said earlier that you don't want to use DSTUDIO (for unknown reasons to me), but I'll say some things:

    • DSTUDIO makes dialogs look much nicer and it's easier to edit.
    • DSTUDIO saves you time.

    You may disagree with me because this is a small dialog, but if you were to code a larger dialog as I did with my Microsoft Agent dialog, DSTUDIO significantly lowers the time to create a dialog by several minutes...even hours.

    On the bright side, you can improve upon things.
    In my opinion, I didn't like the edit box directly underneath the list box.
    I also didn't like the initiation text event; I thought it was a little useless, and you can cut that large space out.
    This is only one opinion, and you can reject this idea if you wish.

    Below I've recoded the dialog to what fits me the best, but again, you can ignore me if you want.
    Code:
    dialog hs {
      title "Hotstring v0.2"
      size -1 -1 151 84
      option dbu
      text "Resulting text:", 1, 86 9 37 8
      text "Hotstring(s):", 2, 16 9 31 8
      list 3, 7 19 51 57, size
      edit "", 4, 67 19 74 11, read
      button "Add", 5, 64 40 35 10
      button "Remove", 6, 109 40 35 10
      radio "On", 7, 81 60 18 10
      radio "Off", 8, 110 60 19 10
      box "Hotstring Configuration", 9, 4 1 144 80
    }


    I just thought this made it look a little "cleaner".


That's really all I have to say.
Keep on going; I like the idea of this script.
Eugenio
Comments: 1,178
 
mIRC Snippet:  Hotstring
Posted on Feb 7, 2009 10:29 pm
rofl @ kirbeh ffs
why not just recode the whole thang, and stop doing a Napa however the dialog is abit f&(@#$ ;p
also you should make it so that we cant keep entering the same hotstring.....
anyhow I like this code
/me rates 7
Kirby
Comments: 480
 
mIRC Snippet:  Hotstring
Posted on Feb 7, 2009 10:33 pm
Firstmate
Comments: 125
 
mIRC Snippet:  Hotstring
Posted on Feb 7, 2009 11:14 pm
Updated. Should fix the problem of not properly adding hotstrings.
I'll make the dialog look better later.
jonesy44
Comments: 1,892
 
mIRC Snippet:  Hotstring
Posted on Feb 22, 2009 2:56 pm
alias "/hs" is an alias for "/msg hostserv x" on some servers. i suggest you change it (:

and btw, i disagree. i quite like the dialog, from the screenshot.
If i was to be REALLY picky, move the radios down a few px. and make them a bit closer together. and make the edit box as long as the longest part of text (:
Firstmate
Comments: 125
 
mIRC Snippet:  Hotstring
Posted on Feb 22, 2009 5:58 pm
Ahh forgot about that, thanks. I was just too lazy to type /hotstring each time to test (and too stupid to make a menu at that time), so I put /hs. Forgot to change it at end.

And yeah, I usually do dialogs like without DStudio or anything so that's why it looks a little less aesthetically pleasing :)

*Updates alias
jonesy44
Comments: 1,892
 
mIRC Snippet:  Hotstring
Posted on Feb 23, 2009 10:52 am
I perfer NOT using dstudio. but taking time to (maybe a bit picky) but get it pixel perfect. i find dstudio cocks it up too much
Kirby
Comments: 480
 
mIRC Snippet:  Hotstring
Posted on Feb 23, 2009 11:03 am
DSTUDIO cocks it up too much?
jonesy44
Comments: 1,892
 
mIRC Snippet:  Hotstring
Posted on Feb 23, 2009 11:12 am
Yeah. messes with ID's etc. makes it look.. "average" then it takes ages to sort it. do it the real way (:
Kirby
Comments: 480
 
mIRC Snippet:  Hotstring
Posted on Feb 23, 2009 11:23 am
Well, what if you were to work with excessively large dialogs?
It doesn't mess with ID's unless you were to add things in a disorganized way.
Blitzjager
Comments: 192
 
mIRC Snippet:  Hotstring
Posted on Feb 23, 2009 11:24 am
Wuuut
The IDs are the only thing that sometimes bugs me about DStudio. And it's much easier to get it pixel perfect with DStudio. :P

*Will never manually make a dialog ever again*
Firstmate
Comments: 125
 
mIRC Snippet:  Hotstring
Posted on Feb 23, 2009 12:31 pm
I like how Jonesy put it. I like how easy it is to use DStudio, but I just don't like it.
I would use it for the huge dialogs that I might ever need (and even then, probably just to get a look on things, not actually making it).

DStudio just helps get a better visual representation of the dialog.
jonesy44
Comments: 1,892
 
mIRC Snippet:  Hotstring
Posted on Feb 23, 2009 1:25 pm
Nicely said, Firstmate, agree with that entirely. "just to get a look on things, not actually making it"
Blitzjager
Comments: 192
 
mIRC Snippet:  Hotstring
Posted on Feb 23, 2009 2:04 pm
Eh, usually when I'm making a dialog I can think of what it should look like and then use DStudio to actually make it. :S
Eugenio
Comments: 1,178
 
mIRC Snippet:  Hotstring
Posted on Feb 23, 2009 4:42 pm
smh

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  

Bottom