Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Adding progress bar for osweb


I'm trying to add a progress bar for an online experiment, basically changing the height of a drawn rectangular bar on a sketch pad within a loop. I've tried to add a javascript at the beginning to set up a counter, but I can't get the height to be a multiple of the counter variable. Is this the usual way of adding progress bars? How can I make it work? Any help would be greatly appreciated.

Thanks a lot!



  • edited June 2020

    Hi @Lily ,

    You can make the height of the progress bar variable by using a tiny bit of Java-script inline coding in an inline_javascript item. More precisely, you could set and update experimental variables using the vars object, as described in this article:

    I attached an simple example script to make the progress bar higher after each trial.

    Hope this helps!



    Did you like my answer? Feel free to Buy Me A Coffee :)

  • Hi Lotje,

    Got it to work! Thank you very much!



  • Hi @lvanderlinden,

    I am quite a novice to OpenSesame, so please excuse me if I ask such basic questions. I also need to present a progress indicator on each screen where I present a trivia question (I'll be presenting a total of 110 trivia questions one at a time), but I can't figure out how to do so. Referring to the the attachment that you kindly posted above ("6275.osexp"), I dragged the "inline_javascript" item under the sketchpad where I present a trivia question and typed in "vars. my_height [...]" as shown in the screenshot below. 

    However, the following error message was generated when I test-ran the experiment. 

    Could you please tell me what I did wrong?

    By the way if it's not too difficult, rather than the vertical progress bar that is discussed in the posts above, I am hoping to add numbers to indicate the participant's progress. For example, as in the screenshot (red arrow) below, if the participant is looking at the first question out of 110 questions, it will show 1/110 (and then 2/110 on the second question, 3/110 on the third question, and so on). I will be randomizing the order of questions for each participant, so I can't just enter the numbers on each sketchpad - The numbers need to automatically update when each question is presented. Can this type of progress indicator be created in OpenSesame?

    Lastly, once I figure out how to add a progress indicator, I am curious if it would be possible to add progress indicators to the entire 110 trials (trivia questions) all at once, or with just a few clicks or scripts, instead of dragging the "inline_javascript" under each trial one at a time because that will take forever. I would sincerely appreciate any advice.

    Thank you so much,


  • Hi @ypark133,

    Just dragging the code written for another program into yours is likely to present problems. You need to adapt it to your task. In the present case, based on your description, the error message is telling what's going on: when the code is being run the program finds a reference to a variable you have not set before (count_trial_sequence).

    The logic to display progress is the following:

    (1) You set a counter to 0 before the loop cotaining your trials-

    (2) you insert code into trial sequence that is going ti increment that counter by 1 unit

    (3) you use a feedback object to display information in the trial where you want the progress to be displayed.

    Regarding your last question, I refer you to my answer to the other question you posted on the forum: you need a single inline_javascript object because you only need one sequence to code what's going on in a trial. The whole logic of the loop is that the table code for the variables ot be used across whatevebr number of trials (rows) contained in the table. You shoudl not create a different sequence for each trial.

    Hope this helps,


    Buy Me A Coffee

  • Hi @Fab,

    It is a bit confusing that I need to create a feedback item to show a progress indicator because the progress indicator will not depend on the participant's response: Regardless of the reponses given earlier, it will automatically update itself by 1. Also I want the progress indicator to appear within the sketchpad I've created to display the trivia question, like in Figure 1 below.

    So here is what I tried after reading your answers to this and the other posts, as well as documentation on javascript, multiple times. Please excuse me for my shallow understanding of javascript even after reading. 

    Since I wanted the progress indicator to appear on the sketchpad where a trivia question is presented, I placed an inline_javascript item right before that sketchpad and wrote {progress} in the sketchpad (Figures 1 and 2).

    This might sound ignorant, but I also sort of created the variables "count_trial" and "progress" in Figure 3 to avoid the error message that might say those variables do not exist.

    When I test-ran the experiment, I didn't get any error message, but the redbox in Figure 1 displayed a blank rather than a number, and that weird progress indicator appeared in another sketchpad as well that I did not designate ("Hint" sketchpad). I would be really grateful if you could pinpoint what I did wrong or should have done.

    Thank you very, very much.



  • FabFab
    edited March 6

    Hi @ypark133,

    You should use the feedback object instead of a sketchpad, because as I pointed out in my reply to your other message (, sketchpads are drawn before the trial runs, such that it cannot display a value calculated within the trial before the next trial runs. The feecback object is just a display object. It doesn't have to be related to the participant's response. I guess you only get a blank on the very first trial, and only see the progress appear with the fisrt trial's value on trial 2 and so on. This is for the reason I explained earlier: a sketchpad canot display anything that is not set priot to the trial been prepared. So the value of your progress variable, even if it takes the value 1 on the first trial, will not appear on the sketchpads on the first trial because Open Sesame prepares these sketchpad before the trial runs (and so before your code incremeneting the trial is executed). That's why you need to use feedback objects, not sketchpads.

    I'm glad you now used a loop and saw that you don't need to create as many sequences as you have trials.

    Regarding the progress indicator, I can only repeat what I explained in the earlier message. You simply need to create a counter in the form of a variable that gets incremented inside the trial's sequence and use feedback objects instead of sketchpads to display it on the screen. There is no need to create "counter" and "progress" variables inside your loop. It's actually quite simple. I attach a demonstration so that you can see it in action and adapt your task accordingly.

    Hope this helps,


    Buy Me A Coffee

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games