batch files dependencies


Author
Message
sdubrow
sdubrow
Distinguished Member (4.8K reputation)Distinguished Member (4.8K reputation)Distinguished Member (4.8K reputation)Distinguished Member (4.8K reputation)Distinguished Member (4.8K reputation)Distinguished Member (4.8K reputation)Distinguished Member (4.8K reputation)Distinguished Member (4.8K reputation)Distinguished Member (4.8K reputation)
Group: Forum Members
Posts: 26, Visits: 143
Hello,

I currently am designing an experiment in which I first run a consent form, then a practice phase and then the actual experiment. I am using batch to run the 3 files. If the participant does not consent, I have the script abort. Likewise if performance is too low I have the script abort. However, I noticed that if I press control-Q rather than selecting no in the consent or performing poorly, it skips ahead to the next script. This is problematic as it is critical people can't perform the task without consenting and completing the practice. Is there any way to make the running of a script in batch dependent on the completion of a prior script, or do you recommend any other solution to this problem? 

Thanks in advance!
Sarah
Tags
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
> if I press control-Q rather than selecting no in the consent or performing poorly, it skips ahead to the next script

That is correct (and the expected behavior). CTRL+Q will terminate the currently running script (similarly, CTRL+B would terminate the currently running block in the currently running script and move on to the next block).

> This is problematic as it is critical people can't perform the task without consenting and completing the practice.

Two thoughts: Unless explicitly made aware of the CTRL+Q key combination, most participants would not know about it and thus instances of the above should be rare. Any occurring instances should also be identifiable by various means: In most cases, you'd find CTRL+Q logged in the respective data file's response column, or the data file would be evidently incomplete or missing entirely (e.g. when skipping over the training script). I'm not sure whether that's enough to alleviate your concerns, but it's worth pointing out.

Beyond that:

> Is there any way to make the running of a script in batch dependent on the completion of a prior script,

No, I at least cannot think of any way to define such a dependency given currently available features.

> or do you recommend any other solution to this problem?

You would have to abandon the separate scripts / batch approach, and instead fuse the three components -- consent, practice, and experiment proper -- into a single script. While this would enable you to terminate the procedure fully in case any of the criteria (no consent, underperforming during practice) are not met, it would however not necessarily resolve the issue entirely: A participant willing to "cheat" could still use CTRL+B to e.g. skip over the consent or practice block(s).

Hope this helps.

seandr
seandr
Supreme Being (142K reputation)Supreme Being (142K reputation)Supreme Being (142K reputation)Supreme Being (142K reputation)Supreme Being (142K reputation)Supreme Being (142K reputation)Supreme Being (142K reputation)Supreme Being (142K reputation)Supreme Being (142K reputation)
Group: Administrators
Posts: 1.3K, Visits: 5.6K
Actually, this can be achieved using script.abort function. The function takes a single boolean parameter. If the parameter is left out or set to true, the entire batch is aborted:

script.abort();
script.abort(true);

If the parameter is set to false, only the current script is aborted. 


script.abort(false);


More info on script.abort() here: http://www.millisecond.com/support/docs/v5/html/viewer.htm#language/functions/abort.htm

Also, check out the Consent Form Demo from the Tutorials page in our library, this shows how to do exactly what you are trying to do.

http://www.millisecond.com/download/library/Tutorials/

-Sean
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
Thanks for the input, Sean!

Perhaps I misunderstood the original question, but I *think* sdubrow is already using script.abort().

However, even if (some of) the scripts involved here would abort the entire batch due to some criterion not being met (no consent given, substandard practice performance), it would *still* be possible to use CTRL+Q in e.g. the practice script and advance to the test script *without* meeting the performance criterion and without triggering the abort function. At least that is my understanding (of both the original question as well as the intended behavior of CTRL+Q and script.abort()).

Please correct me if I'm wrong!

EDIT: To illustrate the above, consider the attached scripts. If the response to the consent question in consent_script.iqx is "No.", the entire <batch> will be terminated via script.abort() as pointed out by Sean. However, by pressing CTRL+Q while on the consent page, it is possible to advance to actual_script.iqx without answering the consent question in the affirmative. [1]

[1] In this particular case, it is actually possible to prevent that by rephrasing the logic a little bit and doing

/ ontrialend = [if (radiobuttons.consentrb.response != "Yes.") script.abort(); ]

instead of

/ ontrialend = [if (radiobuttons.consentrb.response == "No.") script.abort(); ]

It's not clear to me that there is a solution that would be universally applicable to more complex abort-criteria (e.g. based on some performance metrics calculated at runtime).



Attachments
batch_script.iqx (822 views, 79 bytes)
consent_script.iqx (873 views, 328 bytes)
actual_script.iqx (786 views, 263 bytes)
Edited 8 Years Ago by Dave
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search