Jump to content

ControlClick script not working when tried on different pc's


 Share

Recommended Posts

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?

 

 

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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