Search the Legacy Support Archive (up to v2020)
  1. Read-only archive (2005–2024). Posting is closed. Need help with MediaLab or DirectRT 2027? Email service@empirisoft.com.

    All words · “exact phrase” · -leave out

    Advanced search

Pass the subjectid to another executable file (case 27)

  1. #1

    Pass the subjectid to another executable file (case 27)

    I want to launch an exe from the questionnaire and pass the subjectid (and condition number) from MediaLab through the command line parameters. Is this possible?

    Example

    c:\mousetracker\runner.exe in the filename field for the Executable item. Then in the Parameters field

    Code:

    (c-s subjectid)

    If I was running this from the command line it would be c:\mousetracker\runner.exe -s 250 for subject id 250. But I want the subjectid to be passed dynamically from medialab. Is this doable?

  2. #2
    Hi there -- I just spent some time trying to figure this out myself (using MouseTracker as well) and I cobbled together a batch script that appears to work. Writing DOS scripts seems to be a lost art...

    rem **read in first line from ML text file and store in subj variable
    set /p subj=<C:\MediaLab\CurrentSubjectInfo.txt

    rem **split first line into two tokens; subj# is second token
    for /f "tokens=1,2 delims= " %%a in ("%subj%") do set s1=%%a&set s2=%%b

    rem **run MTracker (or whatever program) using current ML subject number
    C:\MouseTracker\runner.exe -s %s2% -f C:\MouseTracker\sample\fruit-veggies.csv


    Copy and paste that code into a text file (Notepad works). When you save the file, be sure to select "All files" under the "Save as type" dropdown. Give the file a .bat extension (e.g., MT.bat). You can save this .bat file in the same folder where your .exp and .que MediaLab files are located, and you can run the .bat file within a .que using the Executable item type.

    The only red flag here is that the paths within the .bat file are NOT relative, so you will need to update the paths to the MediaLab folder and your MouseTracker .csv files to reflect their locations on the specific computer running the .bat file.

    Hope that helps!
    Kurt

  3. #3
    Kurt - thank you! I do not have access to the software until next week, but I'm going to try this out the second I get back. I appreciate your help and this solution seems like exactly what I need. Thanks again!

  4. #4
    Kurt - the batch script works like a champ. Thanks so much.