Jump to content

Control names difference in different OS versions


Recommended Posts

Hi All.

I've used WinXP Pro SP3 32-bit, but now moved to Win7 Ultimate 64-bit.

Previously I used autoit script with Omea Reader (http://download.jetbrains.com/omea/OmeaReaderSetup-2.2.1.exe). It is java-based 32-bit application.

If you install it and go to Tools - Manage Rules - Action Rules...  and use Au3Info.exe or Au3Info_x64:

Button   Name in XP                                               Name in 7

Copy     "WindowsForms10.BUTTON.app46"         "WindowsForms10.BUTTON.app.0.33c0d9d6"

Edit       "WindowsForms10.BUTTON.app44"         "WindowsForms10.BUTTON.app.0.33c0d9d4"

Ok         "WindowsForms10.BUTTON.app43"         "WindowsForms10.BUTTON.app.0.33c0d9d7"

So my script made for XP doesn't work in 7.

Do someone have any idea how to deal with such things without renaming all controls?

Link to comment
Share on other sites

Use the XP control names when the script is running on XP and the Win7 control names when running it on Win7, use @OSArch to tell you which OS it's running on.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Try this:

ControlGetHandle("win", "", "REGEXPCLASS:WindowsForms10\.BUTTON\.app46|WindowsForms10\.BUTTON\.app\.0\.33c0d9d6")

Or, if the ID property is populated, use that.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Well both ways are possible, but they cure symptoms, not illness.

The major question is why control elements have different names under different OS?

And which unified id could be used under any OS not to investigate every time new object names.

Link to comment
Share on other sites

Isn't it obvious?

It's the application that is changing the control names, so YOU have to account for that, AutoIt is only reading what the program is giving it, if it's different for different OSs then you have to make sure you're using the right names.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Send us the full 'control' output from the 'autoit window info tool'...again, if the ID is transparent, that should be standard between all environments

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

In XP I'll get it tomorrow.

In Win7:

>>>> Window <<<<
Title: Rules Manager
Class: WindowsForms10.Window.8.app.0.33c0d9d
Position: 939, 269
Size: 392, 359
Style: 0x16CC0000
ExStyle: 0x00010100
Handle: 0x0000000000BB06F0

>>>> Control <<<<
Class: WindowsForms10.BUTTON.app.0.33c0d9d
Instance: 6
ClassnameNN: WindowsForms10.BUTTON.app.0.33c0d9d6
Name: buttonCopyRule
Advanced (Class): [NAME:buttonCopyRule]
ID: 8586152
Text: &Copy Rule
Position: 302, 112
Size: 75, 23
ControlClick Coords: 39, 17
Style: 0x56012F00
ExStyle: 0x00000000
Handle: 0x00000000008303A8

>>>> Mouse <<<<
Position: 1284, 421
Cursor ID: 0
Color: 0xD6D3CE

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
Action
Move &Down
&New...
&Available rules:
&Delete...
&Edit...
Move &Up
&Copy Rule
OK
Cancel
Help


>>>> Hidden Text <<<<

Link to comment
Share on other sites

double check it in your diff window environments, but this should probably do it (also check that it's fixed each run):

ID: 8586152

 

as in controlgethandle ("window","",8586152)

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

double check it in your diff window environments, but this should probably do it (also check that it's fixed each run):

ID: 8586152

 

as in controlgethandle ("window","",8586152)

.NET objects generate IDs at runtime... so that will change, every run

f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

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