Jump to content
Sign in to follow this  
nollert

Unable to get window controls to work

Recommended Posts

nollert

I am trying to build a self install of an existing program.

I execute the program using a ShellExecute. I tried Run but it will not work with the Run command.

The Install Program is executed from Autoit script

Window starts named “Welcome” which has 2 buttons:

Button1: Class: “TButton;Instance:1"

Button2: Class:”TButton;Instance:2"

Focus is on Button2 when the program starts.

I added a number of debug aids in the script to try and figure out what is going on. In particular I wonder why the ControlFocus does not work?

See comments to the right of message box statement to see what is actually displayed.

The net effect is there is absolutely no effect on the window opened by the program. The button is never clicked and the Autoit script just finishes with a bunch of message boxes displayed. The window containing the buttons in unaltered.

I really could use some help on this one. I’m running a 64 bit Windows 7 Home Premium. The install program works on XP, Windows Vista, Windows 7 so there are no issues there.

Thanks

Tom

AutoIT Script follows:

$val = ShellExecute($FilenameWithDriveDest3)

WinWaitActive("Welcome") ;This completes successfully

$hWnd = winactivate("Welcome") ;Displays below as 0x0000000000100734

if $val = 0 Then

MsgBox(0, "no window:", " ")

Else

msgbox(0,"Welcome handle From WinActivate: ", $hWnd)

EndIf

$val = controlfocus("Welcome", "", "[CLASS:TButton; INSTANCE:1]") ;I get error message below

if $val = 0 Then

MsgBox(0, "control Focus failed:", " ") ;I get this error message

Else

MsgBox(0, "ControlFocus Succeeded:", $val)

EndIf

Send("!n") ; sends ALT-N ; Nothing Happens

$val = ControlClick("[title:Welcome]", "", "[CLASS:TButton; INSTANCE:1]") ;left click default

if $val = 0 Then

MsgBox(0, "controClick failed:", " ")

Else

MsgBox(0, "ControlClick Succeeded:", $val) ;I get this message with a value of 1

EndIf

$val = WINWait("[title:Welcome]", "", 5)

if $val = 0 Then

MsgBox(0, "WinWait no window:", " ")

Else

MsgBox(0, "WinWait got window:", " Welcome") ; I get this message

EndIf

$hWnd = WinGetHandle("[ACTIVE]")

MsgBox(0, "handle: Active", $hWnd) ;Displays as 0x0000000000100734

$hWnd = WinGetHandle("Welcome")

MsgBox(0, "WinGetHandle ", $hWnd) ;Displays as 0x0000000000100734

$text = WinGetTitle("")

MsgBox(0, "Title:", "***" & $text & "***") ; Displays as ***Welcome***

$text = WinGetProcess("Welcome", "")

MsgBox(0, "Process:", $text) ;Displays as “6000”

$text = WinGetHandle("Welcome", "")

MsgBox(0, "Handle:", $text) ;Displays as 0x0000000000100734

$text = WinGetText("Welcome", "")

MsgBox(0, "Text read was:", $text) ; Displays as 2 lines 1: “&Next>” 2: “Exit”

$text = WinGetClassList("Welcome") ;Displays as 2 lines 1: “tbutton” 2: “tbutton”

if @error then

MsgBox(0, "Class List:", "error")

else

MsgBox(0, "Class List:", $text) ;Displays as 2 lines 1: “tbutton” 2: “tbutton”

EndIf

EXIT

Edited by nollert

Share this post


Link to post
Share on other sites
nollert

I ran this same program and script anaysis on a 32 bit computer and had no problems so apparently the root of the problem is 64 bit. I tried compiling as both 64 bit and 32 bit but the problem persists. Neither will work on the 64 bit computer. If I take the 32 bit compiled version and set the compatability to windows XP, the program works fine on a 64 bit computer. I have not tried emulaion for Vista. Both Computers were windows 7.

Would still like advice on using Autoit with 64 bit if anyone has advice.

Edited by nollert

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
Sign in to follow this  

×