mIRC Home    About    Download    Register    News    Help

Print Thread
#8180 24/01/03 11:22 PM
Joined: Dec 2002
Posts: 15
N
Nakis Offline OP
Pikka bird
OP Offline
Pikka bird
N
Joined: Dec 2002
Posts: 15
i have noticed problems with the /rename command when files to be renamed are not in $mircdir and they contain spaces (no spaces in the path).
i tried $shortfn() but the problem persists.
the funny thing is that if i /echo $findfile() it's ok. but when it comes to /rename i get a 'no such file'.

i searched bug reports and feature suggestions and i didnt find any post related to this.
am i the only one having this problem?

thanks

#8181 24/01/03 11:57 PM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
Put quotes around each filename. eg: /rename "c:\folder name\file.ext" "c:\blah blah\moo.ext"


Spelling mistakes, grammatical errors, and stupid comments are intentional.
#8182 25/01/03 07:23 PM
Joined: Dec 2002
Posts: 15
N
Nakis Offline OP
Pikka bird
OP Offline
Pikka bird
N
Joined: Dec 2002
Posts: 15
thanks, really helped:)
but still got problems with double spaces...

Nakis

#8183 26/01/03 06:01 AM
Joined: Dec 2002
Posts: 54
S
Babel fish
Offline
Babel fish
S
Joined: Dec 2002
Posts: 54
ermzz thats couse mirc removes the extra spaces and makes 1 of it(can be verry anoying), but filenames shouldnt have double spaces anyway lol

#8184 26/01/03 11:09 AM
Joined: Dec 2002
Posts: 56
G
Babel fish
Offline
Babel fish
G
Joined: Dec 2002
Posts: 56
There is a scripted hack workaround for this, scroll down on this page here

mIRC's file and directory identifiers/routines should definatly be updated to overcome this problem though.

#8185 26/01/03 12:13 PM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
You might try using /copy $shortfn(filename) "Name you want it to be"


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#8186 26/01/03 02:19 PM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
It's not a problem of mirc's file and directory identifiers, it's the way the language is designed. mirc identifiers (including file/directory ones) can handle double spaces perfectly, as long as you find the way to pass the string to them. How to do that? By passing them other identifiers or variables; variables can store consecutive spaces.

/commands, otoh, cannot handle double spaces. But, in most cases, you can get around the problem. The best way to explain are these 3 examples:

1) You're acessing the mp3s with $findfile. In this case, $findfile().shortfn can be used.
//if $findfile($mp3dir,*.mp3,1).shortfn { .splay $ifmatch | echo -s The long filename contains $count($longfn($ifmatch),$str($chr(32),2)) double spaces.

2) You're using the File Select dialog ($sfile) to get the mp3. $shortfn() can be used here with no problems.
//.splay $$shortfn($sfile($mp3dir*.mp3))

3) You're reading the filenames from a text file (such as a playlist, *.m3u etc)
//.splay $$shortfn($read(playlist.m3u,n,1)
n is necessary here, so mirc doesn't re-evaluate the contents of the line read (which would result in consecutive spaces being stripped).

I couldn't get the page you linked to to load (the Internet crawls these days), so I'm sorry if some of the examples I posted here are already there.

Last edited by qwerty; 26/01/03 02:24 PM.

/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#8187 26/01/03 02:47 PM
Joined: Dec 2002
Posts: 56
G
Babel fish
Offline
Babel fish
G
Joined: Dec 2002
Posts: 56
Thanks a lot for the info. Whats the is the best method to use with $dll and /drawpic?

By the way, that website link was for ^Andy's forum. He too gave a nice explanation and example for solving this:

"To support double spaces in filenames, you have to check for them everywhere in the script. If you want to add support to an already existing script, you might have to rewrite the whole thing. Here are the identifiers I use:
Code:
  
alias -l fn { 
  if (* iswm $1) {    
    var %r = " $+ $replace($1-,$chr(32),?,\?,\:,??,*,?,$chr(32),*,*?,*,$chr(32),\:,\?)      
    if (" * iswm %r) return ? $+ $right(%r,-2) 
    return $right(%r,-1) 
  }
}
alias -l sfn return $shortfn($replace($1-,?,$chr(32)))


Any time you use a $findfile() you should output to a @window, and always use $fn() directly on built-in mIRC identifiers, like $line(). Whenever getting a filename from the output window, use $fn($line(@win,%x)) to change the leading or double spaces into ?'s. Whenever you want to use $shortfn() on a filename that might have ?'s from $fn(), you have to use $sfn() instead, because Windows 2000 won't return a short filename if you have ?'s inside $shortfn(). Windows 95 works fine, though."

#8188 26/01/03 06:08 PM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
"Whats the is the best method to use with $dll and /drawpic?"

I'm not sure what you mean here. Are you talking about passing filenames with possible double spaces to such commands/identifiers? If yes, the answer is to use $shortfn($identifier) with /drawpic. With $dll, you can use the long filename as well, even if it has double spaces, like $dll($identifier,function,params). $identifier would be $sfile(...), $findfile(<DIR>,*,1) , $line(@files,1) etc.

You can't replace $identifier with a direct string, like $shortfn(c:\blah<space><space>blah.bmp), it won't work. The idea is that filename strings that are to be passed in identifiers should come from another mirc identifier or variable, not typed in directly. If you want to use a filename with double spaces directly (ie hardcoded in the script) you have to use something like $shortfn($replace(c:\blah??blah.bmp,?,$chr(32))).


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com

Link Copied to Clipboard