Trigger capture from command line

heading

SalaeStart-v1.1.zip

Syntax:

salaestart.exe  [ -port <port> ]  [ -delay <ms> ]

<port>  Port number configured in the Salae software (omit for default)
<ms>    Number of milliseconds to wait before commencing the capture (omit for none)

Examples:

salaestart.exe
Immediately trigger a new capture in an existing Salae Logic window

salaestart.exe -delay 5000
Trigger a new capture after five seconds

powershell Start-Process -FilePath “C:\Tools\salaestart.exe” -ArgumentList ‘-delay 5000’
Trigger a new capture after five seconds, without blocking subsequent script commands or build steps (for IDE’s like Atmel Studio 7).

Requirements:

The link above includes a single-file Windows binary and full C# source code. It would probably be straightforward to port this to Linux or other platforms. If you’re still on XP, you’ll need Microsoft .NET Framework 4.5.

More Info:

I have an embedded programming workflow that automatically builds my firmware and uploads it to my microcontroller when I hit a button in the IDE. I got tired of manually hitting the Start button each time to take a new capture and see the latest results.

So I wrote this simple command-line program that invokes the Salae Socket API C# Wrapper to trigger a new capture (more API docs here). You need to open Salae Logic first and set up your capture, but after that the existing application instance and capture tab are reused.

Be sure to enable the scripting socket server in the Logic application (under Options | Preferences | Developer):

pref

Alternative:

After writing this I found out Salae has a simple Python script that does something similar. Apparently it can be used like this:

python saleae_cli.py --capture-count 5 --capture-duration 0.1

I kept this post up anyway, for other Windows luddites who don’t want to wade into Python.

1 Like

This is awesome! I’m sure this will help out a lot of users. As discussed earlier over email, I’ve posted this under Third-Party Implementations below:
https://support.saleae.com/saleae-api-and-sdk/socket-api

Thanks again :slight_smile:

Hi All,

How can we stop it automatically?

My requirement is something like as below,

Start Saleae
Run some other Windows Executable
Stop Saleae.

Regards,
Sudheer

This is possible with our Saleae Socket API in Python.

The Python wrapper is here.

Here’s the code for a very simplified automation script of what you need using the Python wrapper.

import saleae
import time
s = saleae.Saleae()
s.set_capture_seconds(5)
s.capture_start()
time.sleep(1)
s.capture_stop()

You could also use our ready made Python script command line utility as well.

Is this the functionality you need?

Could you please add commands to:

  • Save the raw capture (logic data file)
  • Save the CSV file
  • Exit/close the app

Thanks
Rajiv

@rajiv.onkar Thanks for writing in! In case you are referring to our Socket API Automation Utility, you can refer to the commands below:

  • Save the raw capture (logic data file)

save_to_file

  • Save the CSV file

export_data2

  • Exit/close the app

exit

Hope this helps!