Jump to content
Sign in to follow this  
methodman

ControlClick script not working when tried on different pc's

Recommended Posts

methodman

I've got a short script part of a larger program that should work as follows:

Program A is activated and in focus.

Program B is a background application.

When I press a hotkey, a 'start' button from Program B should be clicked while still in Program A.

The clicking of the start button code is below (minus the hotkey functionality).

Opt("WinTitleMatchMode", 4) ;
#include <GUIConstantsEx.au3>
#include <GuiRichEdit.au3>
#include <WindowsConstants.au3>
#include <TrayConstants.au3>
Opt("TrayMenuMode", 3);
StartButtonClick()
Func StartButtonClick()

   $t = ControlGetText("[Class:WindowsForms10.Window.8.app.0.378734a]","", "[Class:WindowsForms10.BUTTON.app.0.378734a;INSTANCE:6]");
   ;WindowsForms10.BUTTON.app.0.378734a
   ConsoleWrite("Start button:" & $t);
   if ($t == "Start") Then
      ControlClick("[Class:WindowsForms10.Window.8.app.0.378734a]","", "[Class:WindowsForms10.BUTTON.app.0.378734a;Instance:6]");
   Endif
EndFunc

This code works fine on my laptop, but I cannot seem to get it to work on my desktop pc - the code does nothing. The only way I can get it to work is if Program B is activated and in focus, which defeats the purpose of the larger program :geek:

Both are running windows xp and Au3info gives the same info when looking at window and control info when run on the laptop and the desktop.  

I am pretty new to autoit - any thoughts?

 

 

Share this post


Link to post
Share on other sites
jdelaney

Look at the remarks of

ControlClick

You might need to do something else, like make a file.  If the file exists, do what your button press would do.

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.

Share this post


Link to post
Share on other sites
methodman

Are you remoting into the desktop?

No just booting up the desktop and logging in as normal.

 

Look at the remarks of

ControlClick

You might need to do something else, like make a file.  If the file exists, do what your button press would do.

 

 

Hmm ok. I'll have a more detailed look at the remarks for controlclick later on today - thanks for your help

Edited by methodman

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  

×