Howdy, Stranger!

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

Supported by

[solved] Copying and pasting text displayed in OpenSesame into a different program

edited September 2014 in OpenSesame

Hello,

I am relatively new to OpenSesame and just struck a problem - would appreciate any help I can get! I am trying to run an experiment with a variety of tasks - including one about virtual worlds, which would have to be interlaced with all the rest.

A set of online virtual environments (VEs) would be selected for the experiment, and participants would be shown one of them randomly, and they would then have a predetermined length of time to explore it. Since these VEs would be outside OpenSesame, I would like participants to simply be shown the URL for each, which they could then copy and paste into another program to access them. This would save some time and reduce the margin for error when participants would search for the environments.

The problem, however, is I can't seem to get OpenSesame to allow copying and pasting, either from a sketchpad item, or a form, as they are being displayed during the experiment... Ideally, during the experiment I would have liked a sketchpad (or anything, really) to appear with the VE's URL written on it, which participants could then simply copy and paste into a different program...

Any advice would be much appreciated!
Many thanks!
AC

Comments

  • edited 1:31AM

    Hi,

    You cannot easily copy stuff from an OpenSesame experiment to the clipboard, because what you see during an experiment is essentially a slideshow of pictures, which the operating system doesn't know how to copy/paste from.

    In your case, would it be sufficient to have OpenSesame launch a browser automatically with a specific URL? That might even be more convenient for the user, and is much easier to implement. You can see an example of that in this discussion:

    Cheers!
    Sebastiaan

  • edited August 2014

    Thanks loads!
    Based on that example, I was able to find this solution for instance:

    import subprocess
    
    if self.get('open_cogsci') == 'yes':
    
        subprocess.Popen(['C:\Program Files (x86)\CtrlAltStudio-Viewer-Alpha\CtrlAltStudio-Viewer-Alpha.exe', 
    'http://maps.secondlife.com/secondlife/Psycho%20Chaos/114/163/806'])
    

    ...This is because in my case the program to be launched is not a regular internet browser, but a SecondLife viewer... Even if the current solution works, the problem now becomes that it does so only by opening more instances of the viewer, instead of changing the URL in the same viewer. Since my experiment would contain quite a few virtual environments, this would become a problem very fast... Could you please help with finding a way to just change the URL without opening more instances of the subprocess?

    I considered something like this:

    import webbrowser
    
    BROWSER=webbrowser.get('C:\Program Files (x86)\CtrlAltStudio-Viewer-Alpha\CtrlAltStudio-Viewer-Alpha.exe')
    
    if self.get('open_cogsci') == 'yes':
    
        BROWSER.open('http://maps.secondlife.com/secondlife/Psycho%20Chaos/114/163/806', new=0)
    

    ...which of course doesn't work, as I don't really know what I am doing... :-D

    Again, any help would be deeply appreciated!
    Thanks for the previous suggestion and all your work with OpenSesame in general!
    AC

  • edited 1:31AM

    Even if the current solution works, the problem now becomes that it does so only by opening more instances of the viewer, instead of changing the URL in the same viewer.

    This depends on the behavior of the program. Most webbrowsers will check to see if another instance is already running, and, if so, open the url in a new tab within an existing instance. But apparently the software that you use doesn't do that.

    In that case, you may want to use the clipboard like you initially had in mind. But you'll need to install some module so that you can copy stuff to the clipboard, such as pyperclip. You should be able to download the source file (see link below), and extract the pyperclip folder within it (so the folder with only an __init__.py file in it) to the OpenSesame program folder. Once you've done that, you should be able to access the clipboard as shown in the examples on the pyperclip page.

    Cheers!
    Sebastiaan

  • edited 1:31AM

    Hi,

    Thanks again for your help! I really appreciate it. :)

    Coincidentally, it seems that an upgraded version of CtrlAltStudio does check if an instance is already running, or at least that's what I infer from what happened: I upgraded a couple of days ago and now the URLs get changed in the same instance of the viewer...

    Hopefully my assumption is correct and now it will keep working with the code I provided above!

    I will keep pyperclip in mind though, might come in handy in the future!

    Thanks again!
    Caterina

  • edited 1:31AM

    Love it when a problem solves itself! Marking this as solved.

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 http://45.77.173.118/ 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