Execute Script Text - interfacing Igor with Contin

Hello all,

I just sent this to the email list, but I am not sure if the forums and the list share the same audience.

I am working to interface Igor with a couple of old programs called CONTIN and DISCRETE. In particular, I am using Contin to fit distribution functions to exponential decay data. I can run the program through the Windows command line, using text files as inputs and outputs, with commands like the following:

chdir /d f:\ContinAnalysis\test

contin.exe continDataOutput.txt

My Igor program at present can turn data vs time data into a continDataInput.txt file, and read the results back out of a continDataOutput.txt. The only aspect I'm missing to fully automate this is to run the program from the command line using ExecuteScriptText. However, I have had absolutely no luck with this function - even when paying particular attention to escape characters, including passing the command in quotes as "\"command goes here\"". It looks like there is some promise to use batch files, but I haven't been able to figure out how to write a batch file with the appropriate format either.

Any help would be greatly appreciated!

Regards,
Scott
I got some replies on the email list, and that solved my problem. Here is the code that worked for me:

"Thank you all for the help. I got it to work using some of Jim's advice, along with some code I found on Igor Exchange. The trick was to use the full-paths. I couldn't get it to run all of the commands in a single input, but making a batch file worked out well.

The newest problem I ran into was that after I run PathInfo, the s_path string is in the colon-separated format. I tried several different things, then ended up kludging it with replaceString. I'm happy with it."

The code I used from Igor Exchange is based on the ExecuteWinCmd function by harneit http://www.igorexchange.com/node/938

My code is below:

Function ExecuteContin(inputName, outputName, pathStr)
string inputName, outputName, pathStr

pathStr = replaceString(":", pathStr, "\\")
pathStr = replaceString(pathStr[0] , pathStr, pathStr[0]+":")
print "pathStr now equals " + pathStr

string IPUFpath = SpecialDirPath("Igor Pro User Files",0,1,0) // guaranteed writeable path in IP6
string batchFileName = "ExecuteContin.bat"
variable refNum

NewPath/O/Q IgorProUserFiles, IPUFpath
Open/P=IgorProUserFiles refNum as batchFileName // overwrites previous batchfile

string exeStr, inStr, outStr
exeStr = pathStr + "contin.exe"
inStr = pathStr + inputName
outStr = pathStr + outputName
string cmdStr = exeStr + "<" + inStr + ">" + outStr
fprintf refnum, "cmd/c \"%s\"", cmdstr
Close refnum

ExecuteScriptText/B "\"" + IPUFpath + "\\" + batchFileName + "\""

End