脚本如何做按钮的触发时间 点击:483 | 回复:2



zxiaof0815

    
  • 精华:0帖
  • 求助:2帖
  • 帖子:9帖 | 36回
  • 年度积分:0
  • 历史总积分:84
  • 注册:2007年2月14日
发表于:2013-08-14 22:46:36
楼主

 我是IFIX5。5版本的,现在设备单开时,单开按钮脉冲信号想要延时3秒再变为OFF。脚本如何编写呢。




王者之师--丰李

  • [版主]
  • 精华:4帖
  • 求助:36帖
  • 帖子:953帖 | 4429回
  • 年度积分:31
  • 历史总积分:75678
  • 注册:2012年7月18日
发表于:2013-08-15 10:19:14
1楼

void  CHtmlradioselView::submit()    
  {    
  LPDISPATCH  lpdisp=this->GetHtmlDocument();    
  IHTMLDocument2*  spHtmlDocument=NULL;    
  HRESULT  hr=lpdisp->QueryInterface(IID_IHTMLDocument2,(void**)&spHtmlDocument);    

  IHTMLElementCollection*  pColl=NULL;    
  hr=spHtmlDocument->get_all(&pColl);    
  if(pColl!=NULL&&SUCCEEDED(hr))    
  {    
  LPDISPATCH  pdisp=NULL;    
  IHTMLInputElement*  pelem=NULL;    
  long  num=0;    
  pColl->get_length(&num);    
  for(int  i=0;i<num;i++)    
  {    
  hr=pColl->item(COleVariant((short)i),COleVariant((short)i),&pdisp);    
  if(SUCCEEDED(hr)&&pdisp!=NULL)    
  {    
  hr=pdisp->QueryInterface(IID_IHTMLInputElement,(void**)&pelem);    
  if(SUCCEEDED(hr)&&pelem!=NULL)    
  {    
  bool  bfind=false;    
  BSTR  bstrtype;    
  pelem->get_type(&bstrtype);    
  if(wcsicmp(bstrtype,L"submit")==0)    
  {    
  IHTMLElement*  petmp  =NULL;    
  pelem->QueryInterface(IID_IHTMLElement,(void**)&petmp);    
  petmp->click();    
  petmp->Release();    
  bfind=true;    
  }    
  SysFreeString(bstrtype);    
  pelem->Release();    
  if(bfind)    
  break;    
  }    
  pdisp->Release();    
  }    
  }    
  pColl->Release();    
  }    
  if(spHtmlDocument!=NULL)    
  spHtmlDocument->Release();    
  if(lpdisp!=NULL)    
  lpdisp->Release();    

  }

zxiaof0815

  • 精华:0帖
  • 求助:2帖
  • 帖子:9帖 | 36回
  • 年度积分:0
  • 历史总积分:84
  • 注册:2007年2月14日
发表于:2013-08-16 12:35:28
2楼

谢谢,但没有这么复杂吧


热门招聘
相关主题

官方公众号

智造工程师