HyPhy message board
http://www.hyphy.org/cgi-bin/hyphy_forums/YaBB.pl
HYPHY Package >> HyPhy feedback >> ExecuteAFile
http://www.hyphy.org/cgi-bin/hyphy_forums/YaBB.pl?num=1295649821

Message started by Ted Toal on Jan 21st, 2011 at 2:43pm

Title: ExecuteAFile
Post by Ted Toal on 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?

Title: Re: ExecuteAFile
Post by Sergei on 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);

[/code):

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");

[/code]

should print out "3.1415".

Sergei

HyPhy message board » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2024. All Rights Reserved.