mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2003
Posts: 106
L
Vogon poet
OP Offline
Vogon poet
L
Joined: Feb 2003
Posts: 106
when writing to a file using $mircdir $+ %filename and if $mircdir contains a space eg c:\program files\mirc\ then in fact the file does not receive the data and remains empty.
What is the solution to this problem?
thanks lerp


-
Just because it never happened doesn't mean it isn't true.
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
Try $+(",$mircdir,%filename,")

Joined: Feb 2003
Posts: 106
L
Vogon poet
OP Offline
Vogon poet
L
Joined: Feb 2003
Posts: 106
Yes, that works,thanks !
But why?


-
Just because it never happened doesn't mean it isn't true.
Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
Most commands that take a filename parameter require that quotes surround the path if it contains spaces. This does not apply to $identifiers however.

This is simply how Khaled coded it. For commands like /write, it is the only way to destinguish the filename from the data to be written to the file. Allthough /remove only has a file parameter, it too requires quoted paths.

Alternately, some users prefer doing $shortfn(path with spaces), which never needs quoting. Though I think it's yucky. smile

- Raccoon


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:

$shortfn(path with spaces), which never needs quoting. Though I think it's yucky.


Likely uses alot more processor time to deal with as well,
take the long name, of the first folder get its short filename, move on to the next subfolder and repeat, finally getting the shortfilename, it might be a internal to windows thing, but still has to be done, then when its used, i would liekly think windows has to work out the short to long ones again to get the file, (maybe not once you have the shortfn as win fat dir format at least had long and short filename entries, i dont know if ntfs does as well)

Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
$shortfn won't work if the file doesn't already exist either.

If the file is in $mircdir $+($mircdir,file.ext) you can also omit the $mircdir and use file.ext

Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
Unless $scriptdir != $mircdir in which case $mircdir would need to be used. grin


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Quote:
when writing to a file using $mircdir $+ %filename and if $mircdir contains a space

It doesn't matter an iota where $scriptdir points if you use $mircdir. grin

Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
Hmm, my mistake. I seem to remember the default path pointing to $scriptdir and not $mircdir, whenever a script existed outside of $mircdir. But it doesn't, so I remembered wrong. crazy

Omit $mircdir all you want. blush


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Just the opposite, if you use $scriptdir outside of a script (from commandline) it returns [ [ $mircdir ] ] smile


Link Copied to Clipboard