Jump to content
Macro Express Forums

Get Control Return Value Is Null


GregS

Recommended Posts

Hello,

 

I have successfully use the 'Get control' in many scripts, however; it will not work for this one

window. Everytime it get an error. Tried using both the Z index method and the Text.

 

<GETCONTROL2P:01:VICSJEM.EXE:Afx:400000:8:10008:0:30179VICS 3.0 - Job Execution Module 007:1MDIClient1Afx:400000:b:10008:6:21018f1AfxMDIFrame42u3AfxFrameOrView

2u1SysTabControl321#3277025Static>

 

 

I have checked from the 'Display control info' window the Z index is unique.

 

Any ideas?

 

Cheers,

Link to comment
Share on other sites

What exactly does the error say?

 

Some programs change the Window Control information every time they run. The program you are accessing may fall into that category. The only way to deal with this is to rewrite your macro using the Capture Control command. You will need to know the location (the X and Y coordinates) of the control.

Link to comment
Share on other sites

Hello,

 

That's the puzzling part of it, the Window Control information does not change. The app has two windows inside the main app window that can be resized. So I cannot do hard X & Y coords of the control and wanted the 'Get Control' function to find it.

 

Ideas?

Link to comment
Share on other sites

hello,

 

Sorry, its not from the "get control" function, its from the 'mouse move' function or any other function that gets a value(s) defined in the 'get control' function.

 

Error says: Specified control C1 could not be found. macro aborted.

 

Cheers,

Link to comment
Share on other sites

It sounds to me like the values in the Window Control change between the time you write the macro using the Get Control command and when you run the macro. Note that not all of the values that Macro Express stores to identify the Window Control are displayed in the Get Control command details.

 

To verify if this is the case do the following:

  • Set the window size of your application to a specific size and location.
  • Replace the Get Control command in your macro to a Mouse Move command followed by a Capture Control command.
  • Run the macro.

If the macro runs without generating an error message then it is pretty strong evidence that the application changes the definition of the Window Control each time it runs.

 

To write a macro that works you may try to do the following:

  • Save the position and size of your application's window (Height, Width, Left and Top).
  • Change the application's window to a specific size and position. This should be the same size and position that you used when writing the macro.
  • In your macro use a Mouse Move command followed by a Capture Control command to capture the WIndow Control.
  • Restore the size and position of your application's window.
  • Run the rest of the macro.

You may also want to save and restore the position of the mouse.

Link to comment
Share on other sites

Kevin,

 

I think I know what Greg is talking about... I have the same issue with one of the programs I use. This program opens a window with windows within it. Those windows do not appear on the "activate window" either. There are controls to them... but considering they can open up anywhere within that main window, the "get control" or "capture control" does not work. I have been trying to work with this for a while. These "sub" windows cannot be activated directly. Nor can they be resized. Find Window does not work. I am left with just using mouse movements to try and make it work. My main problem is timing... when pulling information, the sub widows can take anywhere from 30 seconds to 5 minutes to come up. And trying to get the macro to wait for that window when ME cannot recognize it results in problems... :angry:

Link to comment
Share on other sites

Speaking of which... I don't know if this is in the works... but I would like to see an enhancement that would change controls to be like window titles... where you can use partial titles (for controls) rather than exactly what they reflect now. Using set control text (may use partial titles) and wait for control... This would help tremendously. I see you can modfiy the top-level window... but as discussed below, what I am currently working with is windows within windows... and "Capture Control" captures the very top level window.

 

On the topic below... Trying things out now... I can get control using "specific coordinates"... but not "Control Focused".

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...