mIRC Home    About    Download    Register    News    Help

Print Thread
#98583 25/09/04 01:50 AM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
didnt find anything i could use in a search, so asking here.. i having a "list" in a dialog.. and now i want to set %vars in that list, the first line arent any problem:
Code:
    if ($did == 1) { set %var1 $input(Set $gettok(, 1, 32) Command,e,Set $gettok(, 1, 32) command,$gettok(, 11-, 32)) }

so much i figured out.. but how do i make it see that i click the seccond line in that list ? the list ID is 1.. but how does it catch when i click on line 2 - 3 - 4 and so on ?


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
#98584 25/09/04 02:06 AM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
I'm not sure I fully understood the question, but I'll give it a try. If you want to get the line selected, you can use $did(name,id,N).sel - if N = 0, then you get the number of selected lines. Therefore, $did(name,id,1).sel return the number of the 1st selected line. You can make a while loop with those 2 identifiers.

Hope this helps smile
Zyzzyx.


"All we are saying is give peace a chance" -- John Lennon
#98585 25/09/04 02:12 AM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
dont get it to work, still only takes the first line.. :tongue:


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
#98586 25/09/04 02:25 AM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
hmm.. wierd smirk I've got something similar here:
Code:
.
.
[color:green]; The line below checks to see if the selected lines are actually more than one.[/color]
if ($did(1,0).sel > 1) {
   var %i = $v1
[color:green]; Starting loop to delete the lines from the listbox.[/color]
   while (%i) {
[color:green]; %z is being set as the last (since its an inverted loop) selected line number.[/color]
     var %z = $did(1,%i).sel
[color:green]; The IF asks whether the text of line %z is equal to bla bla bla[/color]
     if ($did(1,%z).text == bla bla bla) { delete it | dec %i }
 }
 .
 .
I've omited another loop, but it wasn't relevant. The point is that you first have to set the line number for then get it's text with $did(name,id,N).text

Sorry if I misunderstood the matter smirk
Zyzzyx smile


"All we are saying is give peace a chance" -- John Lennon
#98587 25/09/04 02:45 AM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
that dont help me much when i dont understand what it does.. what i looking for is a explanation to this:
Code:
alias fkey { if (!$dialog(fkey)) { .dialog -m fkey fkey } }

dialog fkey {
  title "Function Key's"
  size -1 -1 122 98
  option dbu
  list 1, 1 11 120 55, size
  button "Up", 2, 1 70 30 10
  button "Down", 3, 31 70 30 10
  text "Note: Identifiers and Variables may be used.", 8, 1 2 120 8, center
  button "Set", 4, 61 70 30 10
  button "Unset", 5, 91 70 30 10
  button "OK", 6, 24 84 30 10, default ok
  button "Cancel", 7, 69 84 30 10, cancel
}
on *:dialog:fkey:*:*: {
  if ($devent == init) {
    did -a fkey 1 F1 - %f1
    did -a fkey 1 F2 - %f2
  }
  if ($devent == sclick) {
    if ($did == 1) { set %f1 $input(Set $gettok(, 2, 32) Command,e,Set $gettok(, 2, 32) command,$gettok(, 11-, 32)) }
  }
}

didnt ad more FKeys cos i dont understand how to grab the info from F2 - F3 - F4 and so on.. :tongue:


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
#98588 25/09/04 03:03 AM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Here's a small example to get and set F*, Shift+F* and Ctrl+F* aliases:

Code:
alias fkey { if (!$dialog(fkey)) { .dialog -m fkey fkey } }

dialog fkey {
  title "Function Keys"
  size -1 -1 113 87
  option dbu
  list 1, -1 0 115 66, size vsbar
  edit "", 2, -1 66 115 10, autohs
  button "Set", 3, 72 77 20 10
  button "Unset", 4, 93 77 20 10
}
on *:dialog:fkey:*:*: {
  if ($devent == init) {
    var %i = 1
    while (%i <= 12) {
      did -a $dname 1 F $+ %i
      did -a $dname 1 Ctrl+F $+ %i
      did -a $dname 1 Shift+F $+ %i
      inc %i
    }
  }
  elseif ($devent == sclick) {
    if ($did == 3) { .alias $replace($$did(1).seltext,Ctrl+,C,Shift+,S) $$did(2) }
    elseif ($did == 4) { .alias $replace($$did(1).seltext,Ctrl+,C,Shift+,S) }
    did -r $dname 2
    if ($isalias($replace($$did(1).seltext,Ctrl+,C,Shift+,S)).alias) { did -a $dname 2 $v1 }
  }
}


Double click on a list and the code for the selected FKey will be in the editbox, you can then either modify or unset the function key, you don't need variables for this.


New username: hixxy
#98589 25/09/04 03:13 AM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Hmm...so the $gettok's are there to get the line's text? If so..
Code:
if ($devent == sclick) {
   if ($did == 1) {
[color:green]; Assuiming you only click in 1 line at the time...[/color]
    set $+(%,$remove($gettok($did(1).text,1,45),$chr(32))) $input(Set $gettok($did(1).text, 2, 32) Command,e,Set $gettok($did(1).text, 2, 32) command,$gettok($did(1).text, 11-, 32))
 }
}
This theoretically should get the line's text and use it on the $gettok.

Zyzzyx.


"All we are saying is give peace a chance" -- John Lennon
#98590 25/09/04 03:19 AM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
that one looks ok, but how can u sort the keys in a dialog like that? now they are mixed, even due i added "sort size" on the list options.. dosent look so good when it start with ctrlf1, then the next key are ctrlf10 :tongue: thats why i edited the lines by hand.. :tongue:


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
#98591 25/09/04 03:35 AM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
If you want it to sort like:

F1
F2
F3
etc
Ctrl+F1
Ctrl+F2
Ctrl+F3
etc
Shift+F1
Shift+F2
Shift+F3
etc

Then use:

Code:
    
var %i = 1
while (%i <= 12) {
  did -a $dname 1 F $+ %i
  inc %i
}
%i = 1
while (%i <= 12) {
  did -a $dname 1 Ctrl+F $+ %i
  inc %i
}
%i = 1
while (%i <= 12) {
  did -a $dname 1 Shift+F $+ %i
  inc %i
}



New username: hixxy
#98592 25/09/04 10:43 AM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
sorry, that didnt sort the list :tongue: thnx for trying cool

ops. my bad! it did work, , sort, extsel had to be removed.. thnx dude! blush grin

Last edited by sparta; 25/09/04 10:45 AM.

if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
#98593 25/09/04 11:18 AM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
yw smile


New username: hixxy
#98594 25/09/04 04:16 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Last problem with this one wink
Code:
on *:dialog:fkey:*:*: {
  if ($devent == init) {
    did -a $dname 2 Type command here.
    var %i = 1
    while (%i <= 12) {
      did -a $dname 1 F $+ %i
      inc %i
    }
    %i = 1
    while (%i <= 12) {
      did -a $dname 1 Ctrl+F $+ %i
      inc %i
    }
    %i = 1
    while (%i <= 12) {
      did -a $dname 1 Shift+F $+ %i
      inc %i
    }
  }
  elseif ($devent == sclick) {
    if ($did == 3) { .alias $replace($$did(1).seltext,Ctrl+,C,Shift+,S) $$did(2) }
    elseif ($did == 4) { .alias $replace($$did(1).seltext,Ctrl+,C,Shift+,S) | .alias $$did(1).seltext Not Bounded }
    did -r $dname 2
     [color:red]if ($isalias($replace($$did(1).seltext,Ctrl+,C,Shift+,S)).alias) { did -a $dname 2 $$did(1).seltext = $ifmatch }[/color] 
  }
}

that will only return the FKeys.. not the CTRL+Fkeys or SHIFT+Fkeys in the edit field "ID 2", it set the key as an alias tho. i didnt bother to paste the dialog when its already here a fev posts abow, can somone see what cosing my problem? :tongue: the line marked with red is the one i think get an error or somthing.. :tongue:

EDIT:
I using mirc version 6.03 , maybe som switch thats wrong for that version? any ideas at all ?? :tongue:

Last edited by sparta; 25/09/04 04:37 PM.

if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
#98595 26/09/04 11:29 AM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Code:
alias fkey { if (!$dialog(fkey)) { dialog -m fkey fkey } }

dialog fkey {
  title "Function Keys"
  size -1 -1 113 87
  option dbu
  list 1, -1 0 115 66, size vsbar
  edit "", 2, -1 66 115 10, autohs
  button "&Set", 3, 38 77 35 10
  button "&Unset", 4, 5 77 25 10
  button "&Close", 5, 83 77 25 10, ok
}
on *:dialog:fkey:*:*: {
  if ($devent == init) {
    did -a $dname 2 Type command here.
    var %i = 1
    while (%i <= 12) {
      did -a $dname 1 F $+ %i
      inc %i
    }
    %i = 1
    while (%i <= 12) {
      did -a $dname 1 Ctrl+F $+ %i
      inc %i
    }
    %i = 1
    while (%i <= 12) {
      did -a $dname 1 Shift+F $+ %i
      inc %i
    }
  }
  elseif ($devent == sclick) {   if ($did == 3) { .alias $replace($$did(1).seltext,Ctrl+,C,Shift+,S) $$did(2) }
    elseif ($did == 4) { .alias $replace($$did(1).seltext,Ctrl+,C,Shift+,S) | .alias $$did(1).seltext Not Bounded }
    did -r $dname 2
    if ($isalias($replace($did(1).seltext,Ctrl+,C,Shift+,S)).alias) { did -a $dname 2 $did(1).seltext = $ifmatch }
  }
}

this code works just fine with all FKEYS, but when it comes to CTRL+FKEYS and SHIFT+FKEYS it wont.. somone that have an idea what cosing this? it set the key in the alias, but dont show it to the edit box "ID 2". I add a url so you see what i mean, and once again. alias is just fine.. and the keys working as they should, just that it wont grab it and put it in the edit box.. confused :tongue: confused
!! click here !!

or somone that have any other idea how to bind the keys true a dialog? confused


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }

Link Copied to Clipboard