[WARNING] WARNING: DO NOT EDIT THIS FILE DIRECTLY! Use only E-Studio to edit this file. Editing of this file from any other means is not supported and may corrupt the experiment design specification. Technical support will not be able to address any issue in regards to this file format. [Experiment] VersionMajor=1 VersionMinor=2 VersionInternal=1 VersionBuild=85 _VersionPersist=6 Root="SessionProc" Author="Brandon S. Cernicky (Psychology Software Tools)" Abstract="The InputDevice.History property holds information about all of the \r\nresponses received by the corresponding input device \r\n(i.e. Keyboard, Mouse, SRBox, Port) since the start of the \r\nexperiment. Using the input device History, the current state of a \r\nkey or button can be assessed via InLine script.\r\n\r\nThis sample assesses the state of the Q key and the spacebar via \r\nthe Keyboard.History property. During each trial, a message \r\n(i.e. \"Checking the state of the keys now…\") is presented. \r\nImmediately following this message, InLine script is used to check \r\nthe current state of the keys. Feedback about each key is then \r\npresented.\r\n\r\nThis sample can be modified to assess the state of other keyboard \r\nkeys or the buttons from other devices (i.e. mouse, SRBox, etc) as \r\nwell. In the CheckState InLine, simply change the parameters sent \r\nto the GetLastState and/or GetLastResponseData functions. For \r\nexample, to get the state of SRBox button 3, you would use:\r\n\r\nnLastState = GetLastState(\"3\", SRBox)\r\n\r\nNote that the SRBox device must first be added to the experiment \r\nvia the Experiment object's Properties pages." Notes="" Creation=1165863847 [Device0] _VersionPersist=1 OpenDevice=1 Width=640 Height=480 Bpp=16 Name="Display" Class="Display" [Device1] _VersionPersist=1 OpenDevice=0 Channels=2 Samples=22050 Bps=16 Name="Sound" Class="Sound" [Device2] _VersionPersist=1 OpenDevice=1 CollectionMode=3 EmulateDeviceName="" CapsLock=0 NumLock=1 Name="Keyboard" Class="Keyboard" [Device3] _VersionPersist=1 OpenDevice=1 CollectionMode=1 EmulateDeviceName="" OpenMode=0 ShowCursor=0 Name="Mouse" Class="Mouse" [DataFile] WarnBeforeOverwrite=1 WarnIfConvertFailed=1 RemoveERecoveryFile=0 ReceiveFeedbackDuringDataFileConversion=1 LogLevel(2).Name="Block" LogLevel(3).Name="Trial" LogLevel(4).Name="SubTrial" LogLevel(5).Name="LogLevel5" LogLevel(6).Name="LogLevel6" LogLevel(7).Name="LogLevel7" LogLevel(8).Name="LogLevel8" LogLevel(9).Name="LogLevel9" LogLevel(10).Name="LogLevel10" [StartupInfo] DisplaySummary=1 UseDefaults=0 [StartupInfo1] Name="Subject" Prompt="Please enter the Subject Number (1-32767, 0=No Data Logging):" DataType=0 Enabled=1 PromptEnabled=1 Default="1" Min=0 Max=32767 PrivateFlags=268435477 PrivateInfo=1 [StartupInfo2] Name="Session" Prompt="Please enter the Session Number (1-32767):" DataType=0 Enabled=1 PromptEnabled=1 Default="1" Min=1 Max=32767 PrivateFlags=268435477 PrivateInfo=1 [StartupInfo3] Name="Group" Prompt="Please enter Subject's Group (0-32767):" DataType=0 Enabled=0 PromptEnabled=0 Default="1" Min=0 Max=32767 [StartupInfo4] Name="Name" Prompt="Please enter Subject's Name:" DataType=1 Enabled=0 PromptEnabled=0 Default="" MaxLength=255 [StartupInfo5] Name="Age" Prompt="Please enter Subject's Age (0-150):" DataType=0 Enabled=0 PromptEnabled=0 Default="0" Min=0 Max=150 [StartupInfo6] Name="Sex" Prompt="Please enter Subject's Sex:" DataType=2 Enabled=0 PromptEnabled=0 Default="male" Choice(1).Value="male" Choice(2).Value="female" [StartupInfo7] Name="Handedness" Prompt="Enter Subject's Handedness:" DataType=2 Enabled=0 PromptEnabled=0 Default="left" Choice(1).Value="left" Choice(2).Value="right" [StartupInfo8] Name="ResearcherID" Prompt="Please enter Researcher's ID:" DataType=0 Enabled=0 PromptEnabled=0 Default="1" Min=0 Max=32767 [Object0] _Version=65536 _ExtentX=2646 _ExtentY=1323 _StockProps=0 VersionMajor=1 VersionMinor=2 VersionInternal=1 VersionBuild=60 _ItemList="SetupVariables;Introduction;BlockList;Goodbye" _VersionPersist=1 FlowLines(0).Count=4 FlowLines(0).FlowItem(0).Name="SetupVariables" FlowLines(0).FlowItem(1).Name="Introduction" FlowLines(0).FlowItem(2).Name="BlockList" FlowLines(0).FlowItem(3).Name="Goodbye" LogData=1 Name="SessionProc" TypeName="Procedure" Tag="" Notes="" [Object1] _Version=65536 _ExtentX=2646 _ExtentY=1323 _StockProps=0 VersionMajor=1 VersionMinor=2 VersionInternal=1 VersionBuild=60 _ItemList="BlockProc" _VersionPersist=1 VersionMajor=1 VersionMinor=2 VersionInternal=1 VersionBuild=60 Order=0 OrderBy=0 ResetEveryRun=0 HideLevelsWithZeroWeight=0 CycleDef=0 CycleValueSamples=0 CycleValueCondition="" ExitDef=0 ExitValueCycles=1 ExitValueSamples=1 ExitValueSeconds=0 ExitValueCondition="" LoadMethod=0 Filename="" UserAttributes=0 Attributes("Weight").DefaultValue="1" Attributes("Weight").Visible=1 Attributes("Weight").Width=75 Attributes("Weight").OrderIndex=0 Attributes("Nested").DefaultValue="" Attributes("Nested").Visible=1 Attributes("Nested").Width=75 Attributes("Nested").OrderIndex=1 Attributes("Procedure").DefaultValue="TrialProc" Attributes("Procedure").Visible=1 Attributes("Procedure").Width=75 Attributes("Procedure").OrderIndex=2 Levels=1 Levels(1).ValueString="1\t\tBlockProc\t" Name="BlockList" TypeName="List" Tag="" Notes="" [Object2] _Version=65536 _ExtentX=2646 _ExtentY=1323 _StockProps=0 VersionMajor=1 VersionMinor=2 VersionInternal=1 VersionBuild=60 _ItemList="Fixation;Stimulus;CheckState;Feedback" _VersionPersist=1 FlowLines(0).Count=4 FlowLines(0).FlowItem(0).Name="Fixation" FlowLines(0).FlowItem(1).Name="Stimulus" FlowLines(0).FlowItem(2).Name="CheckState" FlowLines(0).FlowItem(3).Name="Feedback" LogData=1 Name="TrialProc" TypeName="Procedure" Tag="" Notes="" [Object3] _Version=65536 _ExtentX=2646 _ExtentY=1323 _StockProps=0 VersionMajor=1 VersionMinor=2 VersionInternal=1 VersionBuild=60 Logging("OnsetDelay").Log=0 Logging("OnsetTime").Log=0 Logging("DurationError").Log=0 Logging("PreRelease").Log=0 Logging("Duration").Log=0 Logging("StartTime").Log=0 Logging("OffsetTime").Log=0 Logging("FinishTime").Log=0 Logging("TimingMode").Log=0 Logging("CustomOnsetTime").Log=0 Logging("CustomOffsetTime").Log=0 Logging("ActionDelay").Log=0 Logging("ActionTime").Log=0 Logging("TargetOffsetTime").Log=0 Logging("TargetOnsetTime").Log=0 Logging("OffsetDelay").Log=0 Logging("RTTime").Log=0 Logging("ACC").Log=0 Logging("RT").Log=0 Logging("RESP").Log=0 Logging("CRESP").Log=0 Logging("Tag").Log=0 _VersionPersist=1 VersionMajor=1 VersionMinor=2 VersionInternal=1 VersionBuild=60 Text="+" ForeColor="black" BackColor="white" BackStyle="opaque" BorderColor="black" BorderWidth="0" X="center" Y="center" Width="100%" Height="100%" XAlign="center" YAlign="center" AlignHorizontal="center" AlignVertical="center" FontName="Courier New" FontSize="18" FontBold="Yes" FontItalic="No" FontUnderline="No" FontStrikeout="No" WordWrap=1 ClearAfter="No" Duration="500" JumpLabel="" TimingMode=0 PreRelease="0" OnsetSync=1 OffsetSync=0 Name="Fixation" TypeName="TextDisplay" Tag="" Notes="" [Object4] _Version=65536 _ExtentX=2646 _ExtentY=1323 _StockProps=0 VersionMajor=1 VersionMinor=2 VersionInternal=1 VersionBuild=60 Logging("OnsetDelay").Log=0 Logging("OnsetTime").Log=0 Logging("DurationError").Log=0 Logging("PreRelease").Log=0 Logging("Duration").Log=0 Logging("StartTime").Log=0 Logging("OffsetTime").Log=0 Logging("FinishTime").Log=0 Logging("TimingMode").Log=0 Logging("CustomOnsetTime").Log=0 Logging("CustomOffsetTime").Log=0 Logging("ActionDelay").Log=0 Logging("ActionTime").Log=0 Logging("TargetOffsetTime").Log=0 Logging("TargetOnsetTime").Log=0 Logging("OffsetDelay").Log=0 Logging("RTTime").Log=0 Logging("ACC").Log=0 Logging("RT").Log=0 Logging("RESP").Log=0 Logging("CRESP").Log=0 Logging("Tag").Log=0 _VersionPersist=1 VersionMajor=1 VersionMinor=2 VersionInternal=1 VersionBuild=60 Text="[Stim]" ForeColor="black" BackColor="white" BackStyle="opaque" BorderColor="black" BorderWidth="0" X="center" Y="center" Width="100%" Height="100%" XAlign="center" YAlign="center" AlignHorizontal="center" AlignVertical="center" FontName="Courier New" FontSize="18" FontBold="Yes" FontItalic="No" FontUnderline="No" FontStrikeout="No" WordWrap=1 ClearAfter="No" Duration="1000" JumpLabel="" TimingMode=0 PreRelease="0" OnsetSync=1 OffsetSync=0 Name="Stimulus" TypeName="TextDisplay" Tag="" Notes="" [Object5] _Version=131072 _ExtentX=2646 _ExtentY=1323 _StockProps=0 VersionMajor=1 VersionMinor=2 VersionInternal=1 VersionBuild=60 _VersionPersist=1 Code="'Declare a variable for holding the numeric state of the Q key.\nDim nLastState As Long\nnLastState = GetLastState(\"Q\", Keyboard)\n\n'Assess the state of the Q key and log a description (i.e. \"down\" or \"up\")\n'in an attribute so that it can be used for feedback later in the experiment.\nIf nLastState = ebStatePress Then\n\tc.SetAttrib \"Q_STATE\", \"down\"\nEnd If\n\nIf nLastState = ebStateRelease Then\n\tc.SetAttrib \"Q_STATE\", \"up\"\nEnd If\n\n'''''''''''''''''''''''''''''''''''''''''''''''''''\n\n'Declare a variable for holding response information about the spacebar.\nDim theResponseData As ResponseData\nSet theResponseData = GetLastResponseData(\"{SPACE}\", Keyboard)\n\n'Assess the state of the spacebar and log a description (i.e. \"down\" or \"up\")\n'in an attribute so that it can be used for feedback later in the experiment.\n'Also log the time at which the last response (press or release) was made.\nIf Not theResponseData Is Nothing Then\n\n\tc.SetAttrib \"SPACE_TIME\", theResponseData.RTTime\n\n\tIf theResponseData.State = ebStatePress Then\n\t\tc.SetAttrib \"SPACE_STATE\", \"down\"\n\tElseIf theResponseData.State = ebStateRelease Then\n\t\tc.SetAttrib \"SPACE_STATE\", \"up\"\n\tEnd If\n\nElse\n\n\tc.SetAttrib \"SPACE_STATE\", \"(assumed) up\"\n\tc.SetAttrib \"SPACE_TIME\", \"(never)\"\n\nEnd If\n\n\n'Set trial number and total trials\nc.SetAttrib \"TrialNum\", c.GetAttrib(c.GetAttrib(\"Running\") & \".Sample\")\nc.SetAttrib \"TotalTrials\", TrialList.Size" Name="CheckState" TypeName="InLine" Tag="" Notes="" [Object6] _Version=131072 _ExtentX=2646 _ExtentY=1323 _StockProps=0 VersionMajor=1 VersionMinor=2 VersionInternal=1 VersionBuild=60 _VersionPersist=1 Code="'Increase the keyboard history\nKeyboard.History.MaxCount = 1024" Name="SetupVariables" TypeName="InLine" Tag="" Notes="" [Object7] _Version=65536 _ExtentX=2646 _ExtentY=1323 _StockProps=0 VersionMajor=1 VersionMinor=2 VersionInternal=1 VersionBuild=60 Logging("OnsetDelay").Log=0 Logging("OnsetTime").Log=0 Logging("DurationError").Log=0 Logging("PreRelease").Log=0 Logging("Duration").Log=0 Logging("StartTime").Log=0 Logging("OffsetTime").Log=0 Logging("FinishTime").Log=0 Logging("TimingMode").Log=0 Logging("CustomOnsetTime").Log=0 Logging("CustomOffsetTime").Log=0 Logging("ActionDelay").Log=0 Logging("ActionTime").Log=0 Logging("TargetOffsetTime").Log=0 Logging("TargetOnsetTime").Log=0 Logging("OffsetDelay").Log=0 Logging("RTTime").Log=0 Logging("ACC").Log=0 Logging("RT").Log=0 Logging("RESP").Log=0 Logging("CRESP").Log=0 Logging("Tag").Log=0 _VersionPersist=1 VersionMajor=1 VersionMinor=2 VersionInternal=1 VersionBuild=60 Text="Trial #[TrialNum] out of [TotalTrials].\n\n\nThe Q appears to be [Q_STATE]\n\n\nThe Spacebar {SPACE} appears to be [SPACE_STATE] and the last transition happened at [SPACE_TIME]\n\n" ForeColor="black" BackColor="white" BackStyle="opaque" BorderColor="black" BorderWidth="0" X="center" Y="center" Width="100%" Height="100%" XAlign="center" YAlign="center" AlignHorizontal="center" AlignVertical="center" FontName="Courier New" FontSize="18" FontBold="Yes" FontItalic="No" FontUnderline="No" FontStrikeout="No" WordWrap=1 ClearAfter="No" Duration="2500" JumpLabel="" TimingMode=0 PreRelease="0" OnsetSync=1 OffsetSync=0 Name="Feedback" TypeName="TextDisplay" Tag="" Notes="" [Object8] _Version=65536 _ExtentX=2646 _ExtentY=1323 _StockProps=0 VersionMajor=1 VersionMinor=2 VersionInternal=1 VersionBuild=60 _ItemList="Instructions;TrialList" _VersionPersist=1 FlowLines(0).Count=2 FlowLines(0).FlowItem(0).Name="Instructions" FlowLines(0).FlowItem(1).Name="TrialList" LogData=1 Name="BlockProc" TypeName="Procedure" Tag="" Notes="" [Object9] _Version=65536 _ExtentX=2646 _ExtentY=1323 _StockProps=0 VersionMajor=1 VersionMinor=2 VersionInternal=1 VersionBuild=60 Logging("Stim").Log=-1 _ItemList="TrialProc" _VersionPersist=1 VersionMajor=1 VersionMinor=2 VersionInternal=1 VersionBuild=60 Order=0 OrderBy=0 ResetEveryRun=0 HideLevelsWithZeroWeight=0 CycleDef=0 CycleValueSamples=0 CycleValueCondition="" ExitDef=0 ExitValueCycles=1 ExitValueSamples=1 ExitValueSeconds=0 ExitValueCondition="" LoadMethod=0 Filename="" UserAttributes=1 Attributes("Weight").DefaultValue="1" Attributes("Weight").Visible=1 Attributes("Weight").Width=75 Attributes("Weight").OrderIndex=0 Attributes("Nested").DefaultValue="" Attributes("Nested").Visible=1 Attributes("Nested").Width=75 Attributes("Nested").OrderIndex=1 Attributes("Procedure").DefaultValue="TrialProc" Attributes("Procedure").Visible=1 Attributes("Procedure").Width=75 Attributes("Procedure").OrderIndex=2 Attributes(1).Name="Stim" Attributes(1).DefaultValue="?" Attributes(1).VarType=8 Attributes(1).VarTypeInternal=8 Attributes(1).Visible=1 Attributes(1).Width=75 Levels=4 Levels(1).ValueString="1\t\tTrialProc\tChecking the state of the keys now...\t" Levels(2).ValueString="1\t\tTrialProc\tChecking the state of the keys now...\t" Levels(3).ValueString="1\t\tTrialProc\tChecking the state of the keys now...\t" Levels(4).ValueString="1\t\tTrialProc\tChecking the state of the keys now...\t" Name="TrialList" TypeName="List" Tag="" Notes="" [Object10] _Version=65536 _ExtentX=2646 _ExtentY=1323 _StockProps=0 VersionMajor=1 VersionMinor=2 VersionInternal=1 VersionBuild=60 Logging("OnsetDelay").Log=0 Logging("OnsetTime").Log=0 Logging("DurationError").Log=0 Logging("PreRelease").Log=0 Logging("Duration").Log=0 Logging("StartTime").Log=0 Logging("OffsetTime").Log=0 Logging("FinishTime").Log=0 Logging("TimingMode").Log=0 Logging("CustomOnsetTime").Log=0 Logging("CustomOffsetTime").Log=0 Logging("ActionDelay").Log=0 Logging("ActionTime").Log=0 Logging("TargetOffsetTime").Log=0 Logging("TargetOnsetTime").Log=0 Logging("OffsetDelay").Log=0 Logging("RTTime").Log=0 Logging("ACC").Log=0 Logging("RT").Log=0 Logging("RESP").Log=0 Logging("CRESP").Log=0 Logging("Tag").Log=0 Input(0)=!Data0 _VersionPersist=1 VersionMajor=1 VersionMinor=2 VersionInternal=1 VersionBuild=60 Text="Welcome to the experiment.\n\nThis sample demonstrates how to get the current state of a particular key/button using E-Basic script.\n\nPress the spacebar to begin." ForeColor="black" BackColor="white" BackStyle="opaque" BorderColor="black" BorderWidth="0" X="center" Y="center" Width="100%" Height="100%" XAlign="center" YAlign="center" AlignHorizontal="center" AlignVertical="center" FontName="Courier New" FontSize="18" FontBold="Yes" FontItalic="No" FontUnderline="No" FontStrikeout="No" WordWrap=1 ClearAfter="No" Duration="-1" JumpLabel="" TimingMode=0 PreRelease="0" OnsetSync=1 OffsetSync=0 Name="Introduction" TypeName="TextDisplay" Tag="" Notes="" [Data0] DeviceName="Keyboard" DeviceClass="Keyboard" AllowableInput="{SPACE}" CorrectInput="" TimeLimit="" MaxCount="1" InputAction=1 SyncOwnerDuration=1 Enabled=1 FlushInputBuffer="Yes" TerminationInput="" UserTag="" ResponseMode="All" ProcessBackspace="Yes" [Object11] _Version=65536 _ExtentX=2646 _ExtentY=1323 _StockProps=0 VersionMajor=1 VersionMinor=2 VersionInternal=1 VersionBuild=60 Logging("OnsetDelay").Log=0 Logging("OnsetTime").Log=0 Logging("DurationError").Log=0 Logging("PreRelease").Log=0 Logging("Duration").Log=0 Logging("StartTime").Log=0 Logging("OffsetTime").Log=0 Logging("FinishTime").Log=0 Logging("TimingMode").Log=0 Logging("CustomOnsetTime").Log=0 Logging("CustomOffsetTime").Log=0 Logging("ActionDelay").Log=0 Logging("ActionTime").Log=0 Logging("TargetOffsetTime").Log=0 Logging("TargetOnsetTime").Log=0 Logging("OffsetDelay").Log=0 Logging("RTTime").Log=0 Logging("ACC").Log=0 Logging("RT").Log=0 Logging("RESP").Log=0 Logging("CRESP").Log=0 Logging("Tag").Log=0 _VersionPersist=1 VersionMajor=1 VersionMinor=2 VersionInternal=1 VersionBuild=60 Text="Thank you for participating.\n\nGoodbye!" ForeColor="black" BackColor="white" BackStyle="opaque" BorderColor="black" BorderWidth="0" X="center" Y="center" Width="100%" Height="100%" XAlign="center" YAlign="center" AlignHorizontal="center" AlignVertical="center" FontName="Courier New" FontSize="18" FontBold="Yes" FontItalic="No" FontUnderline="No" FontStrikeout="No" WordWrap=1 ClearAfter="No" Duration="2500" JumpLabel="" TimingMode=0 PreRelease="0" OnsetSync=1 OffsetSync=0 Name="Goodbye" TypeName="TextDisplay" Tag="" Notes="" [Object12] _Version=65536 _ExtentX=2646 _ExtentY=1323 _StockProps=0 VersionMajor=1 VersionMinor=2 VersionInternal=1 VersionBuild=60 Logging("OnsetDelay").Log=0 Logging("OnsetTime").Log=0 Logging("DurationError").Log=0 Logging("PreRelease").Log=0 Logging("Duration").Log=0 Logging("StartTime").Log=0 Logging("OffsetTime").Log=0 Logging("FinishTime").Log=0 Logging("TimingMode").Log=0 Logging("CustomOnsetTime").Log=0 Logging("CustomOffsetTime").Log=0 Logging("ActionDelay").Log=0 Logging("ActionTime").Log=0 Logging("TargetOffsetTime").Log=0 Logging("TargetOnsetTime").Log=0 Logging("OffsetDelay").Log=0 Logging("RTTime").Log=0 Logging("ACC").Log=0 Logging("RT").Log=0 Logging("RESP").Log=0 Logging("CRESP").Log=0 Logging("Tag").Log=0 Input(0)=!Data1 _VersionPersist=1 VersionMajor=1 VersionMinor=2 VersionInternal=1 VersionBuild=60 Text="During each trial, InLine script is used to assess the state of the Q key and the spacebar. When the message about checking the key states appears, press and/or release one or both of these keys.\n\nPress the spacebar to continue." ForeColor="black" BackColor="white" BackStyle="opaque" BorderColor="black" BorderWidth="0" X="center" Y="center" Width="100%" Height="100%" XAlign="center" YAlign="center" AlignHorizontal="center" AlignVertical="center" FontName="Courier New" FontSize="18" FontBold="Yes" FontItalic="No" FontUnderline="No" FontStrikeout="No" WordWrap=1 ClearAfter="No" Duration="-1" JumpLabel="" TimingMode=0 PreRelease="0" OnsetSync=1 OffsetSync=0 Name="Instructions" TypeName="TextDisplay" Tag="" Notes="" [Data1] DeviceName="Keyboard" DeviceClass="Keyboard" AllowableInput="{SPACE}" CorrectInput="" TimeLimit="" MaxCount="1" InputAction=1 SyncOwnerDuration=1 Enabled=1 FlushInputBuffer="Yes" TerminationInput="" UserTag="" ResponseMode="All" ProcessBackspace="Yes" [UserScript] Function GetLastState(strResponse As String, theDevice As InputDevice) As Long 'Verify that the device being passed to this Function is valid. Debug.Assert Not theDevice Is Nothing 'Declare a variable that will hold the "release" version of a response. Dim strResponseRelease As String 'Convert strResponse (i.e. either Q or {SPACE}) to its release 'version (i.e. {-Q} or {-SPACE}) for comparison. If Left(strResponse, 1) = "{" Then strResponseRelease = "{-" strResponseRelease = strResponseRelease & Mid(strResponse, 1) Else strResponseRelease = "{-" strResponseRelease = strResponseRelease & Mid(strResponse, 1) strResponseRelease = strResponseRelease & "}" End If 'Clone the history collection so that the script can enumerate through the 'responses without the collection changing on accident while the script 'is running (i.e. if the subject presses another key during this time). Dim theHistoryCollection As RteCollection Set theHistoryCollection = theDevice.History.Clone 'Enumerate through the collection in reverse order to determine 'what the last state of the key specified is. Dim theResponseData As ResponseData Dim nIndex As Long For nIndex = theHistoryCollection.Count To 1 Step - 1 Set theResponseData = CResponseData(theHistoryCollection(nIndex)) If Not theResponseData Is Nothing Then 'Assess whether the response is a press or a release. If theResponseData.State = ebStatePress Then 'Does this press match what we are looking for? If UCase(strResponse) = UCase(theResponseData.Resp) Then GetLastState = ebStatePress Exit Function End If ElseIf theResponseData.State = ebStateRelease Then 'Does this release match what we are looking for? If UCase(strResponseRelease) = UCase(theResponseData.Resp) Then GetLastState = ebStateRelease Exit Function End If End If End If Next 'If the script gets to this point, the key is assumed to have never been 'pressed (i.e. assumed release). GetLastState = ebStateRelease End Function Function GetLastResponseData(strResponse As String, theDevice As InputDevice) As ResponseData 'Verify that the device being passed to this Function is valid. Debug.Assert Not theDevice Is Nothing 'Declare a variable that will hold the "release" version of a response. Dim strResponseRelease As String 'Convert strResponse (i.e. either Q or {SPACE}) to its release 'version (i.e. {-Q} or {-SPACE}) for comparison. If Left(strResponse, 1) = "{" Then strResponseRelease = "{-" strResponseRelease = strResponseRelease & Mid(strResponse, 2) Else strResponseRelease = "{-" strResponseRelease = strResponseRelease & strResponse strResponseRelease = strResponseRelease & "}" End If 'Clone the history collection so that the script can enumerate through the 'responses without the collection changing on accident while the script 'is running (i.e. if the subject presses another key during this time). Dim theHistoryCollection As RteCollection Set theHistoryCollection = theDevice.History.Clone 'Enumerate through the collection in reverse order to determine 'what the last state of the key specified is. Dim theResponseData As ResponseData Dim nIndex As Long For nIndex = theHistoryCollection.Count To 1 Step - 1 Set theResponseData = CResponseData(theHistoryCollection(nIndex)) If Not theResponseData Is Nothing Then 'Assess whether the response is a press or a release. If theResponseData.State = ebStatePress Then 'Does this press match what we are looking for? If UCase(strResponse) = UCase(theResponseData.Resp) Then Set GetLastResponseData = theResponseData Exit Function End If ElseIf theResponseData.State = ebStateRelease Then 'Does this release match what we are looking for? If UCase(strResponseRelease) = UCase(theResponseData.Resp) Then Set GetLastResponseData = theResponseData Exit Function End If End If End If Next 'If the script gets to this point, the key is assumed to have never been 'pressed (i.e. assumed release). Set GetLastResponseData = Nothing End Function