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
 LabTalk Forum
 avoid ending script caused by bad .dat import
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Loick

France
14 Posts

Posted - 03/30/2009 :  08:09:00 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 7.5
Operating System: XP

Hello,

I would like to know how I can avoid that my script end when importing bad .dat file?

I have the .dat file but it is not complete, no measured data in it (just header). When I try to import the data, I get this error : "file can not be read" and my script ends at this point.

So I want to create the worksheet even if there is nothing in it.

Is there any solution?

thanks for your help

Loick



If you don't understand why your Labtalk code is not working... Check your syntax -.-'

Laurie

USA
404 Posts

Posted - 03/30/2009 :  11:04:48 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Loick,

The solution is to create a script file with sections of code. If your import code is in one section called from another, that section of code will stop running, but it will return to the section that called it and then the remaining script will continue running.

For example, create a LabTalk script file (OGS) with at least two sections of code:

[main]
   if(run.section(,import) == 0)
	type -b "File import was successful";
   else
	type -b "File failed to import";

   type -b "Regardless of success or failure of file import, I will see this message";

   return 0;


[import]
 open -w %B%A; 
 return 0;


Laurie

OriginLab Technical Support
Go to Top of Page

Loick

France
14 Posts

Posted - 04/03/2009 :  03:30:09 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Laurie,

Thanks for your help, it works "properly" now

I've sequenced my code in different parts.

Regards,

Loick
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