Empirisoft Support

    Welcome to Empirisoft Support
Results 1 to 4 of 4

Thread: Pass the subjectid to another executable file (case 27)

  1. #1
    Join Date
    Jul 2012
    Posts
    4

    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?
    Last edited by sdavis; 07-19-2012 at 10:46 AM.

  2. #2
    Join Date
    Jul 2012
    Posts
    1
    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...

    Code:
    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
    Join Date
    Jul 2012
    Posts
    4
    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
    Join Date
    Jul 2012
    Posts
    4
    Kurt - the batch script works like a champ. Thanks so much.

Similar Threads

  1. executable window closes immediately
    By samhaas in forum MediaLab Older Versions: Troubleshooting
    Replies: 1
    Last Post: 01-20-2012, 12:02 PM
  2. Creating an executable file
    By pucgun in forum MediaLab Older Versions: How Do I...
    Replies: 0
    Last Post: 04-27-2011, 04:11 AM
  3. Use an Executable Item that Needs to Open a Specific File?
    By clawton in forum MediaLab Older Versions: How Do I...
    Replies: 4
    Last Post: 11-06-2007, 05:33 AM
  4. Runnning an MDE Executable?
    By jarvis24 in forum MediaLab Older Versions: Troubleshooting
    Replies: 1
    Last Post: 09-27-2006, 12:52 PM
  5. Passing the subject and/or condition ID to an Executable
    By jarvis24 in forum MediaLab Older Versions: How Do I...
    Replies: 1
    Last Post: 09-05-2006, 12:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •