ShellExecute () - Opens webpage thrice

  1. When i use below code in my AFL, the URL opens thrice. Also whenever I do anything in chart even scrolling, the URL again opens thrice. Am i using this function incorrectly?
bi = barindex();

ShellExecute("http://www.whatismyINDEX.com/" + bi, "", "" );

  1. Using ShellExecute() can i control to open the webpage in a new browser Tab, new browser window or refreshing the existing broweser tab ?
  1. It opens once per run, but you run your formula three times.

Hint: code check counts for execution too. Calling ShellExecute() unconditionally is a BadIdea

You should call it conditionally say from ParamTrigger

if( ParamTrigger("open page", "openpage") )
{
    ShellExecute("http://www.amibroker.com", "", "" );
}

or use static variables.

  1. Google is your friend: http://lmgtfy.com/?q=shellexecute - read first link in search results
2 Likes

I want to open the URL using Javascript, because I want to control when to open URL in new tab and when in same tab.

Just testing, but below code is not working.

Error:

EnableScript("jscript");
<%
window.open("www.google.com","_self")
%>
_SECTION_END();

You’ve read wrong docs.

window is NOT JScript object. It does NOT exist in JScript.

It is BOM object. Browser Object Model It is exposed by browsers, not by JScript itself.
https://www.w3schools.com/js/js_window.asp

There is no browser here and no BOM.

Proper way to open URL in AmiBroker is using ShellExcute()