Jump to content
Mike2018

How to get the displayed value shown in "Button" box?

Recommended Posts

Mike2018

Hi. Greetings to all.

I bump into some problem when using Autoit to retrieve a value displayed in the button box. I am using UVProbe, a measuring software for Shimadzu UV-2600 spectrophotometer. Referring to pic1 and pic2, the circled part is the value that I want to get. Pic1 is when the machine is not connected to the PC and, Pic2 is when it is connected and showing the wavelength and absorbance value.

Below is a sample code that I tried.

#include <GuiToolbar.au3>
Example()

Func Example()
   Local $hwin = WinGetHandle("UVProbe - [Spectrum]")
   Local $text1 = ControlGetText($hwin,"","[CLASS:Button; INSTANCE:21]")

   Local $handle1=ControlGetHandle($hwin,"","[ID:13126]")
   Local $button1=GUICtrlRead($hwin)
   Local $wintext = WinGetTitle($hwin)

   ConsoleWrite($hwin & @LF & $text1 & @LF & $handle1 & @LF & $button1 & @LF & $wintext & @LF)

EndFunc

Here is the window info for the button.

>>>> Window <<<<
Title:  UVProbe - [Spectrum]
Class:  Afx:00400000:8:00010003:00000000:000D048F
Position:   122, 75
Size:   925, 614
Style:  0x14CF8000
ExStyle:    0x00000110
Handle: 0x000303E2

>>>> Control <<<<
Class:  Button
Instance:   21
ClassnameNN:    Button21
Name:   
Advanced (Class):   [CLASS:Button; INSTANCE:21]
ID: 13126
Text:   350.0 nm     1.000 Abs
Position:   6, 429
Size:   115, 18
ControlClick Coords:    61, 9
Style:  0x5A00820B
ExStyle:    0x00000004
Handle: 0x000104F2

>>>> Mouse <<<<
Position:   197, 563
Cursor ID:  0
Color:  0x003A90

>>>> StatusBar <<<<
1:  For Help, press F1
2:  Active Spectrum: None
3:  
4:  

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
Spectrum
Graph
Method
Method Parameters
For Help, press F1
Spectrum Toolbar
Main
Instrument Bar
Photometer Buttons
Photometer Status
<<
<
>>
<
>
350.0 nm     1.000 Abs
Output Window
Legend
Legend


>>>> Hidden Text <<<<
Peak Area
Index Tabs
Data Print
Peak Pick
Index Tabs
Point Pick
Index Tabs
Manipulation
Type:
Arithmetic
Calculate...
Data Set:
Operation:
Addition
Constant:
1
Sewing Box
Type:
Shear
Calculate...
Data Set:
Start:
0
End:
0
Region:
Inside
Outside
Interpolate:
Shift Time to Zero
Legend
Graph
Legend
Photometric
Standard Table
Method
Standard Curve
Legend
Sample Table
Standard Error Prediction Table
Sample Graph
Legend
Kinetics
Peak Area
Index Tabs
Data Print
Peak Pick
Index Tabs
Point Pick
Index Tabs
Manipulation
Type:
Arithmetic
Calculate...
Data Set:
Operation:
Addition
Constant:
1
Sewing Box
Type:
Shear
Calculate...
Data Set:
Start:
0
End:
0
Region:
Inside
Outside
Interpolate:
Shift Time to Zero
Kinetics Main Table
Activity Table
Graph
Legend
Graph
Legend
Enzyme Table
Method :
Lineweaver-Burk
Index Tabs
Method :
Lineweaver-Burk
[S] :
1
Apply
Index Tabs
Method :
Lineweaver-Burk
Index Tabs
Event List
Index Tabs
Method
Graph
Legend
Graph
Legend
Graph
Legend
Graph
Legend
Graph
Legend
Graph
Legend
Graph
Legend
Report
RepGenView
CRulerBarWnd
Photometric Toolbar
Kinetics Tool Bar
Report
Full Detail
Whole Page
Instrument Bar
Auto Scan Window
Spectrum
Legend
Photometer Buttons
Report Objects
Legend

The purpose of this is to dump the read data into a text file and have another program, Labview, to read from it. Cannot proceed to this step yet if above problem can not be solved.

Feel free to give any ideas on how to retrieve the displayed value in the button box.

 

Thanks and Regards,

Mike2018

pic1.jpg

pic2.jpg

Share this post


Link to post
Share on other sites
FrancescoDiMuro

Good morning @Mike2018, and welcome ti the AutoIt forum :)

Did you check if the handle returned by the WinGetHandle is a valid one?

What does the ConsoleWrite() return to you? :)

 

Best Regards.


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites
Mike2018

Hi  @FrancescoDimuro.

If follows the Autoit Windows Info that I pasted above. It returns this:

0x000303E2
350.0 nm     1.000 Abs
0x000104F2
0
UVProbe - [Spectrum]

Share this post


Link to post
Share on other sites
FrancescoDiMuro
25 minutes ago, Mike2018 said:

350.0 nm     1.000 Abs

So, this is the value you were/are looking for :)

You did it :)


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites
Mike2018

No.

When the button box is showing "No Instrument", what I get by using ControlGetText is this value " 350.0 nm     1.000 Abs ".

Same things too, when the machine is running. The button box showing "800.00nm     0.261 Abs", what I get is also " 350.0 nm     1.000 Abs ".

It looks like it gets the button box "text", not the value displayed on the button box. Maybe the control is hidden from AuInfo checker.

Share this post


Link to post
Share on other sites
Earthshine

when the machine is running, use the info tool to capture. post all the data from that. not snippets. if it can't see the values then you have a problem and maybe you can't use standard AutoIt methods


My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
Mike2018

Hi @Earthshine,

Thanks for the suggestions. I have tried the info tool on the button when the machine is running. I cannot see the displayed button values on the summary tab.

Any others Autoit methods that I can try to access the button values?

 

Regards.

Share this post


Link to post
Share on other sites
careca

IUIAutomation i guess, but im still learning more about it, it's a bit complex for me. Check my sig.


Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×