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 Automation Server/COM and LabVIEW
 How to debug m_originApp.Execute()
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

newuser_ca

70 Posts

Posted - 11/05/2012 :  3:38:12 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin 8.6 Pro in Win7
Visual C# 2010

I have C# codes to call origin function. I have a problem to parse a string containing comma.
Here are my C# code:
m_originApp.Execute("StringArray wordArray;StringArray styleArray;"); // define a LabTalk string array
string str = "wordArray.Add(abc);styleArray.Add(123);"; // add string to array command
m_originApp.Execute(str);
string title = "\"this is the title, please check\"";
string input = "C:\\Users\\origin\\AppData\\Local\\Temp\\tdv_1468707591030654585.dat";
string pltSampleCMD1 = "string testName = CSharp_test2(" + title + "," + input + ",wordArray,styleArray,1)$;";
m_originApp.Execute(pltSampleCMD1); // execute the LT command
string st1 = m_originApp.get_LTStr("testName");
MessageBox.Show(st1, "Msg");



Here are my origin codes:

string CSharp_test2(string title, string inputfile, StringArray tlmArray, StringArray styleArray, int gridFlag)
{
printf("title is %s\n", title);
printf("input file is %s\n", inputfile);
return title;
}


if I defined my "input" in C# as
string title = "\"this is the title, please check\""; // with comma
string input = "inputfile";

it will work.

Or if I define
string title = "\"this is the title\""; // no comma
string input = "C:\\Users\\origin\\AppData\\Local\\Temp\\tdv_1468707591030654585.dat";

It will work, too.

I don't know what's wrong in the first case. I step into it, and noticed that m_originApp.Execute(pltSampleCMD1) is not executed at all.
Is there any way to debug m_originApp.Execute()?

Thanks!

Penn

China
644 Posts

Posted - 11/08/2012 :  03:35:27 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

The problem is not about the comma. There is the number of characters of arguments limitation when calling a function in LabTalk. For now, the solution is to put the "title" and "input" into the LabTalk string, such as

m_originApp.Execute("StringArray wordArray; StringArray styleArray;");
string str = "wordArray.Add(abc); styleArray.Add(123);";
m_originApp.Execute(str);
// string title = "\"this is the title, please check \"";
m_originApp.Execute("string title$ = \"this is the title, please check\";");
// string input = "C:\\Users\\origin\\AppData\\Local\\Temp\\tdv_1468707591030654585.dat";
m_originApp.Execute("string input$ = \"C:\\Users\\origin\\AppData\\Local\\Temp\\tdv_1468707591030654585.dat\";");
// string pltSampleCMD1 = "string testName$ = CSharp_test2(" + title + "," + input + ", wordArray, styleArray, 1)$;";
string pltSampleCMD1 = "string testName$ = CSharp_test2(title$, input$, wordArray, styleArray, 1)$;";
m_originApp.Execute(pltSampleCMD1);
string st1 = m_originApp.get_LTStr("testName");
MessageBox.Show(st1, "Msg"); 


Penn
Go to Top of Page

newuser_ca

70 Posts

Posted - 11/08/2012 :  09:50:29 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks a lot for your help.
It is working now.

Go to Top of Page

fifacoins11

Algeria
4 Posts

Posted - 10/04/2015 :  01:40:00 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
FIFA 16 is an association football simulation video game published by EA Sports for Microsoft Windows, PlayStation 3, PlayStation 4, Xbox 360, Xbox One, Android and iOS. The game is the first in the FIFA series to include female players at fifa16.vipmmobank.com
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