mIRC Homepage
Posted By: Rumieus $shortfn - 26/03/09 02:22 PM
: E:\Lagu\musics\INDONE~1\PROJEC~1\PROJEC~2.MP3
: E:\Lagu\musics\INDONE~1\PROJEC~1\PRD5B3~1.MP3
: E:\Lagu\musics\INDONE~1\PROJEC~1\PR02C7~1.MP3
: E:\Lagu\musics\INDONE~1\RATU-L~1.MP3
: E:\Lagu\musics\INDONE~1\Ten2Five - Aku untukmu.mp3
: E:\Lagu\musics\INDONE~1\Tipe-X\TID680~1.MP3
: E:\Lagu\musics\INDONE~1\Tipe-X\TIPE-X~3.MP3
: E:\Lagu\musics\INDONE~1\Tipe-X\TI7417~1.MP3
: E:\Lagu\musics\INDONE~1\Tipe-X\TI496F~1.MP3

does anyone know why $shortfn for E:\Lagu\musics\INDONE~1\Ten2Five - Aku untukmu.mp3 doesnt work?
and $exists return $false for that filename.
Posted By: Horstl Re: $shortfn - 26/03/09 03:18 PM
mIRC is retrieving the ShortFileNnames from windows (and they can be optionally disabled at some file systems), therefore a SFN for a nonexisting file is never "shortened". Now the file in question seems to be nonexistent - at least to mIRC, as you get $false for $exists(yourfile).
Did you double-check this file exists on that device?
Posted By: RoCk Re: $shortfn - 26/03/09 03:20 PM

Does the file actually exist? If it existed, there would have been a short file name created for it. Maybe the file exists but contains double spaces in the name? Double spaces would make it not work for $shortfn $exists and $isfile.
Posted By: Rumieus Re: $shortfn - 26/03/09 03:40 PM
of course the file exist.
I'm using whilefix.dll and $shortfn the result and echo it. I even type the file name and $exists return $false. how to correct this?
Posted By: Horstl Re: $shortfn - 26/03/09 03:44 PM
Double spaces may indeed be the cause for the confusion, and they are "lost" e.g. in commands via editbox. Create for example a file in $mircdir
Code:
test   test.txt

returning $false:
Code:
//echo -a $exists($mircdir $+ test   test.txt)
returning $true:
Code:
//echo -a $exists($mircdir $+ test $+ $str($chr(32),3) $+ test.txt)

Double spaces work fine for some internal commands (e.g. returnex, set, var):
Code:
//var %file = $findfile($mircdir,test*test.txt,1) | echo -a $shortfn(%file)

Here's a better explanation and some workarounds for display of consecutive spaces. If you want to create consecutive spaces in files, afaik you have to use fwrite or bwrite.
Posted By: Rumieus Re: $shortfn - 26/03/09 08:25 PM
E:\Lagu\musics\INDONE~1\Ten2Five - Aku untukmu.mp3

there is no double space in that file. why $shortfn $exists $file doesn't work for this file?
Posted By: argv0 Re: $shortfn - 26/03/09 11:06 PM
Are you sure that file actually exists? I've seen countless people claim that a file exists and mIRC is wrong when it in fact does not exist; double and triple check that the file is there with the *exact* spelling, byte for byte. Note that when a file does not exist $shortfn returns the full filename, meaning this looks more like a symptom of a non-existent file than a bug with mIRC, especially if that list of files above were all passed through $shortfn in some programmatic loop.

I've run a similar test on "C:\Progra~1\abcdefgh test 1 2 3.txt" and it worked fine:

Code:
alias testshortfn {
  var %file = C:\progra~1\test a b c d.txt
  echo -a $exists(%file) should be $false
  write -c $qt(%file)
  echo -a $exists(%file) should be $true
  echo -a $shortfn(%file) is the shortfn of the existing file
  .remove $qt(%file)
  echo -a $exists(%file) should be $false
  echo -a $shortfn(%file) is the shortfn of the non-exsiting file (should return full filename)
}
Posted By: Rumieus Re: $shortfn - 27/03/09 07:32 AM
E:\Lagu\musics\INDONE~1\Dewa19\DEWA-R~1.MP3
E:\Lagu\musics\INDONE~1\Dewa19\DEWA-S~1.MP3
E:\Lagu\musics\INDONE~1\Dewa19\DEWA19~2.MP3
E:\Lagu\musics\INDONE~1\Dewa19\DEWA19~1.MP3
E:\Lagu\musics\INDONE~1\Dewa19\DEWA19~3.MP3
E:\Lagu\musics\INDONE~1\Dewa19\DEWA-R~2.MP3
E:\Lagu\musics\INDONE~1\Dewa19\dewa.mp3
E:\Lagu\musics\INDONE~1\Dewa19\DEWA_1~1.MP3
E:\Lagu\musics\INDONE~1\KEHILA~1.MP3
E:\Lagu\musics\INDONE~1\OST_HE~2.MP3
E:\Lagu\musics\INDONE~1\OST_HE~3.MP3
E:\Lagu\musics\INDONE~1\OST_HE~4.MP3
E:\Lagu\musics\INDONE~1\OST_HE~1.MP3
E:\Lagu\musics\INDONE~1\PEREMP~1.MP3
E:\Lagu\musics\INDONE~1\PROJEC~1\PROJEC~2.MP3
E:\Lagu\musics\INDONE~1\PROJEC~1\PRD5B3~1.MP3
E:\Lagu\musics\INDONE~1\PROJEC~1\PR02C7~1.MP3
E:\Lagu\musics\INDONE~1\RATU-L~1.MP3
E:\Lagu\musics\INDONE~1\Ten2Five - Aku untukmu.mp3
E:\Lagu\musics\INDONE~1\Tipe-X\TID680~1.MP3
E:\Lagu\musics\INDONE~1\Tipe-X\TIPE-X~3.MP3
E:\Lagu\musics\INDONE~1\Tipe-X\TI7417~1.MP3
E:\Lagu\musics\INDONE~1\Tipe-X\TI496F~1.MP3
E:\Lagu\musics\INDONE~1\Tipe-X\TI9476~1.MP3
E:\Lagu\musics\INDONE~1\Tipe-X\TI80A6~1.MP3
E:\Lagu\musics\INDONE~1\Tipe-X\TIB27F~1.MP3
E:\Lagu\musics\INDONE~1\Tipe-X\TI14DB~1.MP3
~ [mp3] loading *.mp3 list completed, loading time = 0secs

if the file don't exists, why whilefix.dll found it as it search for *.mp3 filename. The $shortfn doesnt work for E:\Lagu\musics\INDONE~1\Ten2Five - Aku untukmu.mp3 only as you can see.
What's wrong and how to fix it?
Posted By: RoCk Re: $shortfn - 27/03/09 01:10 PM

Did you actually go to the file location and check to see if there are double spaces in the file name or are you just going by your script output? When displayed in mIRC, the double spaces are likely being removed.
Posted By: Horstl Re: $shortfn - 27/03/09 01:42 PM
If you don't have this problem with a loop based on internal commands of mIRC (no whilefix.dll) either the dll itself causes the issue, or you don't use it properly.
Please check the output of:
Code:
//noop $findfile(E:\Lagu\musics\INDONE~1\, *.mp3, 0, 2, ECHO -a File No. $findfilen : $shortfn($1-))
Posted By: Rumieus Re: $shortfn - 27/03/09 01:49 PM
the file exists! i even typed/rename the filename and $shortfn doesnt work.

//noop $findfile(E:\Lagu\musics\INDONE~1\, *.mp3, 0, 2, ECHO -a File No. $findfilen : $shortfn($1-))

File No. 1 : E:\Lagu\musics\INDONE~1\KEHILA~1.MP3
File No. 2 : E:\Lagu\musics\INDONE~1\OST_HE~2.MP3
File No. 3 : E:\Lagu\musics\INDONE~1\OST_HE~3.MP3
File No. 4 : E:\Lagu\musics\INDONE~1\OST_HE~4.MP3
File No. 5 : E:\Lagu\musics\INDONE~1\OST_HE~1.MP3
File No. 6 : E:\Lagu\musics\INDONE~1\PEREMP~1.MP3
File No. 7 : E:\Lagu\musics\INDONE~1\RATU-L~1.MP3
File No. 8 : E:\Lagu\musics\INDONE~1\Ten2Five - Aku untukmu.mp3
File No. 9 : E:\Lagu\musics\INDONE~1\Dewa19\@DEWA-~1.MP3
File No. 10 : E:\Lagu\musics\INDONE~1\Dewa19\DEWA-L~1.MP3
File No. 11 : E:\Lagu\musics\INDONE~1\Dewa19\DEWA-R~1.MP3
File No. 12 : E:\Lagu\musics\INDONE~1\Dewa19\DEWA-S~1.MP3
File No. 13 : E:\Lagu\musics\INDONE~1\Dewa19\DEWA19~2.MP3
File No. 14 : E:\Lagu\musics\INDONE~1\Dewa19\DEWA19~1.MP3
File No. 15 : E:\Lagu\musics\INDONE~1\Dewa19\DEWA19~3.MP3
File No. 16 : E:\Lagu\musics\INDONE~1\Dewa19\DEWA-R~2.MP3
File No. 17 : E:\Lagu\musics\INDONE~1\Dewa19\dewa.mp3
File No. 18 : E:\Lagu\musics\INDONE~1\Dewa19\DEWA_1~1.MP3
File No. 19 : E:\Lagu\musics\INDONE~1\PROJEC~1\PROJEC~2.MP3
File No. 20 : E:\Lagu\musics\INDONE~1\PROJEC~1\PRD5B3~1.MP3
File No. 21 : E:\Lagu\musics\INDONE~1\PROJEC~1\PR02C7~1.MP3
File No. 22 : E:\Lagu\musics\INDONE~1\Tipe-X\TID680~1.MP3
File No. 23 : E:\Lagu\musics\INDONE~1\Tipe-X\TIPE-X~3.MP3
File No. 24 : E:\Lagu\musics\INDONE~1\Tipe-X\TI7417~1.MP3
File No. 25 : E:\Lagu\musics\INDONE~1\Tipe-X\TI496F~1.MP3
File No. 26 : E:\Lagu\musics\INDONE~1\Tipe-X\TI9476~1.MP3
File No. 27 : E:\Lagu\musics\INDONE~1\Tipe-X\TI80A6~1.MP3
File No. 28 : E:\Lagu\musics\INDONE~1\Tipe-X\TIB27F~1.MP3
File No. 29 : E:\Lagu\musics\INDONE~1\Tipe-X\TI14DB~1.MP3
Posted By: RoCk Re: $shortfn - 27/03/09 01:53 PM

Type /remove "E:\Lagu\musics\INDONE~1\Ten2Five - Aku untukmu.mp3"

There, problem all fixed. smirk
Posted By: Horstl Re: $shortfn - 27/03/09 02:07 PM
Thanks, I just wanted to exclude third party code as possible source of error - not that I know now why on your system it's working for all files but one ... A wild guess would be some problem with the file table of this device
Posted By: starbucks_mafia Re: $shortfn - 27/03/09 02:35 PM
Code:
//noop $findfile(E:\Lagu\musics\INDONE~1\, *.mp3, 0, 2, ECHO -a File No. $findfilen : $1-).shortfn


That code will display a short filename regardless of any issues with multiple spaces in the long filename. If that doesn't show the short filename correctly then the file doesn't have a short filename assigned to it (which is a possibility on NTFS volumes).
© mIRC Discussion Forums