mIRC Home    About    Download    Register    News    Help

Print Thread
$shortfn #210810 26/03/09 02:22 PM
Joined: Oct 2008
Posts: 36
Rumieus Offline OP
Ameglian cow
OP Offline
Ameglian cow
Joined: Oct 2008
Posts: 36
: 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.


There's if in LIFE

Re: $shortfn [Re: Rumieus] #210811 26/03/09 03:18 PM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
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?

Re: $shortfn [Re: Rumieus] #210812 26/03/09 03:20 PM
Joined: Dec 2002
Posts: 2,021
R
RoCk Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,021

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.

Last edited by RoCk; 26/03/09 03:23 PM.
Re: $shortfn [Re: RoCk] #210813 26/03/09 03:40 PM
Joined: Oct 2008
Posts: 36
Rumieus Offline OP
Ameglian cow
OP Offline
Ameglian cow
Joined: Oct 2008
Posts: 36
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?


There's if in LIFE

Re: $shortfn [Re: RoCk] #210815 26/03/09 03:44 PM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
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.

Re: $shortfn [Re: Horstl] #210822 26/03/09 08:25 PM
Joined: Oct 2008
Posts: 36
Rumieus Offline OP
Ameglian cow
OP Offline
Ameglian cow
Joined: Oct 2008
Posts: 36
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?


There's if in LIFE

Re: $shortfn [Re: Rumieus] #210835 26/03/09 11:06 PM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
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)
}


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: $shortfn [Re: argv0] #210859 27/03/09 07:32 AM
Joined: Oct 2008
Posts: 36
Rumieus Offline OP
Ameglian cow
OP Offline
Ameglian cow
Joined: Oct 2008
Posts: 36
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?


There's if in LIFE

Re: $shortfn [Re: Rumieus] #210864 27/03/09 01:10 PM
Joined: Dec 2002
Posts: 2,021
R
RoCk Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,021

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.

Re: $shortfn [Re: Rumieus] #210865 27/03/09 01:42 PM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
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-))

Re: $shortfn [Re: Horstl] #210866 27/03/09 01:49 PM
Joined: Oct 2008
Posts: 36
Rumieus Offline OP
Ameglian cow
OP Offline
Ameglian cow
Joined: Oct 2008
Posts: 36
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


There's if in LIFE

Re: $shortfn [Re: Rumieus] #210867 27/03/09 01:53 PM
Joined: Dec 2002
Posts: 2,021
R
RoCk Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,021

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

There, problem all fixed. smirk

Re: $shortfn [Re: Rumieus] #210868 27/03/09 02:07 PM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
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

Re: $shortfn [Re: Rumieus] #210870 27/03/09 02:35 PM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
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).


Spelling mistakes, grammatical errors, and stupid comments are intentional.