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
 calling function from LabTalk
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

blt2si

Germany
37 Posts

Posted - 01/16/2003 :  03:43:08 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
hi all,
I wrote a LabTalk script file and named as newone.ogs.
The following is the main script for importing the text file.I created an object button to execute my code and i included the run.section behind this button..Here ChangeFormat is the function name which is written in CodeBuilder to change the textfile format into excel worksheet.Finally i was succeeded to import the text file but i was unable to change the format,it is appearing as it is(i.e: same as the raw text file).
Is this correct to call the function which is written in codebuilder?
if not please suggest me how to call the function.

// Filename: newone.ogs

// Main Code

[Main]
// type -b $General.Userbutton;

win -t data C:\Program Files\OriginLab\Origin7Server\dataN.otw;
getfile *.txt;
open -w %a;
ChangeFormat(%a);

Thank You,
Blank

easwar

USA
1965 Posts

Posted - 01/16/2003 :  12:20:46 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Blank,

Was your Origin C function compiled and linked before you executed this script? Did you see any error messages in the script window that indicated that this Origin C function was not available?

I suggest that you try to test the OC function independantly by typing:
ChangeFormat(filename)
in your script window and see if it works.

Also, note that you can add script that would automatically load, compile and link your OC function so that this process can be part of your script as well. This can be done using the run.loadoc() script command. Look in the help files for more documentation on this command.

Easwar
OriginLab.
Go to Top of Page

blt2si

Germany
37 Posts

Posted - 01/17/2003 :  04:09:24 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Easwar,

Thank you for your reply.I tried with both of the options run.section and run.loadoc().I noticed error messages in the script window that it is showing the following error:
Origin C Function Runtime Error, failed to find object during method call
can you please tell me why this is coming?

Thank You,
Blank


quote:

Hi Blank,

Was your Origin C function compiled and linked before you executed this script? Did you see any error messages in the script window that indicated that this Origin C function was not available?

I suggest that you try to test the OC function independantly by typing:
ChangeFormat(filename)
in your script window and see if it works.

Also, note that you can add script that would automatically load, compile and link your OC function so that this process can be part of your script as well. This can be done using the run.loadoc() script command. Look in the help files for more documentation on this command.

Easwar
OriginLab.

Go to Top of Page

easwar

USA
1965 Posts

Posted - 01/17/2003 :  10:49:33 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Blank,

If your Origin C function code is not too large, please post here and we can take a look. If too large, please send to tech support.

Easwar
OriginLab.

Go to Top of Page

blt2si

Germany
37 Posts

Posted - 01/23/2003 :  05:11:18 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Easwar,
I changed the script from labtalk to origin.i wrote new code for importing the text files..it is working as i expected.
i imported the text file data into some source work sheet and now i want to change this into required format..for that reason i included another function call in my origin function...how can i call another function by sending this worksheet as an argument?
in new function also i define new worksheet which is the final one.
now i want to access the source worksheet to load the data into the final worksheet..please suggest me ...
Thank you,
Blank
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 01/23/2003 :  08:32:46 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Something like this?


 
bool foo(Worksheet& wks)
{
printf("wks has %d columns\n", wks.GetNumCols());
return true;
}




void test()
{
Worksheet myWks("data1");
foo(myWks);
}




CP


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