Results 1 to 7 of 7

Thread: My Documents Problem

  1. #1
    ryanf
    Guest

    My Documents Problem

    Can anyone tell me why this works in a folder on my root but not in my My Documents folder :

    Inet1.Execute , "GET main.txt " & App.Path & "\main.txt"

    I'm running Win2k

  2. #2
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    If your program is located in the root, App.Path will end with a backslash, otherwise it won't.
    If the get command only succeeds in the root, it could mean it needs double backslashes.

    Try something like this:
    Dim strDest as String
    strDest = App.Path
    If Left(strDest,1) <> "\" Then strDest = strDest & "\"
    strDest = strDest & "main.txt"
    strDest = Replace(strDest,"\", "\\")
    Inet1.Execute , "GET main.txt " & strDest

  3. #3
    ryanf
    Guest
    Thanks for the response Frans but still no joy. If I try:

    Inet1.Execute , "GET mainMB.txt " & "C:\mainMB.txt"

    everythings perfect, but even:
    Inet1.Execute , "GET main.txt " & "C:\Visual Basic\main.txt"

    won't work!

  4. #4
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670
    It's because you have spaces in the path - try this:

    Inet1.Execute , "GET main.txt " & chr(34) & "C:\Visual Basic\main.txt" & chr(34)

    Inet1.Execute , "GET main.txt " & chr(34) & App.Path & "\main.txt" & chr(34)

    CHR(34) = " character
    'Buzby'
    Visual Basic Developer
    "I'm moving to Theory. Everything works there."

  5. #5
    ryanf
    Guest
    Hey Buzby, thanks a lot-works great!

    Could you just explain this to me:
    "It's because you have spaces in the path"

  6. #6
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670
    c:\My Documents\ThisFile.TXT has a space in it
    c:\Visual Basic\main.txt has a space in it.
    c:\mainmb.txt hasn't got a space in it.

    The GET command is obviously expecting two parameters, with spaces between them. When you use a command like:

    GET main.txt c:\Visual Basic\main.txt

    you are inadvertantly providing three parameters, because there is a space between Visual and Basic. To avoid these problems you have to surround the path with " quotes.

    eg;
    GET main.txt "c:\Visual Basic\main.txt"

    Now it is parsed as two paramters, and works fine.

    If you open a MS-DOS Prompt window and type:

    cd \my documents

    you get an error, however if you type

    cd "\my documents"

    you don't - for the very same reason. The CD command only expects one parameter.
    'Buzby'
    Visual Basic Developer
    "I'm moving to Theory. Everything works there."

  7. #7
    ryanf
    Guest
    Thanks Buzby, I understand now

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width