mIRC Home    About    Download    Register    News    Help

Print Thread
#144380 09/03/06 09:52 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
someone that can spot any error in this code? :tongue:
Code:
alias wperform {
  if (%tmp.nwork != $null) {
    if (%tmp.nwork == Choose your network) { goto end }
    var %w = 1, %file = $+(",$mircdir/files/perform/ $+ %tmp.nwork $+ .tmp ,")
    write -c %file
    while $did(perform,6,%w) {
      write %file $v1
      inc %w
    }
    :end
  }
}

%tmp.nwork is set true a dialog, and it have the network name, the problem i have is that it wont write to the file "create the file". and the error i get is:

* /write: unable to open 'C:\mirc\files\perform\IRCnet.tmp' (line 86, r7.mrc)
:tongue:


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
#144381 09/03/06 09:55 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Does the files\perform\ directory exist?

#144382 09/03/06 09:56 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
yes it does.. and i dubble checked that befor post here.. :tongue:

--------

Edit

Strange behavior, i created the folder "perform", then i just tryed to use the dialog, and it didnt work, then i restarted mirc, and the foldre was gone "perform", so i created it again, now it work ok ?

Last edited by sparta; 09/03/06 10:05 PM.

if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
#144383 09/03/06 10:09 PM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
You just need to add a check (and remedy) in case the folder doesn't exist. Something like this:

Code:
if (!$isdir(<your\dir\here>)) { echo 4 -s No such dir | return }


OR

Code:
if (!$isdir(<your\dir\here>)) mkdir <your\dir\here> 
if (!$isdir(<your\dir\here>)) { echo 4 -s Unable to create dir | return }


-genius_at_work

#144384 09/03/06 10:11 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Thnx, i will try play with ur code.. smile


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
#144385 09/03/06 10:20 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
That still won't work in all cases (eg: you try to create c:\x\y\ when c:\x\ doesn't exist).

You could use something like this:

Code:
alias mkdirex {
  var %i = 2, %dir
  while (%i <= $numtok($1-,92)) {
    %dir = $gettok($1-,1- $+ %i,92)
    if (!$isdir(%dir)) .mkdir $qt(%dir)
    inc %i
  }
}

#144386 09/03/06 11:54 PM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Hmm.. I guess mkdir doesn't support recursive dir creation. Maybe that would be a good feature suggestion.

/mkdir -r \some\new\dir

-genius_at_work


Link Copied to Clipboard