Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Test extension
Message
From
27/05/2011 04:15:26
 
 
To
27/05/2011 04:09:15
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01511789
Message ID:
01511995
Views:
38
Tom - i won't even tell you what i did wrong - you won't bother to help me again. Thanks so much for accurate code - unfortunately in the hands of incompentence it's not going to work. But i've seen the light. all is good now - i am on the right path and will use your sample for my program with gratitude and humility.
k

>I assume, that you adopted my sample to your needs, as I didn't implement the target path.
>If so, you should check that you use a Backslash instead of a Slash after C:. This might already do the trick.
>
>Here are two versions how you could implement a path:
>
>* Version 1
>* uses a default path 
>lcPath = [c:\vaniermu\]
>lcSrcFName = [MyOriginalFile.txt]
>lcNewFName = INPUTBOX( [Filename] , [Define the name of the file] , [MyNewFile] , 0 , [] , [MyNewFile] )
>lcNewFName = FORCEEXT( lcNewFName , JUSTEXT( lcSrcFName ) )
>COPY FILE ( lcPath + lcSrcFName ) TO (  lcPath + lcNewFName )
>
>*Version 2
>* uses the path from the sourcefile
>lcSrcFName = [c:\vaniermu\MyOriginalFile.txt]
>lcNewFName = INPUTBOX( [Filename] , [Define the name of the file] , [MyNewFile] , 0 , [] , [MyNewFile] )
>lcNewFName = FORCEEXT( lcNewFName , JUSTEXT( lcSrcFName ) )
>COPY FILE ( lcSrcFName ) TO (  ADDBS( JUSTPATH( lcSrcFName ) ) + lcNewFName )
>
>
>>>Hi Karen,
>>>
>>>as Naomi already wrote, FORCEEXT() is the function you should use.
>>>
>>>
>>>lcSrcFName = [MyOriginalFile.txt]
>>>lcNewFName = INPUTBOX( [Filename] , [Define the name of the file] , [MyNewFile] , 0 , [] , [MyNewFile] )
>>>lcNewFName = FORCEEXT( lcNewFName , JUSTEXT( lcSrcFName ) )
>>>COPY FILE ( lcSrcFName ) TO ( lcNewFName )
>>>
>>>
>>>
>>>>
>>>>@ 0,1 say "Re-Name File:  " get fln
>>>>READ
>>>>fln = rtrim(fln)
>>>>COPY FILE m.txt to c:\vaniermu\&fln
>>>>
>>>
>>>>Is there a way to test the extension of data entered.
>>>>Here i ask if the operator wants to name the file but if the extension txt is not typed
>>>>i would like the program to add it automatically. Any siggestons would be appreciated
>>>>thanks K
>>>>
>>>>
>>>>@ 0,1 say "Re-Name File:  " get fln
>>>>READ
>>>>fln = rtrim(fln)
>>>>COPY FILE m.txt to c:\vaniermu\&fln
>>>>
>>
>>thanks tom - i like the format of this - it starts out nicely but breaks down on the last line - with message
>>
>>C:/MyOriginalFile.txt does not exist
>>
>>seems like the entry option does not translate to the new title i type in.
>>maybe i'm doing something wrong in the set up. the file i'm viewing is called m.txt - am i missing a line of code that i should be inserting somewhere. many thanks for your suggestion.
>>k
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform