Can DOpus automatically handle/change illegal characters?

I do a lot of file renaming via copy and paste. So, I have on the clipboard-

Buns: A Book About Hot Dogs

When I try to rename a folder, the stuff after the colon is pasted, the stuff before is ignored.

Can DOpus automatically change the illegal characters? I have the same issues with question marks.

Thanks

CreateFolder FROMCLIPBOARD will create a new folder with the name of what's in the clipboard, with illegal characters converted.

I don't think there's a way to make inline rename do a similar thing, but I agree that it's a good idea.

I've filed a feature request for you suggesting that when someone pastes text while renaming the characters are substituted (but the current system remains in place if someone manually tries to type : or whatever, as getting a _ would be confusing).

1 Like

This is such a n00b question. But what exactly to I do with that code? What I have tried creates a folder called

CreateFolder FROMCLIPBOARD

HA HA!!

We are all learning, just in different places and at different paces! :slight_smile:

  1. Right-click a toolbar
  2. Select Customize
  3. Right-click a toolbar
  4. Select New - New Button
  5. Right-click the new button
  6. Select Edit
  7. Click the Advanced button
  8. Put CreateFolder FROMCLIPBOARD as the command
  9. Okay everything and exit Customize mode.

Now when you copy some text to your clipboard, you activate the File Display where you want to create the folder. Then you click the button.

I don't think this will help you rename a folder that already exists, but it will help you create a new one without the special characters.

Yup! that is doing exactly what it is supposed to.

Amazing.

I would like to add my vote that this is a much needed feature - especially in Inline Rename.

Very often - I am inline renaming a file with a name coming from copy-paste usually from the internet - such as a Web Page Title which may have : (colon) or / (slash) characters in it.
It would be very nice if Dopus would convert them to - (dash).

[quote="jmkeuning"]I do a lot of file renaming via copy and paste. So, I have on the clipboard-

Buns: A Book About Hot Dogs

When I try to rename a folder, the stuff after the colon is pasted, the stuff before is ignored.

Can DOpus automatically change the illegal characters? I have the same issues with question marks.

Thanks[/quote]
That's odd - I did an inline folder rename by pasting Buns: A Book About Hot Dogs from the clipboard and I got folder named Buns A Book About Hot Dogs Opus seems to have ignored the colon just as it would have done, I had typed a colon - but it didn't do any cropping around the colon :confused:

Developers : Please make any new feature to auto-replace illegal characters optional - preferably opt-in rather than opt-out.

Thanks BR

I personally use Ctrl+Shift+V which does:

Rename   TO "{clip}.{ext}" FILEINFO

Maybe you could write simple script (like in Autohotkey?) that would replace all illegal characters in the clipboard before executing Rename command.

I also find, as did BetterRed, that illegal chars are automatically eliminated during inline rename. I think this is a wonderful feature. The one thing I would request, though, is that there please be an option to specify what the illegal chars are replaced with. The default seems to be to replace them with an empty string; however, I would much prefer to replace them with underscores.

I wasn't going to make any value comments on Opus inline rename, but since ashmid has and to make my position clear - I think this a awful feature.

I would never deliberately type or blindly paste any of the illegal characters into a file or folder name. If I do then I have made a mistake which I would expect to be given the opportunity of correcting.

What I would like is the same error bubble I get in Windows Explorer

A folder or file name can't contain any of the following characters \ / : * ? " < > |

Ideally, I'd like the error bubble when I leave the edit field rather than as I type.

As a consequence of this wonderful/awful feature I have to manually eyeball every inline rename before I hit enter
If I type A<ERICA I get AERICA, if I don't check it or hit enter to soon the folder/file will be found just before AEROPLANE rather than just after AMEN.

What annoys me is that I get no indication of my mistake, its just tossed into the bit bucket ... arrogantly. If I type a wrong value show some sort of error somewhere, give me the change to correct my mistakes - don't just ignore it and compound the error. I would have thought that would be taught in UI Design 101 - Lesson 1 :unamused:

Being different from Windows is fine if its better, but if its not then why bother, and if its worse, as in this this case, then...

But I do like the inline rename options :slight_smile:

BR

It's much quicker to just replace incorrect strings than see message
"hey! you typed or pasted incorrect character into the file name!"
You correct one error, hit enter and get another error saying you forgot about another illegal character etc...

I find current behavior more user-friendly.

Of course, there might be an option to choose if you want to replace incorrect characters automatically or see error message but I wouldn't set it to the highest priority.

  1. When creating a folder with ":" - it will convert the ":" to a blank space. However when doing inline rename with a ':" - all the text before the ":" will disappear. This is odd behavior since I often name text files from a URL Webpage Title from the Internet (the file has text in it that I have copied from an Internet webpage with that title or heading).
  2. When doing inline rename or create folder with a "/" - it will interpret the "/" as you want to create a directory structure - and it will create a directory and place the file-folder inside of the directory name to the left of the "/". Although I see the logic behind this - it would be nice if there was an option, since I have many filenames that come from URL Webpage Titles that have "/" in them - for example the word "and/or".
  3. When copy-pasting a title with "?" in it to "Create Folder" - it will remove the "?" automatically. However when copy-pasting a title with "?" during inline-rename - it will throw an error message. Again inconsistent behavior.

These are three main use cases I have problems with - ":" and "/" and "?" since these are often found in Titles.

I understand that people have different usage cases. It would be nice if there were 2 preferences, specifically:

  1. [CHECKBOX] Automatically convert ':' character to '-' during inline rename.
  2. [CHECKBOX] Automatically convert '/' character to '-' during inline rename.
  3. [CHECKBOX] Automatically remove '?' character during inline rename.

For me it always removes : and ? from file name. What I do is press F2 (rename inline) and paste name from clipboard which is something like "abc:def" or "abc?def" but it always removes illegal characters. Also, if I type : or ? to the file name after pressing F2, it removes these characters when typing.
Could you provide more detailed steps?

Non-filename characters will be stripped unless they form a valid path string. So "C:\blah.txt" would be ok where as "http://blah.com" would not. This is a feature, not a bug.

Personally I often use slashes in file names to quickly move and/or rename files. It's easier than opening apt folder and dropping file on it.

Okay, I solved this with an AutoHotKey script as per daroc's recommendation. For anyone else who is interested:

;Paste clipboard with illegal filename characters stripped
^!+v::                            
	strippedillegals = %ClipBoard%
	strippedillegals := RegExReplace(strippedillegals,"[\\/:*?""<>|]")
	ClipBoard = %strippedillegals%
	Send,^v
	VarSetCapacity(strippedillegals, 0)      ; Free memory
Return

Here is a full solution that causes Ctrl+Shift+R to automatically rename a file from the clipboard contents. Have also modified the script to handle newlines and convert certain characters to "-"

In AutoHotKey:

^+r:: StringReplace, clipboard, clipboard, `r`n, %A_Space%, All StringReplace, clipboard, clipboard, /, -, All StringReplace, clipboard, clipboard, :, -, All StringReplace, clipboard, clipboard, », -, All clipboard := RegExReplace(clipboard,"[\*?""<>|]") Send,^!+#r Return

In Dopus:
HotKey Win+Ctrl+Shift+Alt+R set to:
Rename TO "{clip}.{ext}" FILEINFO

Better version updated. Uses DopusRT. Performs rename from clipboard with filename allowed characters being only alphanumeric, space, dash, parenthesis, comma, period.

^+r::
IfWinActive, ahk_class dopus.lister
{
	StringReplace, filename, clipboard, `r`n, %A_Space%, All ;replace newlines with spaces
	StringReplace, filename, filename, /, -, All
	StringReplace, filename, filename, \, -, All
	StringReplace, filename, filename, :, -, All
	StringReplace, filename, filename, », -, All
	StringReplace, filename, filename, ~, -, All
	filename := RegExReplace(filename, "-+", "-") ;remove double dash
	filename := RegExReplace(filename,"[^[:alnum:][:space:]-(),.]") ;remove all but desired filename characters
	filename := RegExReplace(filename, "[[:blank:]]+", " ") ;remove double space
	filename = %filename% ;autotrim leading and trailing whitespaces
	StringLeft, filename, filename, 64
	;MsgBox %filename%
	Run, "C:\Program Files\GPSoftware\Directory Opus\dopusrt.exe" /cmd Rename TO "%filename%.{ext}" FILEINFO
	VarSetCapacity(filename, 0)      ; Free memory
}
Return