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
 Run a fortran code from Origin
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

DrDanon

USA
1 Posts

Posted - 06/11/2004 :  4:30:05 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I created a button that can run a Fortran code using the run -e command. The code Opens a dos box and runs. The output of the code( a file) is loaded to a worksheet. The problem is a need some way knowing that the Fortran code finished and only then run the open command to load the file. Any ideas??


Yaron

Mike Buess

USA
3037 Posts

Posted - 06/12/2004 :  12:07:26 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Yaron,

Apparently you know the name of the output file in advance so you can write a script that simply waits until the file appears...

%Z=file path\name;
run -e Fortran program;
for(i=1;i>0;) {
sec -p 0.1; // pause 0.1 seconds
if(exist(%Z)>0) break; // continue if file exists
};
open -w %Z;

Mike Buess
Origin WebRing Member
Go to Top of Page

perger

Hungary
3 Posts

Posted - 07/15/2004 :  05:13:23 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The method mentioned by Mike is not flawless:
If the fortran code runs for a long time and continuously writes into the output file, then the import occurs when the file is created and not when it is closed. Therefore, the imported dataset contains only the first few lines of the output.
One possible solution is to create a "flag file" (e.g. finished.txt) from the fortran code before it exits, and checking the existance of this "flag file" from the LabTalk script.

Tamas Perger
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