How can I quickly determine the length of a file name?
(right now I do EDIT -> COPY FILENAMES -> AS NAMES ONLY, then switch to my text editor, paste in the name, and see how long it is. Must be an easier way.)
How can I quickly determine the length of a file name?
(right now I do EDIT -> COPY FILENAMES -> AS NAMES ONLY, then switch to my text editor, paste in the name, and see how long it is. Must be an easier way.)
[quote="deleyd"]How can I quickly determine the length of a file name?
(right now I do EDIT -> COPY FILENAMES -> AS NAMES ONLY, then switch to my text editor, paste in the name, and see how long it is. Must be an easier way.)[/quote]
Well, since no one else jumped in, here is a crude and old way to do it, but should get you started:
Create a small VBScript file, like flen.vbs using notepad or some such plain text editor.
dim fname, arg
set arg=Wscript.Arguments
for each fname in arg
msgbox "The length of "&fname&" is: " & len(fname)
next
Now create a button named file length and put this in the function field:
wscript.exe c:\users\administrator\documents\flen.vbs {allfile$}
substitute the actual path for "c:\users\administrator\documents\flen.vbs" which is where I put it to test. It should give you a message box for each selected file. You will have to allow wsh scripts to run. You can modify it to do whatever you want with the results.
(allfile$} gives you just the file name, {allfilepath$} will include the path.
Lou
The Luo code will work very well, but not for spaced named files. If you want to count the length of spaced named files and don't like to use an external code for any reason, you can test following steps too:
[code]@script vbscript
Option Explicit
dim fname1, fname2
fname1 = "&strPath1&"
fname2 = "&strPath2&"
if (fname1<>fname2) then
msgbox "The legth of " & """" & fname1 & """" & " is:" & chr(13) & chr(13) & len(fname1) & " (with extension); " & len(fname2) & " (Without extension)"
else
msgbox "The legth of " & """" & fname1 & """" & " is: " & len(fname1)
end if
[/code]
@nofilenamequoting
@nodeselect
dopusrt /cmd CountName "{o}" "{o|noext}"
The above code have some problems too. If you select more than one file, you will receive all of the counts windows simultaneously. The problem must be solved if you delete dopusrt /cmd from key code, but in my test, DOpus was locked without it. I don't know what is the problem, a bug in DOpus or a mistake of me.
Did you try it? Lou's code works fine with spaced file names. Opus automatically adds quotes if they are needed and the Wscript.Arguments collection automatically handles quoted arguments.
Silly question
How select "Script Function" in user command ?
Oh dear Leo & AlbatorV, your letters revealed me a good and a bad thing
After your letters, I checked my DOpus and I found I was mistakenly installed version 9.1.0.3 after refreshing my WinXP!.
The good thing is the spaced file named problem is not appeared in v9.1.0.4 and above. The bad thing is the Script function is deleted in v9.1.0.4 and above, however, my VBScript function worked without any problem under Standard Function too.
Best Regards
Both scripts work nicely. Thank you. Questions,
Lou,
How can I make it so my selected filename(s) aren't unselected when I use yours?
seacher123,
How can I modify yours so it gives me the length of the full file path + file name? (I could make that a right-click function.)
[quote="deleyd"]Lou,
How can I make it so my selected filename(s) aren't unselected when I use yours?[/quote]
Add @nodeselect to the button, on a line by itself, like this:
@nodeselect
wscript.exe c:\users\administrator\documents\flen.vbs {allfile$}
I might be wrong but, as far as I know, the Script function type was never enabled in Opus 9.1.0.3, or any other version, except when using a special type of licence certificate which GPSoftware don't give to anyone... cough
[quote="deleyd"]
seacher123,
How can I modify yours so it gives me the length of the full file path + file name? (I could make that a right-click function.)[/quote]
Just replace {o} and {o|noext} with {f} and {f|noext} in key code.