first part of file name 
Author Message
 first part of file name

When a file of a certain type is double clicked on, my app opens. The app
needs to know the full path of the file how can I get this? Also, I need the
app to get the first part of a file name, the part before the extension, and
make a subfolder from it.Like This

File---File.Txt
Directory to be made---<Main Drive>\Windows\File

Any ideas?



Fri, 06 Oct 2000 03:00:00 GMT  
 first part of file name

Quote:
>When a file of a certain type is double clicked on, my app opens. The app
>needs to know the full path of the file how can I get this? Also, I need
the
>app to get the first part of a file name, the part before the extension,
and
>make a subfolder from it.

Well, there are two things you need to do ...
1. register the file, you want to open in your VB app, so that it's
extension is 'connected' to the app ... you can do this in Folder Options >
File Types... There you add the extension of you datafile and add a new
action to so that the file is  "OPEN"ed with your application.
2. Your application must accept these commandline arguments which contain
the full pathname of the file which issued the call to the application.

< --- code starts here --- >

Private DataFileFP As String
Private DataFilePath As String
Private DataFileName As String

Private Sub Form_Load()
    DataFileFP = Command
    ' find last backslash
    pos = 0
    While InStr(pos + 1, DataFileFP, "\") <> 0
        pos = InStr(pos + 1, DataFileFP, "\")
    Wend
    DataFilePath = Left$(DataFileFP, pos)
    DataFileName = Left$(Mid$(DataFileFP, pos + 1), InStr(1,
Mid$(DataFileFP, pos + 1), "."))
End Sub

< --- code ends here --- >

after which
DataFileFP contains the Full Path to the datafile
DataFilePath contains the Path to the datafile
DataFileName contains the name of the datafile, without the extension ...

hope this helps
greetz
Christophe



Sat, 07 Oct 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Downloading the first part of a file / the header

2. Downloading the first part of a file / the header

3. Downloading the first part of a file / the header

4. use a field in the document as part of file name

5. Save a Document with Bookmarks as part of file name

6. Source code from boredom, part 1 - selecting file names - filelst2.bas (0/1)

7. Changing only the first letter in a file name

8. need text file of common first names

9. First file name in folder script help

10. How do I parse name into first and last name fields

11. Split Full Name to First/Last Name

12. Can't Get full File name for Long file names

 

 
Powered by phpBB® Forum Software