From: Jimekus on
Someone may remember putting me onto Link_File_1532711212003. I'm
using it for my VB6.0 lnkfile IMDB rating project. At that time I had
a problem with Microsoft updates breaking the IsLink function.

Now, I am finishing up interfacing the 32bit AMDBW14 title.exe program
and it produces a txt file for each IsLink entry in the folder. Once
all the txt files are sorted, the 1Kb files are, almost without
exception, unfound entries, and where the name needs cleaning.

Firstly, to clean the names, I plan to cycle through these extracted
1kb links to the now deleted txt files, where the not found errors
were stored. I want to synchronize in cases where I meanwhile have
somehow looked up and stored the proper IMDB name in the lnk.comment,
the description field.

Using what I think GetInvalidPathChars does, I want to see if the
comment can be renamed as the Windows filename. If so, then I want to
rename two files and clear the lnk.comment filed, or if not valid,
then I want to ShellAndWait (title.exe -t "search for that
lnkfile.comment" -o "output the result using the new lnk.name").

I supposed I could go through each known letter with
instr(lnk.comment, ":"), because I know that invalid character is
commonly used to denote a miniseries. I know it isn't valid so in that
case leave the original file name alone, because I used a minus "-"
there already. I'll look and see how to write specific routines to
handle each type of error until what's left are only factual errors in
the 1kb files to be manually looked up.

I have searched a lot all over but only found GetInvalidPathChars used
in the other later languages, so any VB6 workaround ideas are
welcomed.
From: Paul Clement on
On Thu, 11 Mar 2010 16:39:00 -0800 (PST), Jimekus <jimekus(a)gmail.com> wrote:

� Someone may remember putting me onto Link_File_1532711212003. I'm
� using it for my VB6.0 lnkfile IMDB rating project. At that time I had
� a problem with Microsoft updates breaking the IsLink function.

� Now, I am finishing up interfacing the 32bit AMDBW14 title.exe program
� and it produces a txt file for each IsLink entry in the folder. Once
� all the txt files are sorted, the 1Kb files are, almost without
� exception, unfound entries, and where the name needs cleaning.

� Firstly, to clean the names, I plan to cycle through these extracted
� 1kb links to the now deleted txt files, where the not found errors
� were stored. I want to synchronize in cases where I meanwhile have
� somehow looked up and stored the proper IMDB name in the lnk.comment,
� the description field.

� Using what I think GetInvalidPathChars does, I want to see if the
� comment can be renamed as the Windows filename. If so, then I want to
� rename two files and clear the lnk.comment filed, or if not valid,
� then I want to ShellAndWait (title.exe -t "search for that
� lnkfile.comment" -o "output the result using the new lnk.name").

� I supposed I could go through each known letter with
� instr(lnk.comment, ":"), because I know that invalid character is
� commonly used to denote a miniseries. I know it isn't valid so in that
� case leave the original file name alone, because I used a minus "-"
� there already. I'll look and see how to write specific routines to
� handle each type of error until what's left are only factual errors in
� the 1kb files to be manually looked up.

� I have searched a lot all over but only found GetInvalidPathChars used
� in the other later languages, so any VB6 workaround ideas are
� welcomed.

You could try using the VBScript Regular Expressions component with one of the many regular
expressions that filter invalid characters from file names:

http://support.microsoft.com/kb/818802
http://regexlib.com/Search.aspx?k=file+name


Paul
~~~~
Microsoft MVP (Visual Basic)
From: mayayana on
I've read your post several times and still don't
really get it. It reads like a note to a co-worker
who's expected to be familiar with your project.

You want to parse a string to check
for invalid characters and then possibly change
the string? Why not just ask that? And why refer
to a function from another language so that people
have to go and look that up?

From what I found,
GetInvalidPathChars seems to just return a
[undependable] list of invalid file name characters
for the current system.

I'm not sure if I understand what you want to do,
but if it's as I guessed above, why not just
hard-code your characters in a tokenizer routine?
That would give you flexibility. Something like:

For i = 1 to Len(s1)
iChar = AscW(Mid$(s1, i, 1))
Select Case iChar
Case 58 'colon

.....etc.


> Someone may remember putting me onto Link_File_1532711212003. I'm
> using it for my VB6.0 lnkfile IMDB rating project. At that time I had
> a problem with Microsoft updates breaking the IsLink function.
>
> Now, I am finishing up interfacing the 32bit AMDBW14 title.exe program
> and it produces a txt file for each IsLink entry in the folder. Once
> all the txt files are sorted, the 1Kb files are, almost without
> exception, unfound entries, and where the name needs cleaning.
>
> Firstly, to clean the names, I plan to cycle through these extracted
> 1kb links to the now deleted txt files, where the not found errors
> were stored. I want to synchronize in cases where I meanwhile have
> somehow looked up and stored the proper IMDB name in the lnk.comment,
> the description field.
>
> Using what I think GetInvalidPathChars does, I want to see if the
> comment can be renamed as the Windows filename. If so, then I want to
> rename two files and clear the lnk.comment filed, or if not valid,
> then I want to ShellAndWait (title.exe -t "search for that
> lnkfile.comment" -o "output the result using the new lnk.name").
>
> I supposed I could go through each known letter with
> instr(lnk.comment, ":"), because I know that invalid character is
> commonly used to denote a miniseries. I know it isn't valid so in that
> case leave the original file name alone, because I used a minus "-"
> there already. I'll look and see how to write specific routines to
> handle each type of error until what's left are only factual errors in
> the 1kb files to be manually looked up.
>
> I have searched a lot all over but only found GetInvalidPathChars used
> in the other later languages, so any VB6 workaround ideas are
> welcomed.


From: mayayana on

> You could try using the VBScript Regular Expressions component with one of
the many regular
> expressions that filter invalid characters from file names:
>
> http://support.microsoft.com/kb/818802
> http://regexlib.com/Search.aspx?k=file+name
>

That sounds like fun. Or maybe use the
FileSystemObject's ObjFile.Name and just
trap errors. Oh wait, is this the VB group
or the VBS group?


From: DanS on
Jimekus <jimekus(a)gmail.com> wrote in
news:56c5b10f-9f5c-4f68-9387-f542e937ca0b(a)x1g2000prb.googlegro
ups.com:

> Someone may remember putting me onto
> Link_File_1532711212003. I'm using it for my VB6.0 lnkfile
> IMDB rating project. At that time I had a problem with
> Microsoft updates breaking the IsLink function.
>
> Now, I am finishing up interfacing the 32bit AMDBW14
> title.exe program and it produces a txt file for each
<SNIP>
>there already. I'll look
> and see how to write specific routines to handle each type
> of error until what's left are only factual errors in the
> 1kb files to be manually looked up.
>
> I have searched a lot all over but only found
> GetInvalidPathChars used in the other later languages, so
> any VB6 workaround ideas are welcomed.
>

I use this function in a personal project. It could be
finished w/some error handling.....

(The case line is wrapped.)

Public Function isValidFileName(fileName As String) As Boolean

Dim x As Long

isValidFileName = True
For x = 1 To Len(fileName)
Select Case Mid$(fileName, x, 1)
Case "/", "\", ":", "*", "?", "<", ">", "|", Chr
$(34), Chr$(9), Chr$(10), vbNullChar
isValidFileName = False
Exit Function
End Select
Next

End Function