What does this do?
For anyone who's a fairly good scripter, you will have used tokens ($gettok, etc.). This script simply takes a string and seperates it using the delimiter which is a character or ascii value. the results are then listed in a list box for you to view.
Helpful for?
Sockets, "finding" information withing a string. Any other script which requires picking out sections of information
How to use it
Simply run the command /gtk [string ascii/chrval]. The parts in [] are not required, but will add the string and val into the dialog once loaded. check screenshot for more information
Updates
v1.0
Screenshot
; ===============
; Token Simplifier
; By:Jonesy44
; Version:1.2
; ===============
alias -l gtk.version return 1.2
alias gtk {
dialog $iif($dialog(gtk),-v,-m) gtk gtk
if ($regex($1-,/^(.*) (\d{1,3}|.{1})$/)) { did -ra gtk 201 $regml(1) | did -ra gtk 202 $regml(2) | did -c gtk $iif($regml(2) isnum,302,301) | did -u gtk $iif($regml(2) isnum,301,302) | gtk.checksep | gtk.compile }
}
dialog gtk {
size -1 -1 500 235
title Token Simplifier $+([,Version,$chr(32),$gtk.version,])
option pixels
box ".:: INPUT ::.", 1, 5 5 490 70
box ".:: OUTPUT ::.", 2, 5 85 490 145
text "String:", 101, 15 27 60 13
text "Seperator:", 102, 15 52 60 13
text "Tokens:", 103, 15 108 60 13
text "Ident:", 104, 15 203 60 13
edit "", 201, 70 25 395 20, autohs
edit "", 202, 188 49 40 20, autohs
button "?", 203, 230 48 20 21
button "?", 204, 467 24 20 21
radio "ASCII", 301, 70 49 50 20
radio "CharVal", 302, 125 49 60 20
list 401, 70 105 415 100, hsbar
edit "", 402, 70 201 385 20, read
button "Cb.", 403, 455 200 30 21
}
on *:dialog:gtk:sclick:*: {
if ($did == 203) { noop $input(The seperator defines the seperation between "tokens" only one character is required here. Either an ASCII Character or Character value $crlf $+ $crlf $+ ASCII: 1 character $chr(9) Any keyboard character $crlf $+ CharV: 1-3 digits $chr(9) Any number from 1 to 255,io,Token - Seperator Information) }
if ($did == 204) { noop $input(The string stands for the line of text which is to be evaluated using the seperator,io,Token - String Information) }
if ($did isnum 301-302) { gtk.checksep }
if ($did == 401) { if ($did(401).seltext) { did -ra $dname 402 $+($chr(36),gettok,$chr(40),$did(201),$chr(44),$remove($gettok($did(401).seltext,1,32),[,]),$chr(44),$iif($did(gtk,301).state,$asc($did(gtk,202)),$did(gtk,202)),$chr(41)) } }
if ($did == 403) { if ($did(402)) { clipboard $v1 | did -b $dname 403 | .timer 1 1 did -e $dname 403 } | else { noop $input(No text to copy. Please select a token from the list,wo,Token - Error) } }
}
on *:dialog:gtk:edit:*: {
if ($did == 201) { if ($did(202)) { gtk.compile | did -ra $dname 402 $+($chr(36),gettok,$chr(40),$did(201),$chr(44),$remove($gettok($did(401).seltext,1,32),[,]),$chr(44),$iif($did(gtk,301).state,$asc($did(gtk,202)),$did(gtk,202)),$chr(41)) } }
if ($did == 202) { gtk.checksep | if ($did(201)) { gtk.compile | did -ra $dname 402 $+($chr(36),gettok,$chr(40),$did(201),$chr(44),$remove($gettok($did(401).seltext,1,32),[,]),$chr(44),$iif($did(gtk,301).state,$asc($did(gtk,202)),$did(gtk,202)),$chr(41)) } }
}
alias -l gtk.checksep {
if ($did(gtk,301).state) { if ($len($did(gtk,202)) > 1) { did -ra gtk 202 $left($did(gtk,202),1) } }
elseif ($did(gtk,302).state) { if ($did(gtk,202) !isnum 1-255 || $len($did(gtk,202)) > 3) { did -ra gtk 202 $left($did(gtk,202),$calc($len($did(gtk,202)) - 1)) } }
else { did -r $dname 202 }
}
alias -l gtk.compile {
var %x = 1, %nt = $numtok($did(gtk,201),$iif($did(gtk,301).state,$asc($did(gtk,202)),$did(gtk,202))) | did -r gtk 401
if (%nt) { while (%x <= %nt) { did -a gtk 401 $+([,%x,]) $gettok($did(gtk,201),%x,$iif($did(gtk,301).state,$asc($did(gtk,202)),$did(gtk,202))) | inc %x } }
did -z gtk 401
}
Haha yeah, it's quite noticable! lol. Hawkee has helped me along a lot has to be said! .NET is brilliant if you're not a Windows-hater, too many people pass on it because they are so single minded. I use .net in class so it's great for practice. PHP skills i developed on my own because i was into webdesign at the time.
If you need any help drop me an email sometime, be happy to help :)