Page 1 of 2
Rename Special modify _to Spaces script request
Posted: 23 Nov 2012 00:50
by JimXYUser
the Right-Click -> Rename Special has a
_ to Spaces
can some1 help me with a script that add more then just replacing the underscore? I wanted it to replace - and + as well, with space.
e.g. filename_has-this_and+this.exe
change to:
filename has this and this.exe
Can i extend the Rename Special to make the changes above? thanks.
Re: Rename Special modify _to Spaces script request
Posted: 23 Nov 2012 00:59
by j_c_hallgren
Hi and welcome to the XY forums!
Have you looked at using the existing "Search and Replace" variant instead? I believe that would do it...
Re: Rename Special modify _to Spaces script request
Posted: 23 Nov 2012 01:29
by highend
Have you looked at using the existing "Search and Replace" variant instead?
What he said^^
Just replace the space with a real one in the search and replace dialog window.
Re: Rename Special modify _to Spaces script request
Posted: 23 Nov 2012 02:24
by JimXYUser
where can i find "Search and Replace"? I only able to get F3 (quick search) and F12 (search location).
Re: Rename Special modify _to Spaces script request
Posted: 23 Nov 2012 02:26
by highend
Em, right click a file, Rename Special, Search and Replace...?
Re: Rename Special modify _to Spaces script request
Posted: 23 Nov 2012 02:33
by JimXYUser
thanks highend, for letting me know where is the "Search and Replace".
But by using "Search and Replace" i need to type in each time i wanted to do a replacement. would it be better if i have a script to do it.
Re: Rename Special modify _to Spaces script request
Posted: 23 Nov 2012 04:51
by j_c_hallgren
JimXYUser wrote:thanks highend, for letting me know where is the "Search and Replace".
I normally access it via File>Rename Special menu for the selected file
But by using "Search and Replace" i need to type in each time i wanted to do a replacement. would it be better if i have a script to do it.
Previously used S&R strings are stored and available via dropdown at right end so not much retyping....
Re: Rename Special modify _to Spaces script request
Posted: 23 Nov 2012 05:25
by JimXYUser
manage to find the answer, put this code in User -> Manage Commands -> location, then set a hot key.
now each time i select some files, press the hot key and all files will be formatted with empty space.
rename s, "-/ "; rename s, "_/ "; rename s, "+/ ";
Re: Rename Special modify _to Spaces script request
Posted: 23 Nov 2012 06:38
by j_c_hallgren
JimXYUser wrote:manage to find the answer, put this code in User -> Manage Commands -> location, then set a hot key.
now each time i select some files, press the hot key and all files will be formatted with empty space.
rename s, "-/ "; rename s, "_/ "; rename s, "+/ ";
Why do you have 3 separate renames? Won't one with "-+_/ " work just as well?
Re: Rename Special modify _to Spaces script request
Posted: 23 Nov 2012 09:04
by admin
Re: Rename Special modify _to Spaces script request
Posted: 23 Nov 2012 15:15
by JimXYUser
why '/' can be replace by '>' ?
Re: Rename Special modify _to Spaces script request
Posted: 23 Nov 2012 16:38
by admin
JimXYUser wrote:why '/' can be replace by '>' ?
I
has to be replaced else it does not work.

Check out the Help...
Re: Rename Special modify _to Spaces script request
Posted: 23 Nov 2012 23:58
by PeterH
Oh dear, I'm multiple confused now
I didn't really understand the help for the
Scripting Command "Rename". (That's what we are talking about.) Description of operand "pattern" says: "
[Required] The pattern to be applied. Its syntax may vary depending on which mode is used, see below for more." But "below" I find almost nothing...
Then I had the idea to look for help for the
Menu Command "Rename" - but: this is not so easy to find - it doesn't seem to exist in any way in Contents (German: "Inhalt") of Help.
But if you
search for "Rename" either by "Index" or by "Search" (German: "Suchen") you can find it. It's "File Menu / Rename Special (Submenu)"
So I think you should
1) give a hint (and maybe a direct link) in "Scripting Command / Rename" to "File Menu / Rename Special (Submenu)", and
2) in the index of help there should be a chapter for "Menu Commands", with entries for help pages like "File Menu".
Just another point: shouldn't the first operand for the Rename scripting command (in the examples) be quoted for clean syntax, i.e. "s"?
Re: Rename Special modify _to Spaces script request
Posted: 24 Nov 2012 11:00
by admin
1) give a hint (and maybe a direct link) in "Scripting Command / Rename" to "File Menu / Rename Special (Submenu)", and
Already there.
Just another point: shouldn't the first operand for the Rename scripting command (in the examples) be quoted for clean syntax, i.e. "s"?
Yes, but in the case of one-letter flags one can be a bit tolerant.
The "i" button in the Rename Special dialogs contains all necessary information.
Re: Rename Special modify _to Spaces script request
Posted: 24 Nov 2012 12:37
by PeterH
admin wrote:1) give a hint (and maybe a direct link) in "Scripting Command / Rename" to "File Menu / Rename Special (Submenu)", and
Already there.
Me bad

Even with a link!
But I've stopped reading after having reached the example for "rename s, ..."
I'm afraid this happens to others, too? So maybe it would be better to include it more at the top - for example direct behind the bold word
Syntax?
admin wrote:
Just another point: shouldn't the first operand for the Rename scripting command (in the examples) be quoted for clean syntax, i.e. "s"?
Yes, but in the case of one-letter flags one can be a bit tolerant.
My impression is that people often have problems with quoting strings. I just don't think it helps when strings sometimes are shown unquoted.
And I think I remember that severals months ago you said that you cannot guarantee that unquoted strings maybe lead to errors in the future...
Though I must say: for these option-letters it looks better if they are unquoted :-(