{**************************
RSS OnLoad script Ver1.0 by snowfox
**************************}
var
  inifn:TIniFile;
  i:integer;
  tmr:TTimer;
  aStockCode,aStockType,aFileName:string;
  
function RefreshStock(isScriptStart:boolean):boolean;
var
  url:string;
begin
  //上海股票：http://chart.stock.sohu.com/chart/bf/0/600282.png
  //深圳股票：http://chart.stock.sohu.com/chart/bf/1/000656.png
  try 
    inifn:=TIniFile.create(SkinFileName);
    with inifn do
      begin
      aStockCode:=ReadString('system','StockCode','');
      aStockType:=ReadString('system','StockType','0');
      aFileName:=SkinPath+'Stock03.png'; 
      end;
      url:='http://chart.stock.sohu.com/chart/bf/'+aStockType+'/'+aStockCode+'.png';
      result:=GetIDHttpFile(url,'SaveFileName='+aFileName);
      if result and not isScriptStart then
      RefreshSkin;
    finally
    inifn.free;
    end;  
end;  


procedure tmrTimer(Sender: TObject);
begin
  RefreshStock(false);
end;

begin
  try
    tmr:=TTimer.create(self);
    inifn:=TIniFile.create(SkinFileName);
    with inifn do
    try       
      i:=ReadInteger('system','RefreshInterval',60);
      if i>0 then
      begin
        tmr.Interval:=i*1000;
        tmr.OnTimer:=@tmrTimer;
        tmr.Enabled:=true;
      end;
    finally
      inifn.free;
    end;
    RefreshStock(true);
  except
  
  end;
end.