pause function

352 views
Skip to first unread message

Yan Yu

unread,
Nov 11, 2009, 10:09:50 AM11/11/09
to e-p...@googlegroups.com
Hi Eprimers,
 
I used a script to excute the pause function, however, during the experiment, whenever I pause it a second time, eprime will quit the task.
My knowledge on scripting is minimal. I am wondering if anybody can help me out.
 
Here is the inline script that I placed at the beginning of each block.
 
 
'Check for UserBreakState
'Pause2 is run only if Ctrl+Shift is pressed
If (GetUserBreakState <> 0) Then
 'Incorrect CLng Object reference Pause2.InputMasks.Add Keyboard.CreateInputMask("{SPACE}", "", CLng(Pause.Duration), CLng("1"), ebEndResponseActionTerminate, CLogical("Yes"), "", "", "ResponseMode:All ProcessBackspace:Yes")
 NetStation_SendTrialEvent c, Pause2
    NetStation_SendTRSPEvent c, Pause2
 Pause2.InputMasks.Add Keyboard.CreateInputMask("{SPACE}", "", CLng(Pause2.Duration), CLng("1"), ebEndResponseActionTerminate, CLogical("Yes"), "", "", "ResponseMode:All ProcessBackspace:Yes")
 Pause2.Run
 'Added code
 SetUserBreakState 0
End If
 
 
Thanks a lot,
 
Yan
 

liwenna

unread,
Nov 11, 2009, 10:36:01 AM11/11/09
to E-Prime
Hey Yan,

I don't really have a solution (as I never used this parallelport
config thing and I have no idea what the function of 'userbreakstate'
is for...) but that is probably where your problem lies. As you can
see in line three (If (GetUserBreakState <> 0) Then ) all the script
between 'Then' and 'End If' will only be executed if userbreakstate is
NOT (<>) 0. In the forelast line of the piece of code you posted
(SetUserBreakState 0) userbreakstate is set to 0 and therefore this
code cannot run twice (seeing as "If (GetUserBreakState <> 0)" will no
longer be valid after it ran once).

I think that that's the source of your problem, but I unfortunately
don't have a solution (other than simply removing both lines but that
probably doesn't do the trick) and it also does not explain why e-
prime quits altogether when you try it twice...


So for what it's worth: I hope the above is somewhat helpful.
Hopefully others can shine some light on the whole userbreakstate-
thing... what and why and all that.

Best,

liwenna

Daniela Pfabigan

unread,
Nov 11, 2009, 11:11:09 AM11/11/09
to e-p...@googlegroups.com
hi!

you could try the following script lines which we modified a little bit
after downloading them from PST website or from an user forum and insert
any lines to send information via the parallel port

If (Get*UserBreakState* <> 0) Then
Display.Canvas.Clear
Display.Canvas.Text 150, 150, "Unexpected break!"
Sleep 1000

Mouse.ShowCursor True
Dim r As Integer


r = AnswerBox( "Please select if you are ready:" & chr(10)+chr(13), "Continue")
Set*UserBreakState* 0

End If


Cheers,
Daniela

liwenna schrieb:

Yan Yu

unread,
Nov 11, 2009, 6:47:12 PM11/11/09
to e-p...@googlegroups.com
Hi liwenna & Daniela,
 
Thanks for your reply. I tried the suggestion from both of you.  
Daniela's script generated the following error message
 "Encountered: '*'
expecting: <consonant>, <identifier>, <function>, system.
 
Then my colleague suggested me delete the two lines about netstation, it works fine now.
 
I appreciate your input!
 
Yan
Reply all
Reply to author
Forward
0 new messages