AlexMark6 Posted December 1, 2022 Share Posted December 1, 2022 I am writing Analog Discovery 2 script to develop semi automatic spectrum analyzing measurement. To specialize measurement condition, I want to set Spectrum Analyzer's Measurement Option parameter such as "Harmonics", "Alias", "Excursion". I checked the Help menu about it, but it seems there is no way to set these parameters by script. Does anyone know the way to set these parameters by script? Link to comment Share on other sites More sharing options...
0 Rolf_K Posted December 1, 2022 Share Posted December 1, 2022 try these script lines: clear() // clear the output window Spectrum.Measure.Harmonics.value = 15; Spectrum.Measure.Alias.toggle(); print(Spectrum.Measure.Alias.preset); print(Spectrum.Measure.Alias.text); Spectrum.Measure.Alias.checked = "on"; Spectrum.Measure.Alias.setChecked(); Spectrum.Measure.Alias.setUnchecked(); print(Spectrum.Measure.Alias.text); print( Spectrum.Measure.Excursion.text); print( Spectrum.Measure.Excursion.value); Spectrum.Measure.Excursion.value = 5; Link to comment Share on other sites More sharing options...
0 AlexMark6 Posted December 2, 2022 Author Share Posted December 2, 2022 Hi Rolf_K Thank you very much for your quick reply. I could set Harmonics, Alias, Excursion from script as your code. By the way, is there any explanation about these parameter setting method? For example Waveforms Reference Manual etc... Link to comment Share on other sites More sharing options...
0 Rolf Posted December 2, 2022 Share Posted December 2, 2022 click the Help tab, then script on the left pane. I think the setting (or getting) method in general is not eplicitely explained. The scripting language is JavaScript, based on the ECMAScript, ECMA-262 standard. In the "4. Code" section this Help tab many parameters are explained, but I think not all - and not your reqested ones: ... The instrument's object can be accessed from the script and has the most relevant child objects and parameters shown in the table below. The instrument parameters are stored in objects with the following properties: text: text representation of parameter. value: index of discrete setting (like mode: None, Auto, Normal) or value expressed in units. preset: list of discrete settings or nice value steps. real: available for some parameters, returns the actual value regarding the capture like the full voltage range... These objects seems to exist for all parameters and the manipulating methods are the same as already shown. Use Ctrl+Space in the script editing pane to show possible parameters (or more and more parameters are explained by mouse hoovering on it) and code with trial and error ! Print he preset object in this case is often a good idea and /or also look for the examples section in the help tab or open examples in the script tool tab. Link to comment Share on other sites More sharing options...
0 AlexMark6 Posted December 5, 2022 Author Share Posted December 5, 2022 Hi Rolf Thank you very much for your answer. I understand that not all command is described in help section. I will try to get the right command as above samples you reply this time. If I can not find the answer let me ask in this forum to you and other person. Best regards. Link to comment Share on other sites More sharing options...
Question
AlexMark6
I am writing Analog Discovery 2 script to develop semi automatic spectrum analyzing measurement.
To specialize measurement condition, I want to set Spectrum Analyzer's Measurement Option parameter such as "Harmonics", "Alias", "Excursion".
I checked the Help menu about it, but it seems there is no way to set these parameters by script.
Does anyone know the way to set these parameters by script?
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now