mIRC Homepage
Posted By: MTec89 listbox - mdx - 30/08/04 08:13 PM
how can i find out what line was double clicked in the listbox?
Posted By: Zyzzyx26 Re: listbox - mdx - 30/08/04 09:16 PM
If you mean a listbox in a dialog, $did(id).sel will return the line number of the selected line. I'm assuming that, to double click a line, you automatically select on your first click.

You could use the dclick event together with the $did(id).sel, I think it can work smile

Good luck,
Zyzzyx

Edit: didnt see it was MDX - I know nothing about ii, so the above might not work smirk
Posted By: MTec89 Re: listbox - mdx - 30/08/04 09:33 PM
yeah, im getting a line that returns like this:


i only want the script path.
Code:
on *:dialog:LSI:dclick:1: {
  var %sv $did(1).seltext
  var %sv $replace(%sv,0 +fs 0 0 0 ,)
  var %sv $replace(%sv, 	+fs 0 0 0 ,)
  var %sv $replace(%sv,$chr(32),)
  ;run notepad.exe
  echo n $+(",$mircdir,%sv,")
}


edit: $did(1).seltext returns unedited like this:
Code:
0 +fs 0 0 0 lsi\lsi.mrc 	+fs 0 0 0 34 	+fs 0 0 0 a 	+fs 0 0 0 d 	+fs 0 0 0 v 	+fs 0 0 0 1.43
Posted By: Zyzzyx26 Re: listbox - mdx - 30/08/04 09:40 PM
Hmm... i've never seen columns in a listbox before.. Is that done with Mdx or does mIRC support this on its own?

If it is Mdx, as I said, I know zero about it... sorry smirk
Posted By: MTec89 Re: listbox - mdx - 30/08/04 09:43 PM
mdx. i dont need you to know MDX, i just need to get the path from the glob of text i get returned.
Posted By: Coolkill Re: listbox - mdx - 30/08/04 10:00 PM
Use, $gettok() with $did(1).seltext, as the items are seperated by a tab. (chr(9))

Eamonn.
Posted By: Zyzzyx26 Re: listbox - mdx - 30/08/04 10:16 PM
Hmm.. you could use $did(id).text to get the line's text.

About the files' path, the only pattern I see is this:

C:\mirc\mIRC-\blabla.extTheRestThatYouDontWant.

Path\to\file.extCrapYouDontWant

You could use a $gettok with C = 46 (.) and return:
$gettok(WholePath,1,46) -> 1st part of the path, up to the filename, but NOT extension = C:\mirc\mIRC-\blabla
$gettok(WholePath,2,46) -> 2nd part, including extension and the crap you dont want to show. = abcTheRestThatYouDontWant.

Now, get that crap (Eg: mrc34adv1.43), return only the 3 first chars, which correspond to the extension --> $left($gettok(WholePath,2,46),3) = mrc

After that, add the dot (.) in the middle:
$+($gettok(WholePath,1,46),$chr(46),$left($gettok(WholePath,2,46),3))

The above *should* work in all the extensions are 3 lettered. I am pretty sure that a regex would fit you better, but I also know zero about them.

Hole this helps smile
Zyzzy.
Posted By: MTec89 Re: listbox - mdx - 30/08/04 11:14 PM
wink thanks
Posted By: Zyzzyx26 Re: listbox - mdx - 30/08/04 11:17 PM
yw smile
Posted By: Coolkill Re: listbox - mdx - 31/08/04 11:08 AM
That would of course break, if the filename has multiple dots; i.e. this is my filename.ext.txt or if the extention happens to not be 3 characters.

As mentioned above the line is seperated by tabs, $chr(9) as a result the following should work fine;

$gettok($gettok($did([color:red]$dname,$did).seltext,1,9),6-,32)[/color]

Where, $dname should be the dialog name and $did should be the listviews ID number, if your not executing it in an ON DIALOG, if you are executing the code in an ON DIALOG then leave it as it is, placing it of course in the correct part of the ON DIALOG.

Eamonn.
© mIRC Discussion Forums