tglogo.png

Downloading File

Filename: Token Simplifier [v1.1]
; ===============
; Token Simplifier
; By:Jonesy44
; Version:1.1
; ===============
alias -l gtk.version return 1.1
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 "Delimiter:", 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
  edit "", 402, 70 201 385 20, read
  button "Cb.", 403, 455 200 30 21
}
on *:dialog:gtk:sclick:*: {
  if ($did == 203) { noop $input(The delimiter 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 - Delimiter 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 } }
}

Related Files

by FordLawnmower
by FordLawnmower
by FordLawnmower

Please note that on our website we use cookies necessary for the functioning of our website, cookies that optimize the performance. To learn more about our cookies, how we use them and their benefits, please read our Cookie Policy.
I Understand