CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > CFX

Capturing the output from DOS system command using PERL in CFX Macro

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 17, 2016, 07:36
Default Capturing the output from DOS system command using PERL in CFX Macro
  #1
Member
 
Dynampally Pavitran
Join Date: Mar 2010
Location: India
Posts: 74
Rep Power: 16
pavitran is on a distinguished road
Hello all,

I have written a macro to calculate some values (which are not available as variables in CFD Post) and write the output to a file (File first row is Header, Second row consists values). I have to use the macro for several cases and values have to be appended to the same file.
When the macro runs for the second time, it should skip writing the header portion and has to write values from third row. For this I am using DOS system command syntax in Perl to check whether the file exists or not in the working directory. The syntax used is:

! $CHECK = `If EXISTS XY.dat (ECHO YES) ELSE (ECHO NO)`;
! if ($CHECK == "NO") { print OFH "HEADER\n";}

When backticks are used to capture system command output, CFD Post terminates. The same happens when "qx" syntax is used. Presently I am using alternative solution of asking the user input, whether the file is present or not?
Could someone help me with the right syntax to capture system command output in PERL when used in CFX Macro.
pavitran is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CFX macro: Name of mesh File as Variable Saima CFX 2 May 27, 2011 19:59
Output to CFX Maicol CFX 0 April 13, 2011 18:48
Is Perl installed with CFX? Rikio CFX 4 May 28, 2008 04:33
Which operating system for CFX is the best? Dr. Bian CFX 12 June 26, 2006 09:58
CFX 4.4 installation problem Pandu Sattvika CFX 1 December 1, 2001 05:07


All times are GMT -4. The time now is 15:05.