David,<div><br></div><div>thanks for your suggestion. I used your code and it worked fine. However, the code does not work with matlab. The same error you had earlier ("Can't find window") appears. Nevertheless, Matlab starts and even executes a script if I am using sth like "id = Shell("matlab -r script.m",1) ". So in principle it works but of course I don't want to have this error message since that interrupts the whole program.</div><div><br></div><div>Do you have any idea how to work around this window error problem?</div><div><br></div><div>Best,</div><div>Tobias</div><div><br></div><div><br><br>Am Donnerstag, 9. Mai 2013 22:06:50 UTC+2 schrieb McFarlane, David:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">Tobias,
<br>
<br>The "AppActivate" topic in the E-Basic Help facility contains a
<br>complete code example. I went ahead and pasted the complete example
<br>into good-old EP1 E-Run to test it out myself. Sadly, it does not
<br>work. First, it fails to declare its "id" variable. Fixing that got
<br>me to a "Path/File access error". Substituting "notepad.exe" for
<br>"clock.exe" then got me to a "Can't find window" error on the
<br>AppActivate line. Using the id variable instead of a window name
<br>string there got me to a "Can't find window" error on the AppClose
<br>line. Once again using the id variable instead of a window name
<br>string got me a fully working example. So here is the fully working result:
<br>
<br>Sub Main()
<br> dim id
<br> id = Shell("notepad.exe",1)
<br> AppActivate id
<br> Sleep(2000)
<br> AppClose id
<br>End Sub
<br>
<br>Of course, to test this in an E-Studio inline object (instead of EP1
<br>E-Run), you need to leave out the first and last lines (Sub Main(), End Sub).
<br>
<br>And that is everything I know about this business :).
<br>
<br>-----
<br>David McFarlane
<br>E-Prime training
<br>online: <a href="http://psychology.msu.edu/Workshops_Courses/eprime.aspx" target="_blank">http://psychology.msu.edu/<wbr>Workshops_Courses/eprime.aspx</a>
<br>Twitter: @EPrimeMaster (<a href="https://twitter.com/EPrimeMaster" target="_blank">https://twitter.com/<wbr>EPrimeMaster</a>)
<br>
<br>
<br>At 5/9/2013 03:47 PM Thursday, Tobias wrote:
<br>>Thanks for your postings!
<br>>
<br>>I tried with the shell function first because that seems to be the
<br>>easiest way. To begin with I just wanted to try starting matlab from
<br>>within E-Prime, without any matlab script.
<br>>
<br>>I used this E-Prime script:
<br>>
<br>>Dim snd as String
<br>>Dim MyAppID As String
<br>>snd = "C:\Program Files\MATLAB\R2012a\bin\<wbr>matlab.exe"
<br>>MyAppID = Shell(snd)
<br>>
<br>>... and the following error message occured:
<br>>"The following runtume error occurred: Device I/O error, Line:205;
<br>>Error Number 57"
<br>>
<br>>So I had a closer look at the link you posted (by this Matthias guy)
<br>>and thought maybe I need to pause E-Prime. So I used this code:
<br>>
<br>>"Dim snd as String
<br>>Dim MyAppID As String
<br>>Rte.DeviceManager.Suspend
<br>>snd = "C:\Program Files\MATLAB\R2012a\bin\<wbr>matlab.exe"
<br>>MyAppID = Shell(snd,0) 'use 0 instead of 1 hide the wmp
<br>>sleep(10000)"
<br>>
<br>>However, same error message :-(
<br>>
<br>>According to the interwebs, this error message has to do with
<br>>external devices. But I don't use any. Puzzling!
<br>>Do you have any script for E-Prime that just starts some program,
<br>>whatever it may be?
<br>>
<br>>Thanks a lot,
<br>>Tobias
<br>>Rte.DeviceManager.Resume
<br>>
<br>>
<br>>Am Dienstag, 7. Mai 2013 16:26:08 UTC+2 schrieb McFarlane, David:
<br>>Can you start your MATLAB script from a command line? If so, then
<br>>you might try using the E-Basic "Shell()" function, see that topic in
<br>>the E-Basic Help facility. For a user example of this, see
<br>><<a href="http://support.pstnet.com/forum/Topic1338-8-2.aspx" target="_blank">http://support.pstnet.com/<wbr>forum/Topic1338-8-2.aspx</a>><a href="http://support.pstnet.com/forum/Topic1338-8-2.aspx" target="_blank">http:<wbr>//support.pstnet.com/forum/<wbr>Topic1338-8-2.aspx</a>
<br>>. This still
<br>>leaves a lot to be desired, and beyond that I have no idea.
<br>>
<br>>-----
<br>>David McFarlane
<br>>E-Prime training
<br>>online:
<br>><<a href="http://psychology.msu.edu/Workshops_Courses/eprime.aspx" target="_blank">http://psychology.msu.edu/<wbr>Workshops_Courses/eprime.aspx</a>><a href="http://psychology.msu.edu/Workshops_Courses/eprime.aspx" target="_blank"><wbr>http://psychology.msu.edu/<wbr>Workshops_Courses/eprime.aspx</a>
<br>>
<br>>Twitter: @EPrimeMaster
<br>>(<<a href="https://twitter.com/EPrimeMaster" target="_blank">https://twitter.com/<wbr>EPrimeMaster</a>><a href="https://twitter.com/EPrimeMaster" target="_blank">https://twitter.<wbr>com/EPrimeMaster</a>)
<br>>
<br>>/----
<br>>Stock reminder: 1) I do not work for PST. 2) PST's trained staff
<br>>take any and all questions at
<br>><<a href="http://support.pstnet.com/e%2Dprime/support/login.asp" target="_blank">http://support.pstnet.com/e%<wbr>2Dprime/support/login.asp</a>><a href="http://support.pstnet.com/e%2Dprime/support/login.asp" target="_blank">http<wbr>://support.pstnet.com/e%<wbr>2Dprime/support/login.asp</a>
<br>>, and they
<br>>strive to respond to all requests in 24-48 hours, so make full use of
<br>>it. 3) In addition, PST offers several instructional videos on their
<br>>YouTube channel
<br>>(<<a href="http://www.youtube.com/user/PSTNET" target="_blank">http://www.youtube.com/<wbr>user/PSTNET</a>><a href="http://www.youtube.com/user/PSTNET" target="_blank">http://www.<wbr>youtube.com/user/PSTNET</a>
<br>>). 4) If you do
<br>>get an answer from PST staff, please extend the courtesy of posting
<br>>their reply back here for the sake of others.
<br>>\----
<br>>
<br>>
<br>>At 5/7/2013 10:08 AM Tuesday, Cognitology wrote:
<br>> >Hi,
<br>> >Never heard of a way to interface matlab from E-Prime, I'd be
<br>> >interested if anyone would have a way. Of course, you could compile
<br>> >from within matlab and try to go from there, but I suspect the
<br>> >amount of effort would really not be worth it. You could, of course,
<br>> >just forego e-prime and try Psychtoolbox.
<br>> >Best,
<br>> >Michiel
<br>> >
<br>> >From: <mailto:<a>e-p...@googlegroups.<wbr>com</a>><a>e-p...@googlegroups.com</a>
<br>> >[mailto:<a>e-p...@googlegroups.<wbr>com</a>] On Behalf Of Tobias
<br>> >Sent: 7. May 2013 13:31
<br>> >To: <mailto:<a>e-p...@googlegroups.<wbr>com</a>><a>e-p...@googlegroups.com</a>
<br>> >Subject: Re: Polhemus
<br>> >
<br>> >To be more precisely: What I need to do is to start a matlab script
<br>> >from E-Prime.
<br>> >"Presentation" has some plugin to connect with Matlab, but E-Prime
<br>> >seems not to have that. But there may be another way...
<br>> >
<br>> >Am Montag, 6. Mai 2013 15:39:19 UTC+2 schrieb Tobias:
<br>> >Dear all,
<br>> >
<br>> >Does anyone have experience with running Polhemus Liberty (the
<br>> >motion tracking system) with E-Prime?
<br>> >
<br>> >Best,
<br>> >Tobias
<br>
<br></blockquote></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups "E-Prime" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an email to e-prime+unsubscribe@googlegroups.com.<br />
To post to this group, send email to e-prime@googlegroups.com.<br />
To view this discussion on the web visit <a href="https://groups.google.com/d/msg/e-prime/-/XmE7DYWkE9EJ">https://groups.google.com/d/msg/e-prime/-/XmE7DYWkE9EJ</a>.<br />
For more options, visit <a href="https://groups.google.com/groups/opt_out">https://groups.google.com/groups/opt_out</a>.<br />
<br />
<br />