Load configuration file / reload configuration / .pssetings

Post your VB and VBA discussions here
Post Reply
Anthony75france
User
User
Posts: 2
Joined: Mon Feb 08, 2016 8:43 am

Load configuration file / reload configuration / .pssetings

Post by Anthony75france »

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
Martyn
Site Admin
Site Admin
Posts: 4571
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Load configuration file / reload configuration / .psseti

Post by Martyn »

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 Support Manager
Anthony75france
User
User
Posts: 2
Joined: Mon Feb 08, 2016 8:43 am

Re: Load configuration file / reload configuration / .psseti

Post by Anthony75france »

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 4071 times
nouman_sadiq
Newbie
Posts: 0
Joined: Wed Jan 17, 2018 8:26 am

Re: Load configuration file / reload configuration / .psseti

Post by nouman_sadiq »

Hi Martyn,

Can you please provide your solution for:
"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 ?"

I got all my required settings in a .pssettings file. I want to load those settings using MATLAB and also to import the captured set of waveforms to MATLAB in run-time.

Thank you very much.
Martyn
Site Admin
Site Admin
Posts: 4571
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Load configuration file / reload configuration / .psseti

Post by Martyn »

We don't have a method to do that at the present time, I was just asking a question to see what was required.
Martyn
Technical Support Manager
Nifty
User
User
Posts: 3
Joined: Thu May 02, 2024 6:59 am

Re: Load configuration file / reload configuration / .pssetings

Post by Nifty »

I am trying something similar, but when attempting to save the settings as user settings or a stand alone .pssettings file, i get an error.

Error Saving File: Object Reference not set to an instance of an object
Attachments
Skjermbilde 2024-07-31 152351.png
Skjermbilde 2024-07-31 152320.png
Skjermbilde 2024-07-31 152320.png (7.84 KiB) Viewed 33034 times
Post Reply