the dummy file alternative sounds a good 
  one.
  thanks d
   
  Paul 
  Ho
  
  
  If you know in advance how many lines each scan should 
  produce then you could export the result to a file and then count the lines - 
  if the number is not what you expected then the cancel button was 
  clicked.
   
  alternately - have a shortcut pointing to a bat file or a 
  script that you can double click that will create a dummy file that you can 
  then add a detection routine in your scan script.  when you want to 
  cancel double click the shortcut that builds/copies the dummy file.  Then 
  the detection routine will see that the file is there and then exit the 
  loop.  Of course to be safe delete the dummy file (if present) when you 
  start up the scan script.
   
  there are a  few more complicated ways:  use a 
  browser to host the script and have a button in it, etc.
   
  d
  
    
    
    Hi,
    I have written a 
    js script that automate scanning a number of afl files every minute. 
    
    I want a way to 
    get out of the loop based on some kind of user input.
    So I came up 
    with the idea that user click on "cancel" during a scan,  but this 
    is where I'm stuck, because I dont know how this can be 
    detected.
    I tried using 
    the return value of scan(), but no luck. Can anybody 
    help?
     
    Ami = new 
    ActiveXObject( "Broker.Application" );
AA = Ami.analysis;
for(i = 1; i 
    <= 1000; 
    i++)
{
 AA.LoadFormula("Formulas\\systems\\foreverUv5.afl");
 result 
    = AA.scan();
 if (result) 
    break;
 AA.LoadFormula("Formulas\\systems\\DailyComposite.afl");
 result 
    = AA.scan();
 if (result == 0) 
    break;
 AA.LoadFormula("Formulas\\systems\\BB 
    squeezeV3.afl");
 result = AA.scan();
 if (result == 0) 
    break;
 WScript.sleep(60000);
}
     
    Paul 
    Ho
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
  
  
  
  YAHOO! GROUPS LINKS