!TAGX

From iMacros
Jump to: navigation, search

This value contains the X-coordinate of the HTML element found with the TAG command. The !TAGX/!TAGY values are automatically set after each TAG command.

Tagx.png The coordinates refer to the middle of the HTML element.

Value iMacros Browser IE Plug-in

X-coordinate in pixel.

Set By

[X] Internal

[ ] SET

Internal means that the iMacros program itself sets the value of the variable during program run. SET means that the user can set this value via the SET command inside a macro.

Examples

In this example we use the {{!TAGX}} and {{!TAGY}} values as input for two DirectScreen commands to enter text into a tricky JavaScript date selector box that can not be filled with the standard TAG command:

 TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:aspnetForm ATTR=ID:txtCoverStartDate CONTENT=  
 'Set focus on box    
 DS CMD=CLICK X={{!TAGX}} Y={{!TAGY}}   
 'Send text
 DS CMD=KEY X={{!TAGX}} Y={{!TAGY}} CONTENT=11/01/2009  

Example macros: Demo-AJAX-Drag-Drop , Demo-AJAX-Tree

!TAGX also works within frames. It returns the absolute coordinates (= relative to the browser window, not relative to the frame).

 URL GOTO=http://www.iopus.com/imacros/demo/v6/frames/index.htm     
 FRAME F=3     
 TAG POS=1 TYPE=P ATTR=TXT:<SP>Frame3   
 PROMPT TAGX={{!TAGX}} !VAR1 TAGY={{!TAGY}}
 FRAME F=7     
 TAG POS=1 TYPE=P ATTR=TXT:*Frame7  
 PROMPT TAGX={{!TAGX}} !VAR1 TAGY={{!TAGY}}

Related forum post: How can I extract the position of an HTML element?

See Also

!TAGY , !IMAGEX , !IMAGEY, DS