Jump to content

ControlGetText Not Working


naru
 Share

Recommended Posts

I'm trying to use ControlGetText to read that static control and get the text. The Au3Info for the control is as follows:

>>>> Window <<<<
Title:     PS .2.0  - [PS Bill]
Class:    WindowsForms10.378734a
Position:    -8, -8
Size:    1382, 744
Style:    0x17CD0000
ExStyle:    0x00050100
Handle:    0x0000000000140984

>>>> Control <<<<
Class:    WindowsForms10.378734a
Instance:    1
ClassnameNN:    WindowsForms10378734a1
Name:    txtNo
Advanced (Class):    [NAME:txtNo]
ID:    1444318
Text:    
Position:    219, 76
Size:    175, 30
ControlClick Coords:    91, 19
Style:    0x5E0100C0
ExStyle:    0x00000200
Handle:    0x00000000001609DE

>>>> Mouse <<<<
Position:    310, 137
Cursor ID:    0
Color:    0xF0F0F0

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
MenuStrip
               :: NAME :- PS Bill
.

>>>> Hidden Text <<<<

i tried with following code :

ControlGetText("PS .2.0  - [PS Bill]", "", " [NAME:txtNo]")

But not working

Link to comment
Share on other sites

Stripping the first space?

" [NAME:txtNo]"

Conrad

SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win_10   Build = 19044   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Link to comment
Share on other sites

It's up to you to troubleshoot the issue to figure out why it isn't working as expected. You can't just come on here and say "It's not working" and then someone will miraculously solve the issue for you.

Why isn't it working? Either the window title is wrong or the text identifier is wrong. So how to figure it out? First thing I would do is test the window title, like this:

$wintitle = "PS .2.0  - [PS Bill]"

If WinExists($wintitle) Then
    ConsoleWrite("Window found!" & @CRLF)
Else
    ConsoleWrite("Window NOT found!" & @CRLF)
EndIf

 

Link to comment
Share on other sites

31 minutes ago, Danp2 said:

It's up to you to troubleshoot the issue to figure out why it isn't working as expected. You can't just come on here and say "It's not working" and then someone will miraculously solve the issue for you.

Why isn't it working? Either the window title is wrong or the text identifier is wrong. So how to figure it out? First thing I would do is test the window title, like this:

$wintitle = "PS .2.0  - [PS Bill]"

If WinExists($wintitle) Then
    ConsoleWrite("Window found!" & @CRLF)
Else
    ConsoleWrite("Window NOT found!" & @CRLF)
EndIf

 

Do nothing with this script

Link to comment
Share on other sites

5 minutes ago, Nareshm said:

Do nothing with this script

This is what I see when I run the script --

>"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Users\Dan\Dropbox\test7.au3" /UserParams    
+>10:31:19 Starting AutoIt3Wrapper v.17.224.935.0 SciTE v.3.7.3.0   Keyboard:00000409  OS:WIN_10/  CPU:X64 OS:X64  Environment(Language:0409)  CodePage:0  utf8.auto.check:4
+>         SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE   UserDir => C:\Users\Dan\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\Dan\AppData\Local\AutoIt v3\SciTE 
>Running AU3Check (3.3.14.2)  from:C:\Program Files (x86)\AutoIt3  input:C:\Users\Dan\Dropbox\test7.au3
+>10:31:19 AU3Check ended.rc:0
>Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\Dan\Dropbox\test7.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
Window NOT found!
+>10:31:19 AutoIt3.exe ended.rc:0
+>10:31:19 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 0.5597

Note the line that says "Window NOT found!", which is what I would expect in my environment.

Are you running the script in SciTE? If not, please do so and post the results from the output window.

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...