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

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

问题描述

我想使用 Qualtrics 来获得 700 多张图像的评分(即,参与者必须指出他们发现它们的负面或正面的程度).每个图像的问题将完全相同,但似乎没有简单的方法来创建问题一次,然后循环遍历我希望参与者评分的所有图像.显然,我真的不想写同样的问题 700 次.

我在 Stack Overflow 上找到了一个相关的答案,似乎提出了一个很好的解决方案 - 在这里:使用照片或图形以及循环和合并在 Qualtrics 中进行随机化 .然而,我的问题不仅仅是这个问题的重复,因为我在底部运行网络抓取代码时遇到了麻烦(我是一个非常缺乏经验的编码员,Python 知识有限),因此有一些后续问题.

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

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

python getURL.py

这会打开一个 Chrome 浏览器(data:,),但它最终创建的文件是空的.我猜当我导航到库时,代码已经运行并到达 for 循环的末尾.

2) 我尝试在 PowerShell 中的 Python 解释器中逐行运行它,如下所示:我将通过第一个块,这将打开浏览器,然后我将导航到浏览器中的照片库(除了在浏览器中打开网站之外,我是否应该做任何其他事情?).完成后,我将使用 for 循环转到下一个代码块 - 我会将它粘贴到解释器中,作为一个块或一行一行 - 但 python 似乎并没有执行它.

谁能告诉我如何运行该代码?

或者:有谁知道更简单的方法 a) 让 Qualtrics 循环图像,或者 b) 快速获取 700 个 URL 的列表?

非常感谢您的帮助.

解决方案

您没有说明图像的存储位置.如果它们存储在 Qualtrics 中,这很容易:

  1. 获取照片网址或图像 ID 列表(如果照片存储在您的 Qualtrics 库中,请转到帐户设置/Qualtrics ID.然后单击存储照片的库.复制图像 ID 并将其粘贴到电子表格中.)
  2. 根据需要编辑您的电子表格.
  3. 将电子表格中的网址或图片 ID 复制并粘贴到循环中合并设置.这可以一次性完成.
  4. 在循环中创建您的问题 &合并块.包括一个 html 标记在适当的位置.您将通过管道将您的 url 或图像 ID 传送到 src 属性中的适当位置.例如,如果您在字段 1 中使用具有名称且在字段 2 中使用图像 id 的图像 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天全站免登陆