PDA

View Full Version : Using EvalDeferred commands in sequence


SirCharles
10-27-2005, 07:25 PM
I am trying to do a script where I wanna use several eval deffered command in sequence to run several differet scripts. Trick is that they have to happen in the correct order.

sending the commands like this gets inconsistant results:

evalDeferred $cmd1;
evalDeferred $cmd2;
evalDeferred $cmd3;
evalDeferred $cmd4;

It usually ends up running the commands in this order.

cmd2
cmd1
cmd3
cmd4

which is not what I would expect. Is there anyway to make sure these all run in the correct order that I sent the commands in?

-Charles

jtilden20
10-28-2005, 05:18 AM
You might want to try wrapping your sequence of a command in a procedure, then executing that procedure.

global proc cmds()
{
cmd1;
cmd2;
etc...
}

global proc stuff()
{
// Do some stuff
evalDeferred("cmds");
}


or alternatively, you can build a semicolon list of sequential commands, and then execute them:

global proc stuff()
{
evalDeferred($cmd1 + ";" + $cmd2 + ";" + etc);
}

or you could probably get away with using just eval statements. Those usually behave pretty well and execute in order. I find myself very rarely having to use evalDeferred.

CGTalk Moderation
10-28-2005, 05:18 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.