Jump to content

Crouch

Members
  • Posts

    2
  • Joined

  • Last visited

Crouch's Achievements

Newbie

Newbie (1/4)

0

Reputation

  1. I found a couple of work-arounds for VBA, using the Shell command: To open DAQami, and start recording using the default configuration: Sub OpenDAQ() 'Opens DAQami using the Shell command Shell "C:\Program Files\Measurement Computing\DAQami\DAQami.exe", vbNormalFocus 'Wait 2 seconds after starting DoEvents Application.Wait Now + TimeValue("00:00:02") 'select the last saved configuration SendKeys "{TAB}", True SendKeys "{TAB}", True SendKeys "{TAB}", True SendKeys "{TAB}", True SendKeys "{ENTER}", True 'start recording Application.Wait Now + TimeValue("00:00:01") SendKeys "{TAB}", True SendKeys "{TAB}", True SendKeys "{TAB}", True SendKeys "{TAB}", True SendKeys "{ENTER}", True 'shift focus back to Excel Application.Wait Now + 0.000005787 AppActivate "DAQ - Excel" Workbooks("DAQ.xlsm").Activate Sheets("Report").Activate 'start the subroutine that checks for the DAQ recording status Call CheckForDAQRecording End Sub To close DAQami, and save the data and configuration: Sub CloseDAQ() 'Return focus to DAQami On Error GoTo stepout AppActivate ("DAQami - [Configuration: system.amicfg] [Data File: DAQdata.tdms]") DoEvents Application.Wait Now + TimeValue("00:00:01") 'Request close program SendKeys ("%{F4}"), True SendKeys ("+{TAB}"), True 'Enter to confirm stop recording Application.Wait Now + TimeValue("00:00:01") SendKeys "{ENTER}", True 'Enter to save configuration Application.Wait Now + TimeValue("00:00:05") SendKeys "{ENTER}", True stepout: End Sub To find out if DAQami is recording: Dim recFDT recFDT = Dim recFDT recFDT = FileDateTime("C:\Users\XXXXXX\Documents\Measurement Computing\DAQdata.tdms") I then subtract NOW() by recFDT and if it's less than 1.5 minutes, I know the data is current.
  2. Is there a way to start and stop the DAQami logging from a command prompt or other script? I'm writing a program to get the live data into Excel (I've already got that figured out from the .tdms file); my goal is to have Excel stop the recording when the experiment is complete. I can send a command line prompt or possibly a keystroke from excel VBA. Is either a possibility?
×
×
  • Create New...