Randomization in Qualtrics using Photos or Graphics and Loop and Merge

你。 提交于 2019-11-28 11:34:39
bill999

It turns out that there is a much better faster way to do this than the 1000 blocks fix.

There is a bunch of stuff going on to accomplish it, but it is possible.

First, one needs to put the photos into Qualtrics through the Graphics Library. The best way to do this is to simply drag and drop the photos into the desired location. Luckily one does not have to do this one-by-one. Make sure that they are in the order you want.

Second, create a block with a "question" where you want the random photo to appear. This block should also have all 6 questions.

Third, create a column in a spreadsheet (in, eg. Excel) of the URLs corresponding to the photos. This should be in order. One way to do this is mentioned at the bottom.

Fourth, go to the Loop and Merge option for this block. Copy and paste the column of URLs to, say, Field 1. Luckily this option exists and one does not have to do this one-by-one either. A sidenote is that if one changes the numbers in the gray boxes to the left of the rows, this changes what appears in the results. But there is no apparent way to change these more than one-by-one at a time.

Then you should be all set.

Finally, a little bit about how to get the URLs of the photos. Once again, make sure the photos in the library are in the order you want. Then you can use web scraping to scrape the image names, which can then be put into the proper URL. I used Python's Selenium and BeautifulSoup to accomplish this. Here is what I did, using a mac. The code at least gives you the idea:

from bs4 import BeautifulSoup
import codecs
import os
from selenium import webdriver
import re

chromedriver = "File path to /chromedriver"
os.environ["webdriver.chrome.driver"] = chromedriver
driver = webdriver.Chrome(chromedriver)

*In the Chrome browser that has appeared, manually navigate to the photos library page, then:

abc = driver.find_elements_by_css_selector(".thumbframe")    
file = codecs.open('outputURLs.txt', 'w', encoding = 'utf-8')
urls = {}
for i in range(0,len(abc)):
    h = abc[i].get_attribute("innerHTML")
    soup = BeautifulSoup(h)
    t = soup.find_all("img", attrs={"p4":re.compile('.*')})
    urls[i] = t[0]['p1']
    file.write("<img src=*Qualtrics Path/Graphic.php?IM=" + urls[i] + "/> + '\n')

One can find the proper first part to stick in "Qualtrics Path" by, eg. going to the Qualtrics Survey Editor, inserting a photo using Rich HTML Editing (or something similar), inserting the photo, clicking on View Source, and then looking at the pattern file path to use. It may begin with something like https://qualtrics.com/...

Then copy the results into a spreadsheet program and you should be ready to copy and paste.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!