mIRC Home    About    Download    Register    News    Help

Print Thread
#88550 29/06/04 02:46 AM
Joined: Feb 2004
Posts: 119
D
da_hype Offline OP
Vogon poet
OP Offline
Vogon poet
D
Joined: Feb 2004
Posts: 119
they ascii for a space is $chr(32) right? anyone know what the $chr is for a double space?

#88551 29/06/04 06:03 AM
Joined: Feb 2004
Posts: 119
D
da_hype Offline OP
Vogon poet
OP Offline
Vogon poet
D
Joined: Feb 2004
Posts: 119
this is an example of what i'm trying to do. i want to remove double spaces from file names.. and rename them.

Code:
    if ($+($chr(32),$chr(32)) isin $nopath($1-)) && (!$isfile($+($nofile($1-),$replace($nopath($1-),$chr(95),$chr(32))))) { 
      .rename $1- $+(",$nofile($1-),$replace($nopath($1-),$+($chr(32),$chr(32)),$chr(32)),")
      echo -a 4:: Removed Double Spaces In 4::  $1- 
    }

#88552 29/06/04 06:06 AM
Joined: Feb 2004
Posts: 206
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Feb 2004
Posts: 206
$chr(32) $+ $chr(32)

Cheers

DK


Darwin_Koala

Junior Brat, In-no-cent(r)(tm) and original source of DK-itis!
#88553 29/06/04 06:34 AM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
alias noSpaces {
var %result
!.echo -q $regsub(doubleSpaces, $1-, /(\s+)/, $chr(32), %result)
return %result
}

I don't see how it's possible considering mIRC ignores double spaces anyways, but that's a little more simplistic.

[EDIT]
Actually, just to be clear, that will remove 2+ spaces in a row. Just thought I'd throw that in there incase you didn't want that.
[/EDIT]

Last edited by KingTomato; 29/06/04 06:40 AM.

-KingTomato
#88554 29/06/04 07:22 AM
Joined: Feb 2004
Posts: 119
D
da_hype Offline OP
Vogon poet
OP Offline
Vogon poet
D
Joined: Feb 2004
Posts: 119
sorry i'm not good with regex.. so what do i change?

Code:
alias _test {
  set %dir.ruang $sdir="Choose Folder That Has The Files You Want To Remove Spaces ( _ )? " 
  Carik.Ruang %dir.ruang
}
alias Carik.Ruang { var %ruang = $findfile($1-,*.*,0,Isi.Ruang $+(",$1-,")) }
alias Isi.Ruang { 
  if ($chr(95) isin $nopath($1-)) && (!$isfile($+($nofile($1-),$replace($nopath($1-),$chr(95),$chr(32))))) { 
    .rename $1- $+(",$nofile($1-),$replace($nopath($1-),$chr(95),$chr(32)),")
    echo -a 4:: Removed Spaces In 4::  $1- 
  }
if ($+($chr(32),$chr(32)) isin $nopath($1-)) && (!$isfile($+($nofile($1-),$replace($nopath($1-),$chr(95),$chr(32))))) {       
.rename $1- $+(",$nofile($1-),$replace($nopath($1-),$+($chr(32),$chr(32)),$chr(32)),")     
 echo -a 4:: Removed Double Spaces In 4::  $1-    
 }
}

#88555 29/06/04 08:02 AM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
alias nodblsp return $findfile($$1-,$+(*,$chr(32),$chr(32),*),0,1,.rename $1 $+(",$longfn($1),")).shortfn

Use it as a command...

//nodblsp c:\folder\ | echo Fixed $result files.

...or as an identifier:

//echo Fixed $nodblsp(c:\folder\) files.


Link Copied to Clipboard