Dynamically controlling finishpage in batch files


Author
Message
AKrishna
AKrishna
Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)
Group: Forum Members
Posts: 113, Visits: 382
Dear all,

I've run up against a problem I can't diagnose in my current study (aatsrbr3) and would appreciate any help. In this experiment, I'm dynamically assigning finish pages based on the experiment's completion status. I checked the forums and tried to implement code that does this at the batch level, but I think I have a more fundamental problem: when I start the experiment from the launcher, sometimes after the script ends, no page opens at all in my browser. This happens even when I run the main experiment directly rather than the batch file.

The relevant code is as follows:
<expressions>
...
/ EndPage = if (values.ScreenedOut) {
    "https://scripts.millisecond.eu/andreaseder/aatsrbr3/screenedout.htm"
} else if (expressions.AcceptSubmission == "NO") {
    "https://scripts.millisecond.eu/andreaseder/aatsrbr3/nocompletion.htm"
} else if (values.CorrectTrialCounter <= values.CriterionForExtraReward*values.TotalTrialCounter) {
    "https://scripts.millisecond.eu/andreaseder/aatsrbr3/completionbonus.htm"
} else {
    "https://scripts.millisecond.eu/andreaseder/aatsrbr3/completionnobonus.htm"
}
</expressions>

<expt>
...
/ onblockend = [
    values.EndPage = expressions.EndPage; defaults.finishpage = expressions.EndPage
]
</expt>


So I would expect the respective pages to be shown regardless of whether I run the experiment directly or via the batch (which includes code that sets defaults.finishpage to values.EndPage onscriptend).

However, this only seems to work if I quit the experiment early  via Ctrl+Q (which satisfies the constraint for expressions.AcceptSubmission == "NO") - that shows me the expected finish page. If I proceed to the screening part (a simple color discrimination test starting in trial 2) and fail it (satisfying values.ScreenedOut), the experiment ends as expected (the following trial branches into script.abort(true)), but no finish page is opened.

It may have something to do with the call to script.abort, but that's just a guess. Unfortunately, I spent most of today trying to diagnose this error and didn't get a chance to test whether the other finish pages (for completionbonus.htm and completionnobonus.htm) work or not. If anyone has any ideas, I'd be grateful!

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: 13K, Visits: 102K
AKrishna - 8/28/2024
Dear all,

I've run up against a problem I can't diagnose in my current study (aatsrbr3) and would appreciate any help. In this experiment, I'm dynamically assigning finish pages based on the experiment's completion status. I checked the forums and tried to implement code that does this at the batch level, but I think I have a more fundamental problem: when I start the experiment from the launcher, sometimes after the script ends, no page opens at all in my browser. This happens even when I run the main experiment directly rather than the batch file.

The relevant code is as follows:
<expressions>
...
/ EndPage = if (values.ScreenedOut) {
    "https://scripts.millisecond.eu/andreaseder/aatsrbr3/screenedout.htm"
} else if (expressions.AcceptSubmission == "NO") {
    "https://scripts.millisecond.eu/andreaseder/aatsrbr3/nocompletion.htm"
} else if (values.CorrectTrialCounter <= values.CriterionForExtraReward*values.TotalTrialCounter) {
    "https://scripts.millisecond.eu/andreaseder/aatsrbr3/completionbonus.htm"
} else {
    "https://scripts.millisecond.eu/andreaseder/aatsrbr3/completionnobonus.htm"
}
</expressions>

<expt>
...
/ onblockend = [
    values.EndPage = expressions.EndPage; defaults.finishpage = expressions.EndPage
]
</expt>


So I would expect the respective pages to be shown regardless of whether I run the experiment directly or via the batch (which includes code that sets defaults.finishpage to values.EndPage onscriptend).

However, this only seems to work if I quit the experiment early  via Ctrl+Q (which satisfies the constraint for expressions.AcceptSubmission == "NO") - that shows me the expected finish page. If I proceed to the screening part (a simple color discrimination test starting in trial 2) and fail it (satisfying values.ScreenedOut), the experiment ends as expected (the following trial branches into script.abort(true)), but no finish page is opened.

It may have something to do with the call to script.abort, but that's just a guess. Unfortunately, I spent most of today trying to diagnose this error and didn't get a chance to test whether the other finish pages (for completionbonus.htm and completionnobonus.htm) work or not. If anyone has any ideas, I'd be grateful!

The best tip I can give you is to make a small demo script that does nothing but set the finish page according to the same logic in the main script. Then test just that component and work out any issues.

I'll take a look at your experiment as-is, but given that it's thousands lines of code that don't make it easy to hit the various conditions, that is going to take much longer than doing the above.

EDIT: Ah, just saw you mentioned using script.abort() in the script. That will prevent redirection to any finish page. Looking at your batch and script, you should be able to just use a /stop attribute at the <expt> level, i.e.

<expt AATSRBinding>
/ stop = [
    values.ScreenedOut;
]
...
</expt>


instead of

<trial ScreenedOut>
...
/ branch = [
    script.abort(true)
]
...
</trial>


Otherwise the finish page setting logic should work as expected.

Edited Last Month by Dave
AKrishna
AKrishna
Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)
Group: Forum Members
Posts: 113, Visits: 382
Cheers, this was correct. Thanks again!

AKrishna
AKrishna
Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)
Group: Forum Members
Posts: 113, Visits: 382
A quick followup:

So I understand from what you've written that using script.abort(true) is not compatible with setting a finishpage dynamically, presumably because the script aborts without calling the property and passing it to the browser. So far so good, the response to that is to use /stop attributes instead of script.abort(true). In a batch file, this is a little more annoying, as it requires passing the stop condition to each subsequent script via values and parameters, but that's certainly possible. However, a side-effect of this solution is that participants in a Web experiment have each subsequent script start invisibly in the background and then terminate, which means that Inquisit will download all the files required for each subsequent script even if a participant quit beforehand. For smaller experiments, this is fine, but some of my work requires downloads of large video files, which can lead to significant waiting times and bandwidth use even after a participant quits.

So the question is: is there any way to combine dynamic finishpage use with dynamically stopping a batch completely?

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: 13K, Visits: 102K
AKrishna - 9/13/2024
A quick followup:

So I understand from what you've written that using script.abort(true) is not compatible with setting a finishpage dynamically, presumably because the script aborts without calling the property and passing it to the browser. So far so good, the response to that is to use /stop attributes instead of script.abort(true). In a batch file, this is a little more annoying, as it requires passing the stop condition to each subsequent script via values and parameters, but that's certainly possible. However, a side-effect of this solution is that participants in a Web experiment have each subsequent script start invisibly in the background and then terminate, which means that Inquisit will download all the files required for each subsequent script even if a participant quit beforehand. For smaller experiments, this is fine, but some of my work requires downloads of large video files, which can lead to significant waiting times and bandwidth use even after a participant quits.

So the question is: is there any way to combine dynamic finishpage use with dynamically stopping a batch completely?

I don't believe there currently is.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search