mIRC Home    About    Download    Register    News    Help

Print Thread
listbox - mdx #96227 30/08/04 08:13 PM
Joined: Jul 2003
Posts: 742
MTec89 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Jul 2003
Posts: 742
how can i find out what line was double clicked in the listbox?


http://MTec89Net.com
irc.freenode.net #MTec89Net
Re: listbox - mdx #96228 30/08/04 09:16 PM
Joined: Feb 2004
Posts: 714
Z
Zyzzyx26 Offline
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
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

Last edited by Zyzzyx26; 30/08/04 09:17 PM.

"All we are saying is give peace a chance" -- John Lennon
Re: listbox - mdx #96229 30/08/04 09:33 PM
Joined: Jul 2003
Posts: 742
MTec89 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Jul 2003
Posts: 742
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

Last edited by MTec89; 30/08/04 09:45 PM.

http://MTec89Net.com
irc.freenode.net #MTec89Net
Re: listbox - mdx #96230 30/08/04 09:40 PM
Joined: Feb 2004
Posts: 714
Z
Zyzzyx26 Offline
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
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


"All we are saying is give peace a chance" -- John Lennon
Re: listbox - mdx #96231 30/08/04 09:43 PM
Joined: Jul 2003
Posts: 742
MTec89 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Jul 2003
Posts: 742
mdx. i dont need you to know MDX, i just need to get the path from the glob of text i get returned.


http://MTec89Net.com
irc.freenode.net #MTec89Net
Re: listbox - mdx #96232 30/08/04 10:00 PM
Joined: Dec 2002
Posts: 788
C
Coolkill Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
Use, $gettok() with $did(1).seltext, as the items are seperated by a tab. (chr(9))

Eamonn.

Re: listbox - mdx #96233 30/08/04 10:16 PM
Joined: Feb 2004
Posts: 714
Z
Zyzzyx26 Offline
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
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.


"All we are saying is give peace a chance" -- John Lennon
Re: listbox - mdx #96234 30/08/04 11:14 PM
Joined: Jul 2003
Posts: 742
MTec89 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Jul 2003
Posts: 742
wink thanks


http://MTec89Net.com
irc.freenode.net #MTec89Net
Re: listbox - mdx #96235 30/08/04 11:17 PM
Joined: Feb 2004
Posts: 714
Z
Zyzzyx26 Offline
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
yw smile


"All we are saying is give peace a chance" -- John Lennon
Re: listbox - mdx #96236 31/08/04 11:08 AM
Joined: Dec 2002
Posts: 788
C
Coolkill Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
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.