如何在Qulatrics中循环播放数百张图像-实施代码所需的帮助 [英] How to loop over hundreds of images in Qulatrics - help needed to implement code

查看:145
本文介绍了如何在Qulatrics中循环播放数百张图像-实施代码所需的帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Qualtrics来获得700幅图像的评分(即,参与者必须指出他们对图像的评价是正面还是负面).每个图像的问题都会完全相同,但是似乎没有简单的方法只创建一次问题然后遍历我希望参与者评分的所有图像.显然,我真的不想写同样的问题700次.

我在此处的Stack Overflow上找到了一个相关的答案,似乎提出了一个好的解决方案-此处为:.但是,我的问题并非仅仅是此问题的重复,因为我在底部运行Web抓取代码时遇到了麻烦(我是一个经验不足的编码员,对Python的了解有限),因此还有一些后续问题.

我尝试以多种不同的方式运行上述代码(我有BeautifulSoup和Selenium):

1)使用建议的所有代码创建一个.py文件(例如getURL.py),然后只需使用以下命令从PowerShell中运行它(我知道如何运行python代码的唯一方法)

python getURL.py

这将打开Chrome浏览器(数据:,),但最后创建的文件为空.我猜想当我导航到该库时,代码已经运行并到达了for循环的结尾.

2)我尝试在PowerShell的Python解释器中逐行运行它,如下所示:我将经过第一个程序段,将启动浏览器,然后导航至浏览器中的照片库(除了在浏览器中建立网站之外,我还应该做其他事情吗?).完成此操作后,我将使用for循环进入下一个代码块-将其作为一个块或逐行粘贴到解释器中,但python似乎似乎不执行该操作.

有人可以告诉我如何运行该代码吗?

另外:有人知道一种更简单的方法吗:a)使Qualtrics遍历图像,或b)快速获得700个URL的列表吗?

非常感谢您的帮助.

解决方案

您没有说图像的存储位置.如果将它们存储在Qualtrics中,则非常简单:

  1. 获取照片URL或图像ID的列表(如果照片存储在Qualtrics库中,请转到帐户设置/质量ID".然后单击存储照片的库.复制图像ID并将其粘贴到电子表格中.)
  2. 根据需要编辑电子表格.
  3. 将电子表格中的网址或图片ID复制并粘贴到循环&合并设置.可以一次完成所有操作.
  4. 在循环中创建您的问题&合并块.包含html< img>标记在适当的位置.您将通过url或图片ID将其传递到src属性中的相应位置.例如,如果使用的图像ID在字段1中具有名称,在字段2中具有图像ID,则html可能如下所示:

    < img src ="https://survey.qualtrics.com/ControlPanel/Graphic.php?IM=${lm://Field/2}" alt ="$ {lm://Field/1 }"border =" 0>

I would like to use Qualtrics to get ratings for over 700 images (i.e., participants will have to indicate how negative or positive they find them). The question will be exactly the same for each image, yet there seems to be no straightforward way to just create the question once and then loop over all the images I want participants to rate. Obviously, I don't really want to write the same question 700 times.

I found a relevant answer here on Stack Overflow that seems to suggest a good solution - here it is: Randomization in Qualtrics using Photos or Graphics and Loop and Merge . My question, however, is not a mere duplicate of this, as I have troubles running the web scraping code at the bottom (I am a very inexperienced coder with limited Python knowledge), thus have some follow-up questions.

I tried running the above mentioned code a number of different ways (I have BeautifulSoup and Selenium):

1) create a .py file (e.g., getURL.py) with all the code suggested, and then just run it from the PowerShell (the only way I know how to run python code) with

python getURL.py

This opens up a Chrome browser (data:,), but the file it creates in the end is empty. I'm guessing by the time I navigate to the library the code has already run and reached the end of the for loop.

2) I tried running it line by line in the Python interpreter in the PowerShell, like this: I would go through the first block, that would bring up the Browser, then I'd navigate to the photo library within the browser (am I supposed to do anything other than just brining up the site in the browser?). Once that's done I'd move on to the next block of code with the for loop - I'd paste it into the interpreter, either as a block or line by line - but python just doesn't seem to execute that.

Could anyone tell me how to run that code?

ALTERNATIVELY: does anyone know an easier way a) to get Qualtrics to loop over images, or b) to get a list of 700 URLs quickly?

Thank you very much for the help.

解决方案

You didn't say where the images are stored. If they are stored in Qualtrics this is fairly easy:

  1. Get a list of photo urls or image ids (If photos are stored in your Qualtrics library, go Account Setting/Qualtrics IDs. Then click on the library where the photos are stored. Copy the image ids and paste them in a spreadsheet.)
  2. Edit your spreadsheet as needed.
  3. Copy and paste your urls or image ids from the spreadsheet into the loop & merge setup. This can be done all at one time.
  4. Create your question in the loop & merge block. Include an html <img> tag in the appropriate place. You'll pipe your url or image id into the appropriate place in the src attribute. For example, if you are using image ids with a name in field 1 and the image id in field 2, the html might look like:

    <img src="https://survey.qualtrics.com/ControlPanel/Graphic.php?IM=${lm://Field/2}" alt="${lm://Field/1}" border="0">

这篇关于如何在Qulatrics中循环播放数百张图像-实施代码所需的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆