Jump to content
Macro Express Forums

Capturing a window: same id on every computer?


bluppfisk

Recommended Posts

I want to share a macro I've made with my colleagues. Alas, the control capture only works on my computer, it results in some kind of error on my colleagues' computers. I guess this is because the parent window of the control has a different internal id on every computer. Is there any way to make this universally compatible or should I do the window capture on every computer?

Link to comment
Share on other sites

Just wondering if you couldn't you use the Get Control command instead? There you can choose the Partial title instead of Exact match.

 

Yeh, I actually used Get Control command. But my macro still returns an error on everybody else's computer. Also, the titles are exactly the same, but I think the internal window ids might differ.

Link to comment
Share on other sites

I rarely have problems between different computers assuming the applications are the same. Are you using the "Get Control Using Text" method? If not you might want to try that. Also does the client happen to have multiple windows with the same title? Are the windows titles the same as on your machine? This will definitely cause a problem. Finally ME does have some problems with the way it caches control handles so if neither of these work for you we might look there.

 

Oh, wait. If you do have different windows titles you might need to modify the control which is easy enough to do at runtime.

Link to comment
Share on other sites

Controls work best when everything matches. If your colleagues have different versions of Windows or different versions of the application that you are automating then the Window Controls may not match. I haven't seen it personally but it seems possible that different Windows themes or different skins in the application could cause the controls to differ.

 

The Get Control command allows you to capture the control information as you are writing the macro. The solution may be to use the Capture Control command. This command captures the control as the macro runs thus eliminating any incompatibility between applications or versions of Windows. But, the downside, is that you need to know the X and Y coordinates of the control. Often we use controls because we do not have an easier way to determine the X and Y coordinates.

Link to comment
Share on other sites

  • 3 weeks later...

I've run in to this issue with many different applications (even Outlook E-mails and HP Service Desk). Checking in to it, I've found that the 2nd or 3rd Index (checking via the "Display Control Info") will either be a 1 or a 2, so sometimes it works and others it doesn't...

 

To get around this: When it errors out, I go in to the Macro and duplicated the GetControl line. I then re-capture the new/different Control in this duplicated GetControl. At this point I add in an "If NOT Control Enabled" and "End If", so the order would be:

 

Get Control C1 (1)

If NOT Control C1 Enabled

Get Control C1 (2)

End If

 

<GETCONTROL2P:01:WJVIEW.EXE:WFC.Window.8- Default Work Order005:5WFC.Window.81WFC.Window.81WFC.Window.841WFC.Window.81WFC.EDIT>

 

<IFCONTROL:06:01>

<GETCONTROL2P:01:WJVIEW.EXE:WFC.Window.8- Default Work Order005:5WFC.Window.82WFC.Window.81WFC.Window.841WFC.Window.81WFC.EDIT>

<ENDIF>

 

This is working fine for me so far...

 

-Patrick

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