mIRC Home    About    Download    Register    News    Help

Print Thread
#213916 11/07/09 08:44 PM
Joined: Jun 2009
Posts: 96
V
Babel fish
OP Offline
Babel fish
V
Joined: Jun 2009
Posts: 96
if i do

//echo -s $findfile($mircdir,*.ini,0,echo -s $deltok($nopath($1-),-1,46))

i get bunch of INI's listed
but how to stop listing of last info given, which is
how many files there are ?

so its like

01.ini
02.ini
03.ini
04.ini
4

that "4", how to remove it from showing in data ?

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
$findfile itself return how many file he found, you're using echo $findfile() so it echoes you the value, don't use echo to call $findfile, use /noop


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Don't //echo the result of $findfile, which returns the number of matches.

/help /noop


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Jun 2009
Posts: 96
V
Babel fish
OP Offline
Babel fish
V
Joined: Jun 2009
Posts: 96
hmm
wonder if anyone can help me a bit...

i have folder in which are .txt files
they are formated as "yyyy-mm-dd name" (without quotes)
like 2009-07-25 my text.txt
-

now i have dialog with List control and Edit control,
on init of dialog an alias uses findfile to GET list of all
files in that folder and loads them on List control by cutting
the date out and leaving only on List control the Name of file
-
Edit control is just for editing those files...
-
but my problem is, when i try to loadbuf of those files
i cant, because loadbuf is based on did.sel, and since selected
text is cut out (no date), mirc cannot loadbuf the filename smile

so can $findfile be used to find file simmiliar in names
to find a match (and loadbuf's me) ? :P

Code:
the load files:
---------------
"notes" is dialog name
"ID 3 is list control"

alias -l loadnotes { 
  did -r notes 3
  var %tempnotes $qt( $+ $findfile($mircdirnotes,*.txt,did -a notes 3,did -a notes 3 $gettok($deltok($nopath($1-),-1,46),2-,32)))
  did -ra notes 6 $findfile($mircdirnotes,*.txt,0) notes
}



here i tried to mix something but i screwed it up :P

Code:
List Control click (to loadbuf content)
----------------------------------------
"ID 3 is List control"
"ID 4 is Edit control where content of file goes"

on *:dialog:notes:sclick:*:{ 
  if ($did == 3) { 
    if ($did($did).sel == 0) { return }
    else { 
      loadbuf -ro $dname 4 $qt($nopath($findfile($mircdirnotes,*.txt,0,$deltok($mircdirnotes\ $+ $did($did).seltext $+ .txt),-1,46),-1,46))
    }
  }
}



any help would be apreciated smile

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Try this in place of your loadbuf line
Code:
loadbuf -ro $dname 4 $findfile(notes,$+(*,$did($did).seltext,.txt),0)


Joined: Jun 2009
Posts: 96
V
Babel fish
OP Offline
Babel fish
V
Joined: Jun 2009
Posts: 96
* /loadbuf: unable to open 'D:\mirc\1' (line 1162, dialogs.mrc)

(1162 is loadbuf line) :P

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
use :

Code:
on *:dialog:notes:sclick:*:{ 
  if ($did == 3) { 
    if ($did($did).sel == 0) { return }
    else { 
noop $findfile($mircdirnotes,*.txt,$did(3).sel,loadbuf -ro $dname 4 $qt($1-))
    }
  }
}
/loadbuf -ro $dname 4 $findfile($mircdirnotes,*.txt,$did(3).sel) instead of the /noop will work too

Last edited by Wims; 12/07/09 04:05 PM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jun 2009
Posts: 96
V
Babel fish
OP Offline
Babel fish
V
Joined: Jun 2009
Posts: 96
this is close

now i get this (for both cases)

* /loadbuf: unable to open 'D:\mirc\notes\2009-07-11' (line 1162, dialogs.mrc)

so i guess it needs something to bind name with space to this date to get it complete smile (sorry if i sound like stupid hehe)

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
did you used the /loadbuf or the /noop ? in the /loadbuf, I've missed a $qt(), looks like it's the problem here, updated code :


Code:

Code:
on *:dialog:notes:sclick:*:{ 
  if ($did == 3) { 
    if ($did($did).sel == 0) { return }
    else { 
    noop $findfile($mircdirnotes,*.txt,$did(3).sel,loadbuf -ro $dname 4 $qt($1-))
    ;or you can use this : loadbuf -ro $dname 4 $qt($findfile($mircdirnotes,*.txt,$did(3).sel)) 
    }
  }
}


Edit : maybe you are on a version prior to mirc 6.17 and you don't have the $qt, either use $shortfn or make a basic $qt alias like this
Code:
alias qt return $+(",$1-,")


Last edited by Wims; 12/07/09 04:27 PM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jun 2009
Posts: 96
V
Babel fish
OP Offline
Babel fish
V
Joined: Jun 2009
Posts: 96
thanks, this works nice. smile

if i find any help needed with this hope i can post here inside this laugh

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
You can always reply to a topic if further information regarding that topic is required.
We do ask, however, that you not restart a topic that has been "closed" (ie: no messages) for a period of 6 months or more.

Joined: Jun 2009
Posts: 96
V
Babel fish
OP Offline
Babel fish
V
Joined: Jun 2009
Posts: 96
so im here again :P
but to keep all in 1 topic...

this is alias to load all those txt file names into dialog list

Code:
*ID 3 is listview

alias -l loadnotes { 
  did -r notes 3
    var %tempnotes $qt( $+ $sorttok($findfile($mircdirnotes,*.txt,did -a notes 3,did -a notes 3 $gettok($deltok($nopath($1-),-1,46),2-,32)),32,nr))
  did -ra notes 6 $sorttok($findfile($mircdirnotes,*.txt,0),32,nr) notes
}


and since all is loaded to list sorted by number (date)
i wish to it be sorted from newest to oldest
so i used $sorttok and reversed
but nothing is happening :P

any direction what i did wrong would be apreciated laugh


Last edited by vinifera; 15/07/09 10:03 AM.
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I don't believe you can do the sort you are wanting without changing the format of the date to a full numeric format.
Ex: July 15 2009 would have to be displayed, or have a reference to, the number 1247630400.
This is the $ctime equivalent of July 15 2009 12:00:00 am

Joined: Jun 2009
Posts: 96
V
Babel fish
OP Offline
Babel fish
V
Joined: Jun 2009
Posts: 96
ok

thanks for info ^^


Link Copied to Clipboard