Welcome, Guest. Please Login
YaBB - Yet another Bulletin Board
 
  HomeHelpSearchLogin  
 
ExecuteAFile (Read 2065 times)
Ted Toal
YaBB Newbies
*
Offline


Feed your monkey!

Posts: 2
ExecuteAFile
Jan 21st, 2011 at 2:43pm
 
Is there documentation on how to pass arguments to a batch file when it is being executed via ExecuteAFile, and how to pass return values back from the batch file to the caller of ExecuteAFile?
Back to top
 
 
IP Logged
 
Sergei
YaBB Administrator
*****
Offline


Datamonkeys are forever...

Posts: 1658
UCSD
Gender: male
Re: ExecuteAFile
Reply #1 - Jan 28th, 2011 at 3:22pm
 
Hi Ted,

Sorry it took me a while to respond. ExecuteAFile can be passed a list of arguments in the order that you want them to be used. The basic use is

Code:
inputArguments = {"00": "first argument", "01":"second argument"};
ExecuteAFile ("/path/to/some/batch/file", inputArguments);

 



Also, take a look at section 2.8 in Multimedia File Viewing and Clickable Links are available for Registered Members only!!  You need to Login Login
Four further points are

  • keys in inputArguments will be read in lexicographic order, so if the number of arguments exceeds ten, use "00","01",..."09","10", not "0","1",..."10", lest argument "10" be processed right after argument "1".
  • all values (e.g. "first argument") must be strings; if you want to pass numbers, simply convert them to strings.
  • if you pass a blank value ("") for one of the keys, then HyPhy will prompt the user to input that value interactively -- this can permit you to "prefill" most of the options, but leave one or two to be supplied at run time (e.g. the file name)
  • the input is case-sensitive; this is especially important when you are supplying options for multiple choice questions.


The logic behind this is that ExecuteAFile is meant to simulate the functionality of the input redirect operation in UNIX by simply supplying a list of strings that normally would come from the standard input.

ExecuteAFile does not return any values, but whatever values the batch file you call populates will be available to you after the call. For example if you have file1.bf:

Code:
pi = 3.1415;

 



then

Code:
ExecuteAFile ("file1.bf");
fprintf (stdout, "\n", pi, "\n");

 



should print out "3.1415".

Sergei
Back to top
 

Associate Professor
Division of Infectious Diseases
Division of Biomedical Informatics
School of Medicine
University of California San Diego
WWW WWW  
IP Logged