Test and Measurement Forum

Load configuration file / reload configuration / .pssetings

Post your VB and VBA discussions here

Load configuration file / reload configuration / .pssetings

Postby Anthony75france » Mon Feb 15, 2016 12:34 pm

Dear community,

I want to "load a picoscope configuration" from another software.

I found out that
C:\Users\%USER%\AppData\Local\Pico Technology\64358d19-ef91-48bb-9ae0-3b4689d44d99
the file "default.PSSETTINGS" contains all I need (probes, scope poasition, zoom levels, trigger mode, etc ...).


I tried different solutions:
_ hooking to picoscope's windows message through MS Spy++. However it give 2000 lines of recording. And I am not succeeding into identifying the message that triggers "load configuration".

- using a picoscope's defined keyboard key, and using sendKey() API to simulate that key being pressed. It works when manually pressing down the key; but not when using the SendKey() API (and picoscope being set as the most foreground window).

- I tried picoscope's automation, unfortunately it is not capable of adjusting the scopes, their zooming factor, ... so it is not a solution for me.

Can someone at picoscope / picotech provide me with some pointers. That ould be a great help.
Thanks in advance.

Best regards,

Anthony
Anthony75france
User
User
 
Posts: 2
Joined: Mon Feb 08, 2016 8:43 am

Re: Load configuration file / reload configuration / .psseti

Postby Martyn » Fri Feb 19, 2016 7:52 am

Can you confirm that you wish to setup the device with our PicoScope software, save a configuration file, and then use this configuration file in a third party piece of software to run the scope at a different time ?

Or do you want a third party piece of software to startup the PicoScope software with a set configuration ?
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2350
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Load configuration file / reload configuration / .psseti

Postby Anthony75france » Fri Feb 19, 2016 12:15 pm

Dear Martyn,

Firstly : I wanted to thank you for taking my question into consideration.

I answered my question ! It is now solved :)

Finally I found out a mistake in my exploring : instead of simulating the "q" keypress (lowercase) , I compiled a "Q" keypress (uppercase). Therefore it is normal that picoscope.exe did not react to my keyboard customisation.
Silly me.

How I did it : under VB.net 2.0 ( dotNet) 2005 ?
Find attached my ugly trial .. that works.

Working principle:
_ scanning list of windows processes: finding picoscope.exe
_ if pico is found I put it as foreground windows (with Win32 API SetForegroundWindow()).
_ then sending the "q" key --> this opens the "Are you sure to load the config ? " dialog
_ then sending the " " key (spacebar) --> this validates the "YES" option of the dialog "Are you sure to load the config ?" dialog

To send the keystrokes, I used the ugly SendKeys() API

Pre-requisite to run the soft:
1_ a running instance of picoscope.exe with a connected or demo oscilloscope.
2_ to define in picoscope in the menu : TOOL > preference > KEYBOARD tab , with checkbox set to "display all available functions". In the list, under the "settings" branch, type the "q" letter to "load the default settings".

'example of source code -- may not be 100% running
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As Object) As Long

on error resume next
for each lProcessPico as Process In Process.GetProcesses()
SetForegroundWindow(lProcessPico.MainWindowHandle)
SendKeys.Send("q")
SendKeys.Send(" ")
next
Attachments
PicoscopeConfLoader.zip
make a running pico.exe loads its pssettings file.
(96.94 KiB) Downloaded 41 times
Anthony75france
User
User
 
Posts: 2
Joined: Mon Feb 08, 2016 8:43 am


Return to VB and VBA (Excel, Access)

Who is online

Users browsing this forum: No registered users and 0 guests