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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Command Window executed from C code
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

j@y

Germany
29 Posts

Posted - 08/28/2015 :  09:13:22 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi everyone,
To be able to import a file, I need to run.LoadOC(Originlab\FileImport.c, 16); in Command Window. Is it possible in general to execute a Command Window's expression from the C code? Something like LabTalk's LT_execute()?
Many thanks for your help!

Castiel

343 Posts

Posted - 08/28/2015 :  10:55:13 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by j@y

Hi everyone,
To be able to import a file, I need to run.LoadOC(Originlab\FileImport.c, 16); in Command Window. Is it possible in general to execute a Command Window's expression from the C code? Something like LabTalk's LT_execute()?
Many thanks for your help!



The run.loadoc() is really annoying. Two solutions as far as I can see:
1. Create a toolbar (or ogs file...), when click a button on the toolbar, first run.loadoc(originlab\fileimport.c, 16), then run.loadoc(your_source_code, 16), and finally invoke your function....
2. Take int ImportASCII() for example,
first, typedef int (*FIMPORTASCII)(Page &pgTarget, TreeNode &trFilter, LPCSTR lpcszFile, int nFile);
then
Function fn = Project.FindFunction("ImportASCII", GetAppPath(TRUE) + "OriginC\\OriginLab\\FileImport.c");
FIMPORTASCII pf = fn;
pf(....);
See the example of Project::FindFunction().

妾+   午旦  妹罕妾  妾伊    用仇  妾/     岫ㄞ
 妾京用 仍巨  件 侈   件戶' 甘岫平   /欠  白岫妹
   併             艮          岫  奈 白   岫
                              岫
Go to Top of Page

j@y

Germany
29 Posts

Posted - 08/29/2015 :  12:52:51 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Many thanks, Castiel! You are totally right. run.LoadOC() is a LabTalk code, so I can do this with a button...
Option #1 seems easiest to me. I need to compile and use a code containing import_file() to import the TDM file. I know there is also an impNITDM X-function. But I am not too familiar with X-functions yet. impNITDM works fine from Command window, but CW is not what I want...
Best regards, Jiri
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000