mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2004
Posts: 423
C
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Aug 2004
Posts: 423
hello again,

i seem to be having a mental block with this one..

i'm trying to load a multi-item variable with a coma( $CHR(44) ) as the delimiter, into a dialog listbox on init. but for some reason this is killing me .........

can someone help me out here please????

thanks in advance

Joined: Dec 2004
Posts: 81
N
Babel fish
Offline
Babel fish
N
Joined: Dec 2004
Posts: 81
what's the code?

Joined: Aug 2004
Posts: 423
C
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Aug 2004
Posts: 423
well, i really didn't think i needed to post the code, was just asking for a generalized answer....(silly me). so, here is the code :
Code:
 dialog ascii_table {
  title $amlogo Ascii  Table ( special characters) 
  size -1 -1 220 200
  option dbu
  list 1, 11 21 26 112, sort
  list 2, 62 50 26 104, sort
  list 3, 116 63 26 78, sort
  list 4, 172 31 26 100, sort
  button "Add", 5, 42 180 37 12
  button "Close", 6, 119 180 37 12, ok
  box "Upper Case", 7, 4 4 41 157
  box "Lower Case", 8, 56 36 38 126
  box "Numeric", 9, 109 29 40 133
  box "Other", 10, 160 5 50 157
}
on *:LOAD:{
  var %ascii.ucase À,Á,Â,Ã,Ä,Å,ß,Ç,Ð,È,É,Ê,Ê,Ë,Ì,Í,Î,Ï,Ñ,Ò,Ó,Ô,Õ,Ö,Ù,Ú,Û,Ü,Ý,¥
  var %ascii.lcase à,á,â,ã,ä,å,ç,è,é,ê,ë,ì,í,î,ï,ñ,ò,ó,ô,õ,ö,ù,ú,û,ü,ý,ÿ
  var %ascii.numeric  ø,¹,²,³,×,÷,¢,£,¼,½,¾
  var %ascii.other ª,º,°,©,®,¡,¿,¤,§,«,»,¬,±,µ,¶,þ,Þ,Æ,æ,ð,¸,‘,’ 
}
on *:dialog:ascii_table:*:*:{
  if ($devent == init) {
    
  }
}
 


i just need to put the %vars in the appropriate lists thats all.

Joined: Dec 2004
Posts: 81
N
Babel fish
Offline
Babel fish
N
Joined: Dec 2004
Posts: 81
You're problem is this:

Code:
on *:LOAD:{
var %ascii.ucase À,Á,Â,Ã,Ä,Å,ß,Ç,Ð,È,É,Ê,Ê,Ë,Ì,Í,Î,Ï,Ñ,Ò,Ó,Ô,Õ,Ö,Ù,Ú,Û,Ü,Ý,¥
var %ascii.lcase à,á,â,ã,ä,å,ç,è,é,ê,ë,ì,í,î,ï,ñ,ò,ó,ô,õ,ö,ù,ú,û,ü,ý,ÿ
var %ascii.numeric  ø,¹,²,³,×,÷,¢,£,¼,½,¾
var %ascii.other ª,º,°,©,®,¡,¿,¤,§,«,»,¬,±,µ,¶,þ,Þ,Æ,æ,ð,¸,‘,’
}


You're making those variables local not global. Therefore their only avaliable within that event and not for later use. Instead of using the VAR command use SET which will make them global and for later use.

Last edited by nycdiesel; 20/01/05 07:32 PM.
Joined: Aug 2004
Posts: 423
C
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Aug 2004
Posts: 423
ooohhhhhhhhhhhhhh i thought that they could be used anywhere as long as it's within the script... crazy

thanks

Joined: Dec 2004
Posts: 81
N
Babel fish
Offline
Babel fish
N
Joined: Dec 2004
Posts: 81
Well not exactly, just within the alias/popup/event within the script. You're welcome.

Joined: Aug 2004
Posts: 423
C
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Aug 2004
Posts: 423
ok, i've fixed my variable issue............. now i have a couple more questions.... here's what i have now (soory for the long code) :
Code:
 on *:start:{
  .hmake amacros 100
  if ($isfile(/amshdir(amsacros.hsh))) {
    .hload amacros $amshdir(amsacros.hsh)
  }
  else {
    /amsacros.start
    .hsave -o amacros dat\hsh\amsacros.hsh
  }
}
on *:EXIT: {
  .hsave -o amacros dat\hsh\amsacros.hsh
  .hfree amacros
}

on *:INPUT:*:{
  if ( $left($1,1) != / ) { acro $1- }
}
alias -l acro {
  var %i = $getacro($1-)
  if (%i) {
    msg $active %i
    halt
  }
}
alias -l getacro {
  if (!$hget(amacros)) { return }
  var %i = 1
  var %r
  while ($gettok($1-,%i,32)) {
    var %j = $v1
    if ($hget(amacros,%j)) { %j = $v1 }
    %r = %r %j
    inc %i
  }
  return %r
}
alias amshdir return (",$mircdirdat\hsh\,$1,")

alias amsacros.start {
  .hadd amacros afk Away From Keyboard
  .hadd amacros brb Be Right Back
  .hadd amacros gtg Got To Go
  .hadd amacros lol Laughing Out Loud
  .hadd amacros ttyl Talk To You Later
}

dialog acro_test {
  title "$amlogo ACRONYMS"
  size -1 -1 314 200
  option dbu
  list 1, 16 64 82 107, size vsbar
  edit "", 3, 16 46 82 10
  edit "", 4, 147 46 150 10
  list 2, 147 64 149 107, size vsbar
  button "Add Acro", 5, 91 25 37 9
  button "Del Acro", 6, 133 25 37 9
  text "Input TexT", 7, 41 35 27 8
  text "Output TexT", 8, 208 35 32 8
  text "A", 9, 120 56 4 8
  text "C", 10, 120 69 5 7
  text "R", 11, 120 81 5 7
  text "O", 12, 120 93 5 7
  text "N", 13, 120 105 4 7
  text "Y", 14, 120 117 4 8
  text "M", 15, 120 129 5 8
  text "S", 16, 120 141 4 8
  button "Okay", 17, 104 186 37 12, ok
  button "Ascii Table", 18, 111 13 37 9
}

on *:dialog:acro_test:*:*: {
  if ($devent == init) {
    if !$hget(amacros) { hamke amacros 100 | hload amacros $amshdir(amsacros.hsh) }
    var %x = 1
    while $hget(amacros,%x).item {
      did -a $dname 1 $v1
      inc %x
    }
    var %y = 1
    while $hget(amacros,%y).data {
      did -a $dname 2 $v1
      inc %y
    }
  }
  if ($devent == sclick) {
    if ($did == 5) {
      if ($hget(amacros)) {
        hadd amacros $did($dname,3).text $did(acro_test,4).text
        did -a acro_test 1 $did($dname,3).text
        did -a acro_test 2 $did($dname,4).text 
        did -r $dname 3,4
      }
    }
    if ($did == 6) {
      if ($did(acro_test,1).sel) {
        if ($hget(amacros)) {
          set %line $did(acro_test,1).sel
          hdel amacros $did(acro_test,1).seltext
          did -d acro_test 1 %line
          did -d acro_test 2 %line
        }
      }
    }
    if ($did == 18) { odialog ascii_table ascii_table }
  }
}
dialog ascii_table {
  title $amlogo Ascii  Table ( special characters) 
  size -1 -1 220 200
  option dbu
  list 1, 11 21 26 112 
  list 2, 62 50 26 104 
  list 3, 116 63 26 78
  list 4, 172 31 26 100
  button "Add", 5, 42 180 37 12
  button "Close", 6, 119 180 37 12, ok
  box "Upper Case", 7, 4 4 41 157
  box "Lower Case", 8, 56 36 38 126
  box "Numeric", 9, 109 29 40 133
  box "Other", 10, 160 5 50 157
}
on *:dialog:ascii_table:*:*:{
  if ($devent == init) {
    didtok $dname 1 44 %ascii.ucase
    didtok $dname 2 44 %ascii.lcase
    didtok $dname 3 44 %ascii.numeric
    didtok $dname 4 44 %ascii.other
    /set %ascii.ucase À,Á,Â,Ã,Ä,Å,ß,Ç,Ð,È,É,Ê,Ê,Ë,Ì,Í,Î,Ï,Ñ,Ò,Ó,Ô,Õ,Ö,Ù,Ú,Û,Ü,Ý,¥ 
    /set %ascii.lcase à,á,â,ã,ä,å,ç,è,é,ê,ë,ì,í,î,ï,ñ,ò,ó,ô,õ,ö,ù,ú,û,ü,ý,ÿ
    /set %ascii.numeric  ø,¹,²,³,×,÷,¢,£,¼,½,¾
    /set %ascii.other ª,º,°,©,®,¡,¿,¤,§,«,»,¬,±,µ,¶,þ,Þ,Æ,æ,ð,¸,‘,’
  }
  if ($devent == sclick) {
    if ($did == 5) { 
      if $did(1).seltext || $did(2).seltext || $did(3).seltext || $did(4).seltext {  
        did -a acro_test 4 $v1
      } 
    } 
  }
  if ($devent == close) {
    unset %ascii.*
  }
}
 


i've posted everything for show... but my questions are:
1. i'm having trouble with the ascii dialog portion of the script. i want to be able to select whatever in the listboxes and add them to editbox 4 of the acro_test dialog, right now it only adds the first item selected no matter what. how can i do this??
2. how would i be able to check to see if the ascii dialog is open, and if it is close it when the acro dialog is closed??

Joined: Dec 2002
Posts: 15
I
idk Offline
Pikka bird
Offline
Pikka bird
I
Joined: Dec 2002
Posts: 15
1.
Code:
if ($devent == sclick) {
  if ($did == 5) { 
    if $did(1).seltext || $did(2).seltext || $did(3).seltext || $did(4).seltext {  
      did -a acro_test 4 $v1
      [color:blue]did -u ascii_table 1,2,3,4[/color]
    } 
  } 
}

2. use $dialog(ascii_table) to see if its open or not
Code:
  
if ($dialog(ascii_table)) do something if open
else do something if not open

Last edited by idk; 21/01/05 10:54 AM.
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Personally I would put an editbox in the second dialog, fill that from the lists (either dclick or button) and use the add button to transfer the final result to the other dialog.

Also
  • if ($devent == init) {
    didtok $dname 1 44 À,Á,Â,Ã,Ä,Å,ß,Ç,Ð,È,É,Ê,Ê,Ë,Ì,Í,Î,Ï,Ñ,Ò,Ó,Ô,Õ,Ö,Ù,Ú,Û,Ü,Ý,¥
    didtok $dname 2 44 à,á,â,ã,ä,å,ç,è,é,ê,ë,ì,í,î,ï,ñ,ò,ó,ô,õ,ö,ù,ú,û,ü,ý,ÿ
    didtok $dname 3 44 ø,¹,²,³,×,÷,¢,£,¼,½,¾
    didtok $dname 4 44 ª,º,°,©,®,¡,¿,¤,§,«,»,¬,±,µ,¶,þ,Þ,Æ,æ,ð,¸,‘,’
    }

You don't need to set vars (which should happen before you didtok them btw) smile

Joined: Aug 2004
Posts: 423
C
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Aug 2004
Posts: 423
Quote:
Personally I would put an editbox in the second dialog, fill that from the lists (either dclick or button) and use the add button to transfer the final result to the other dialog.


you mean like a preview box(edit) type thing? i can appreciate that, so i can see what i've chosen before had... hmmmmmm.... thats not a bad idea...

Quote:
You don't need to set vars (which should happen before you didtok them btw)


i realised that after the fact.... that was just a dumb mistake, but thanks for point that out though Iori .. also i didn't realize i could just input the characters using the $didtok command.. thanks for that tip as well. grin

Joined: Aug 2004
Posts: 423
C
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Aug 2004
Posts: 423
thanks idk,

i didn't know you could use the -u switch for that.. but makes sense.

both worked like a charm!!!!

big heaps of thanks grin

Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
you mean like a preview box(edit) type thing?
Yeah, much the same as charmap.exe has. smile

Joined: Aug 2004
Posts: 423
C
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Aug 2004
Posts: 423
i've never seen charmap.exe ....... frown

Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Then look at it laugh
/run charmap.exe

Joined: Aug 2004
Posts: 423
C
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Aug 2004
Posts: 423
well,
in any case this is what i've done withe the second dialog:
Code:
dialog ascii_table {
  title $amlogo Ascii  Table ( special characters) 
  size -1 -1 218 177
  option dbu
  list 1, 11 20 26 112, sort
  list 2, 54 49 26 104, sort
  list 3, 130 49 26 104, sort
  list 4, 177 21 26 112, sort
  button "Add", 5, 90 73 29 9
  button "Close", 6, 87 166 37 9, ok
  box "Upper Case", 7, 4 4 41 157
  box "Lower Case", 8, 49 35 38 126
  box "Numeric", 9, 122 35 40 126
  box "Misc", 10, 166 4 50 157
  text "A", 11, 68 11 4 8
  text "S", 12, 76 13 4 8
  text "C", 13, 83 12 4 8
  text "I", 14, 90 11 2 8
  text "I", 15, 96 13 2 8
  text "T", 16, 104 12 4 8
  text "A", 17, 111 11 4 8
  text "B", 18, 118 13 4 8
  text "L", 19, 125 12 3 8
  text "E", 20, 132 11 4 8
  edit "", 21, 97 86 15 10
  text Double Click On Characters, 22, 68 22 68 8
}
on *:dialog:ascii_table:*:*:{
  if ($devent == init) {
    didtok $dname 1 44 À,Á,Â,Ã,Ä,Å,ß,Ç,Ð,È,É,Ê,Ê,Ë,Ì,Í,Î,Ï,Ñ,Ò,Ó,Ô,Õ,Ö,Ù,Ú,Û,Ü,Ý,¥
    didtok $dname 2 44 à,á,â,ã,ä,å,ç,è,é,ê,ë,ì,í,î,ï,ñ,ò,ó,ô,õ,ö,ù,ú,û,ü,ý,ÿ
    didtok $dname 3 44 ø,¹,²,³,×,÷,¢,£,¼,½,¾
    didtok $dname 4 44 ª,º,°,©,®,¡,¿,¤,§,«,»,¬,±,µ,¶,þ,Þ,Æ,æ,ð,¸,‘,’
  }
  if ($devent == sclick) {
    if ($did == 5) { 
      did -a acro_test 4 $did(21)
      did -r $dname 21
    } 
  } 
  if ($devent == dclick) {
    if $did(1).seltext || $did(2).seltext || $did(3).seltext || $did(4).seltext {  
      did -ra $dname 21 $v1 
      did -u $dname 1,2,3,4
    }
  }
}


it's been tested and works fine grin

i just have one other question though.....
when didtok tokenizes the characters it puts a couple of chars out of place.... the ß and ¥ in listbox 1. why is this? and can it be resolved??

Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
It isn't /didtok, its because your editboxes are sorted wink

Joined: Aug 2004
Posts: 423
C
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Aug 2004
Posts: 423
DOH!!!!!!!!!!!!!

thanks for pointing out obvious.............(too bad i didn't see that blush )


Link Copied to Clipboard