DDE commands: Adding a variable in "quotes"

Hi

I'm currently using Igor to interface with another piece of software so that I can run and acquire data in loops and other such schemes. I've been doing this using DDE commands.
I particular the one I'd like to use now takes the form:

a=DDEExecute(b,"command 1,2")

Where a and b are strings to manage the data.

The commands passed to the other program usually need to be in quotation marks such as the "command 1,2" above. The command requires integer inputs such as 1 and 2. However I would like to replace one of those integers with a variable such as i. That way I can use a loop to increase 1 and so systematically work through my system.

However, the software doesn't accept anything inside those quotation marks that is not a number. i.e "command 1,i" will not work.

I would appreciate it if someone could let me know if there is a way I can specific the value of my variable i and enter it into the command.

I hope my description is clear, I would be happy to provide more details if needed.

Thanks

A



aqshaw wrote:
...
I particular the one I'd like to use now takes the form:

a=DDEExecute(b,"command 1,2")

Where a and b are strings to manage the data.
...
However, the software doesn't accept anything inside those quotation marks that is not a number. i.e "command 1,i" will not work.

I would appreciate it if someone could let me know if there is a way I can specific the value of my variable i and enter it into the command.


Assume that parameters ga and gb are globals, not locals. This should work ...

string cmdStr, a, b
variable ic
... // define string b
string/G ga, gb
for (ic = 1; ic < end; ic+=1)
   gb = b  // copy over string to global b
   sprintf cmdStr "ga = DDExecute(gb,\"command 1,%d\")", ic
   Execute/Q cmdStr
   a = ga // capture back return to global a
endfor


--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville