Jump to content

How can i Get text from windows Calculator


Recommended Posts

Hi All, i am new to AutoIt , I get stuck while tying to read Calculator result from the control in Windows 7 
 
please help me with this thanks in advance,
 
#include <MsgBoxConstants.au3>
 
Run("calc.exe")
WinWaitActive("Calculator")
Local $hWnd = WinWait("[CLASS:CalcFrame]", "", 10)
ControlClick("Calculator", "", "[iD:132]")
ControlClick("Calculator", "", "[iD:132]")
ControlClick("Calculator", "", "[iD:132]")
$winHandle = WinGetHandle("class=#327701", "")
$controlHandle = ControlGetHandle($winHandle, "#3277011", "")
;Local $sText = ControlGetText("Calculator", "", "#327701")
Local $sText = ControlGetText($controlHandle, "", "#327701")
MsgBox($MB_SYSTEMMODAL, "", "result :: " & $sText)
 
here is more info from windows Info , i see visible text but not sure how this works
 
>>>> Window <<<<
Title: Calculator
Class: CalcFrame
Position: 1079, 288
Size: 228, 322
Style: 0x14CA0000
ExStyle: 0x00000100
Handle: 0x001108C0
 
>>>> Control <<<<
Class: #32770
Instance: 1
ClassnameNN: #327701
Name:
Advanced (Class): [CLASS:#32770; INSTANCE:1]
ID:
Text:
Position: 11, 10
Size: 190, 50
ControlClick Coords: 106, 30
Style: 0x5000004C
ExStyle: 0x00000080
Handle: 0x00130562
 
>>>> Mouse <<<<
Position: 1204, 378
Cursor ID: 0
Color: 0xF6F9FD
 
>>>> StatusBar <<<<
 
>>>> ToolsBar <<<<
 
>>>> Visible Text <<<<
2255
 
 
>>>> Hidden Text <<<<
 
 
thanks
subbu
Link to comment
Share on other sites

Use code tags when posting code.

Run("calc.exe")

Local $hWnd = WinWaitActive("Calculator")

ControlClick($hWnd, "", "[CLASS:Button; INSTANCE:10]")
ControlClick($hWnd, "", "[CLASS:Button; INSTANCE:10]")
ControlClick($hWnd, "", "[CLASS:Button; INSTANCE:10]")

$txt = WinGetText($hWnd)

MsgBox(0, 0, $txt)

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...