Open web page

Syntax

web url [flags] [window] [url2] [geturl2] [gethwnd]

 

Parameters

url - web page address. Can be any string that you can type in web browser's address bar ("http://...", "javascript:...", etc). Also, can be "Back", "Forward", "Home", "Refresh", "Search","Stop", "Quit", a local file or an Internet shortcut. If url is "", nothing is opened, but other features (wait, etc) are applied to current page.

flags:

1 Wait until web page is finished loading and browser isn't busy.
2 Open in existing window, or generate error if a compatible window is not found. Without this flag, if window not found, starts new instance of web browser. If window is specified, this flag has no effect (the specified window must exist).
4 Open in new popup window.
8 Open in new instance of Internet Explorer. Use url "" to open "about:blank".
12 (4|8) QM 2.2.0. Open in new tab (Internet Explorer 7 and later).
16 url2 (final URL) is full or with wildcard characters (*?).
32 Get "Internet Explore_Server" child window handle instead of main window handle.
64 QM 2.2.0. If new window or tab is opened, don't activate it.
128 QM 2.2.0. Vista. If new IE window must be opened, open it with protected mode off. Use this if QM fails to determine whether protected mode must be off, for example when using web("" 8). In exe running as administrator or Low, this flag is ignored, and IE is launched with the same privileges as of exe.
high-order word Max wait time (s). Default: infinite.

window - open web page in this window. If omitted or "", opens in default browser. If your default browser is not Internet Explorer but is IE-compatible (has "Internet Explorer_Server" control), its window class should be specified with RtOptions.

url2 - final URL must contain this string. If flag 1 is set, waits while browser is busy, then checks URL, and, if URL does not contain url2, generates error. If flag 1 isn't set, waits for url2 even if browser isn't busy. You can use "*" to specify that final URL must be same as url. URL is taken from document, not from browser. Sometimes document's URL differs from browser's URL, for example, when error page is displayed. Default: "" (any).

geturl2 - str variable that receives final URL. Default: 0.

gethwnd - int variable that receives main window handle. If flag 32 is set - "Internet Explore_Server" child window handle. Default: 0.

 

Remarks

Opens web page. Navigates directly from current page that is displayed in web browser. Gives more control than run: can wait for web page to finish loading, check/get final url, run "javascript:..." on current page, navigate back, etc, open web page in certain window, always navigate in current window, always open in new window, access web browser's object model.

 

This function works only with Internet Explorer and other windows that display web page in "Internet Explorer_Server" control. However, if only url is used, web page is opened in default web browser, whatever it is (otherwise, opens in Internet Explorer). Some IE-compatible browsers (other than Internet Explorer) do not support some special strings (e.g., "Quit").

 

If used as function, web returns IDispatch interface for web browser control, and can be assigned to variable of type SHDocVw.WebBrowser (or IWebBrowser2).

 

The speed depends on spe.

 

Other ways to open web page:

1. run url - opens web page in default web browser.

2. run browser url - opens web page in the specified browser.

3. Find a link or button in a web page (use htm or acc), and programmatically click it.

4. Use functions of WebBrowser or IHTMLWindow2 interface. For example, the Navigate function of WebBrowser can open web page in certain frame.

5. Use functions from System\Functions\Internet folder to download web page without opening it in web browser.

 

On Windows Vista and later, if IE protected mode is on, something may not work well, especially in exe. Also, if you use _create to create WebBrowser object, it opens two IE7 instances, etc. Use web instead. If you use WebBrowser functions to navigate to an URL in different zone, another IE7 instance is launched. IE8 works better. In IE8 tabs belong to different process(es) than the main IE frame window.

 

Tip: To insert web function, drag and drop a link or Internet shortcut onto the macro text or onto a toolbar.

 

Examples

web "http://msdn.microsoft.com/en-us/library/default.aspx" 1

SHDocVw.WebBrowser b=web("")
out b.LocationURL