Capturing a window: same id on every computer?
#1
Posted 26 November 2007 - 04:57 AM
#2
Posted 26 November 2007 - 06:40 AM
#3
Posted 26 November 2007 - 06:44 AM
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.
#4
Posted 26 November 2007 - 07:09 AM
Partial Match
This allows the Control variable to find a Window Title that partially matches the name defined in the control.
Does the Display Control Info show any differens between the two windows?
#5
Posted 26 November 2007 - 10:19 AM
Oh, wait. If you do have different windows titles you might need to modify the control which is easy enough to do at runtime.
Cory Jackson
Fallbrook, California
Bluepoint Design
Macro writer for hire! Need help with a macro fast? Just contact me.
#6
Posted 26 November 2007 - 10:44 AM
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.
#7
Posted 26 November 2007 - 04:28 PM
#8
Posted 12 December 2007 - 12:26 PM
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
#9
Posted 12 December 2007 - 01:17 PM
I like that idea. I have always done things like check the name of the computer, the OS Version or tried to get the version number of the application. This is a simple, elegant solution. Thank you!










