SIZE

From iMacros
Jump to: navigation, search

Resizes the browser window.

Syntax iMacros Browser IE Plug-in Chrome

SIZE X=n Y=m

The size command is necessary mainly when using DirectScreen commands with fixed coordinates, but it may also be necessary when using Image Validation.

Parameters

  • X
    Specifies the new width of the browser window in pixel.
  • Y
    Specifies the new height of the browser window in pixel.

Notes

  1. The SIZE command ensures that the visible browser page is the specified size. The actual size of the entire browser window will be larger than the specified values when you factor in the size of the sidebar, toolbars, etc.
  2. This command does not work when iMacros is -silent or -tray mode.
  3. iMacros for Firefox and Chrome do not support the SIZE command (see Examples below for an alternative).

Examples

When using DS the size of the browser window is essential for the success of the command. If the window is resized between recording and replaying the macro the DS command might fail, because the position of the element which is to be clicked has moved. Therefore, it is advisable (especially when you distribute your macros) to add a SIZE command before all DS commands, so that potential window resizing by the user is undone.

SIZE X=800 Y=600 
DS CMD=CLICK X=234 Y=42 CONTENT=Hello<SP>World!


iMacros for Firefox and Chrome do not support the SIZE command, but with Firefox you can use

 URL GOTO=javascript:window.resizeTo(1200,979);

This "trick" works only if the Firefox browser resizing via Javascript is not disabled in the Firefox settings.

See Also

DS, IMAGECLICK, What factors can cause a macro that uses DirectScreen or image recognition to fail on different machines?