The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 file - c with string variables

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
marcel1992 Posted - 07/19/2021 : 06:33:45 AM
Origin Ver. 2021 9.8.0.200
Operating System: Win 10 pro 64bit

Hello together, I like to copy a file to another location.
After using the labtalk manual I found "file -c".
I tried this with some .txt files and it worked great.
Now I like to copy some .tdms files and the location (in and out) should be a string variable but it seems that this doesn't work. Some ideas why? Is there a better way copying files to another destination?
Thanks in advance
4   L A T E S T    R E P L I E S    (Newest First)
marcel1992 Posted - 07/21/2021 : 08:33:55 AM
Hello cpyang
this works perfect, thanks for the solution.
cpyang Posted - 07/20/2021 : 8:55:39 PM
This LT command was very old, way before LT string variables were introduced and apparently we failed to update it, we will do it for upcoming Origin 2022, for now, use the % substitution, see below:

string str1$="C:\temp\test1\test.txt";
string str2$="C:\temp\test2\test.txt";
type -v "copying from [%(str1$)] to [%(str2$)]";
@ERR=0;
file -c "%(str1$)" "%(str2$)";
@ERR=;//from system GetLastError if CopyFile failed.


Please make sure you have write access to the destination as c:\Users\ typically is not writable.

See also

https://www.originlab.com/doc/LabTalk/guide/Substitution-Notation#.25.28_.29_Substitution

CP
marcel1992 Posted - 07/20/2021 : 03:46:08 AM
Hello James, thanks for your reply.
In general I used:
file -c C:\User\Test1\Test.txt C:\User\Test2\Test.txt

After this is tried:
String dest1$ = "C:\User\Test1\Test.txt"
String dest2$ = "C:\User\Test2\Test.txt"
file -c dest1$ dest2$
but this doesn't work.
Syntax issue?
YimingChen Posted - 07/19/2021 : 10:45:18 AM
Would you please attach the script that you used? I couldn't reproduce the issue.

James

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000