com.jacob.activeX.ActiveXComponent Java Examples
The following examples show how to use
com.jacob.activeX.ActiveXComponent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OfficeHtmlUtil.java From jeecg with Apache License 2.0 | 6 votes |
/** * EXCEL转HTML * * @param xlsfile * EXCEL文件全路径 * @param htmlfile * 转换后HTML存放路径 */ public void excelToHtml(String xlsfile, String htmlfile) { ActiveXComponent app = new ActiveXComponent("Excel.Application"); // 启动excel try { app.setProperty("Visible", new Variant(false)); Dispatch excels = app.getProperty("Workbooks").toDispatch(); Dispatch excel = Dispatch.invoke(excels, "Open", Dispatch.Method, new Object[] { xlsfile, new Variant(false), new Variant(true) }, new int[1]).toDispatch(); Dispatch.invoke(excel, "SaveAs", Dispatch.Method, new Object[] { htmlfile, new Variant(EXCEL_HTML) }, new int[1]); Variant f = new Variant(false); Dispatch.call(excel, "Close", f); org.jeecgframework.core.util.LogUtil.info("wordtohtml转换成功"); } catch (Exception e) { e.printStackTrace(); } finally { app.invoke("Quit", new Variant[] {}); } }
Example #2
Source File: OfficeHtmlUtil.java From jeewx with Apache License 2.0 | 6 votes |
/** * WORD转HTML * * @param docfile * WORD文件全路径 * @param htmlfile * 转换后HTML存放路径 */ public void wordToHtml(String docfile, String htmlfile) { ActiveXComponent app = new ActiveXComponent("Word.Application"); // 启动word try { app.setProperty("Visible", new Variant(false)); Dispatch docs = app.getProperty("Documents").toDispatch(); Dispatch doc = Dispatch.invoke(docs, "Open", Dispatch.Method, new Object[] { docfile, new Variant(false), new Variant(true) }, new int[1]).toDispatch(); Dispatch.invoke(doc, "SaveAs", Dispatch.Method, new Object[] { htmlfile, new Variant(WORD_HTML) }, new int[1]); Variant f = new Variant(false); Dispatch.call(doc, "Close", f); } catch (Exception e) { e.printStackTrace(); } finally { app.invoke("Quit", new Variant[] {}); } }
Example #3
Source File: OfficeHtmlUtil.java From jeewx with Apache License 2.0 | 6 votes |
/** * EXCEL转HTML * * @param xlsfile * EXCEL文件全路径 * @param htmlfile * 转换后HTML存放路径 */ public void excelToHtml(String xlsfile, String htmlfile) { ActiveXComponent app = new ActiveXComponent("Excel.Application"); // 启动excel try { app.setProperty("Visible", new Variant(false)); Dispatch excels = app.getProperty("Workbooks").toDispatch(); Dispatch excel = Dispatch.invoke(excels, "Open", Dispatch.Method, new Object[] { xlsfile, new Variant(false), new Variant(true) }, new int[1]).toDispatch(); Dispatch.invoke(excel, "SaveAs", Dispatch.Method, new Object[] { htmlfile, new Variant(EXCEL_HTML) }, new int[1]); Variant f = new Variant(false); Dispatch.call(excel, "Close", f); org.jeecgframework.core.util.LogUtil.info("wordtohtml转换成功"); } catch (Exception e) { e.printStackTrace(); } finally { app.invoke("Quit", new Variant[] {}); } }
Example #4
Source File: Com.java From xunxian with Apache License 2.0 | 5 votes |
/** * 创建大漠Com对象 */ public boolean createDmCom(){ boolean xnx3_result=false; try { this.activeDm=new ActiveXComponent("dm.dmsoft"); //创建大漠对象 xnx3_result=true; } catch (Exception e) { e.printStackTrace(); new Func.File().log("创建大漠Com对象时异常捕获:"+e.getMessage()); } return xnx3_result; }
Example #5
Source File: SaoHuoFunc.java From xunxian with Apache License 2.0 | 5 votes |
public SaoHuoFunc(ActiveXComponent active){ this.activeDm=active; this.mouse=new Func.Mouse(this.activeDm); this.sleep=new Func.Sleep(); this.findPic=new Func.FindPic(this.activeDm); this.findStr=new Func.FindStr(this.activeDm); this.lang=new Func.Lang(); this.file=new Func.File(this.activeDm); this.color=new Func.Color(this.activeDm); this.press=new Func.Press(this.activeDm); this.message=new Func.Message(); }
Example #6
Source File: DaGuaiFunc.java From xunxian with Apache License 2.0 | 5 votes |
public DaGuaiFunc(ActiveXComponent activeDm){ this.activeDm=activeDm; this.mouse=new Func.Mouse(this.activeDm); this.sleep=new Func.Sleep(); this.findPic=new Func.FindPic(this.activeDm); this.findStr=new Func.FindStr(this.activeDm); this.lang=new Func.Lang(); this.file=new Func.File(this.activeDm); this.color=new Func.Color(this.activeDm); this.press=new Func.Press(this.activeDm); this.position=new Func.Position(this.activeDm); this.guard=new Guard(this.activeDm); }
Example #7
Source File: Guard.java From xunxian with Apache License 2.0 | 5 votes |
public Guard(ActiveXComponent activeDm) { this.activeDm=activeDm; this.color=new Color(this.activeDm); this.findPic=new FindPic(this.activeDm); this.mouse=new Mouse(this.activeDm); this.press=new Press(this.activeDm); this.sleep=new Sleep(); this.position=new Position(this.activeDm); this.file=new Func.File(this.activeDm); this.xinNuo=new XinNuo(this.activeDm); }
Example #8
Source File: Com.java From xunxian with Apache License 2.0 | 5 votes |
/** * 创建大兵窗口Com对象 */ public boolean createDb_WindowCom(){ boolean xnx3_result=false; try { this.activeDb_Window=new ActiveXComponent("DBSoft.DBSoft_Window"); xnx3_result=true; } catch (Exception e) { e.printStackTrace(); new Func.File().log("创建大兵窗口Com对象时异常捕获:"+e.getMessage()); } return xnx3_result; }
Example #9
Source File: Com.java From xunxian with Apache License 2.0 | 5 votes |
/** * 创建大兵键鼠Com对象 */ public boolean createDb_MouseKeyCom(){ boolean xnx3_result=false; try { this.activeDb_MouseKey=new ActiveXComponent("DBSoft.DBSoft_MouseKey"); xnx3_result=true; } catch (Exception e) { e.printStackTrace(); new Func.File().log("创建大兵键鼠Com对象时异常捕获:"+e.getMessage()); } return xnx3_result; }
Example #10
Source File: XinNuo.java From xunxian with Apache License 2.0 | 5 votes |
/** * 校验信诺对象 * 首先检查是否创建了信诺对象,若是创建了则跳过,没创建则先创建 */ public void verifyXinNuo(){ int i=0; while(i++<10){ try { Command.activeXinNuo.invoke("WaitOnline"); //检测繁忙程度,判断信诺对象是否创建 i=100; //退出循环 } catch (Exception e) { Command.activeXinNuo=new ActiveXComponent("XinNuo.SendData"); //创建信诺自动答题对象,再次创建 } } if(i<100){ //小于100,循环中并没有成功过 new Func.File().log("加载自动答题失败!可尝试关闭软件后重新打开软件"); } }
Example #11
Source File: Position.java From xunxian with Apache License 2.0 | 4 votes |
public Position(ActiveXComponent active) { this.activeDm=active; }
Example #12
Source File: IiTunes.java From The-5zig-Mod with MIT License | 4 votes |
/** * Initiate iTunes Controller. */ public IiTunes() { iTunes = new ActiveXComponent("iTunes.Application"); }
Example #13
Source File: Com.java From xnx3 with Apache License 2.0 | 4 votes |
/** * 创建dm.dmsoft对象 * <li>检测dm.dll是否已注册,若是没有注册,则自动注册 * <li>若是已注册,则创建dm.dmsoft对象 */ private void initRegisterDll(){ if(Com.initDll){ return; } Com.initDll=true; activeBean=new ActiveBean(); String currentDir=Lang.getCurrentJrePath(); //当前项目Jre路径 try { ActiveXComponent activeDm=new ActiveXComponent("dm.dmsoft"); activeBean.setDm(activeDm); //创建大漠对象 activeBean.setPlugin365(new ActiveXComponent("Plugin365ID")); //创建365对象 this.createSuccess=true; } catch (Exception e) { e.printStackTrace(); //检测dm.dll是否放到了C:下 String dm="C:\\dm.dll"; if(!FileUtil.exists(dm)){ this.createSuccess=false; FileUtil.inputStreamToFile(this.getClass().getResourceAsStream("dll/dm.dll"), dm); SystemUtil.registerDll(dm); log.debug(this, "initRegisterDll()", "注册dm.dll完毕"); } //检测Plug365New.dll是否放到了C:下 String plug365="C:\\Plug365New.dll"; if(!FileUtil.exists(plug365)){ this.createSuccess=false; FileUtil.inputStreamToFile(this.getClass().getResourceAsStream("dll/Plug365New.dll"), plug365); SystemUtil.registerDll(plug365); log.debug(this, "initRegisterDll()", "注册Plug365New.dll完毕"); } try { activeBean.setDm(new ActiveXComponent("dm.dmsoft")); //创建大漠对象 activeBean.setPlugin365(new ActiveXComponent("Plugin365ID")); //创建365对象 log.debug(this, "initDll", "检测到dll未注册,已自动注册完毕"); this.createSuccess=true; } catch (Exception e2) { this.createSuccess=false; e2.printStackTrace(); if(e2.getMessage().equals("Can't co-create object")){ System.out.println("检测到dll插件未注册,进行自动注册时出错!报此异常,极大可能是运行的Jar导致的,请下载我们测试好的Jar1.7安装包进行开发调试"); System.out.println("http://www.xnx3.com/doc/jre1.7.html"); System.out.println("(如果弹出提示注册...dll文件失败,则你的操作系统注册不了,有极少数的xp、win7的用户电脑注册不了的,可以换台电脑测试)"); } } } }
Example #14
Source File: ActiveBean.java From xnx3 with Apache License 2.0 | 4 votes |
public ActiveXComponent getDm() { return dm; }
Example #15
Source File: SkillFunc.java From xunxian with Apache License 2.0 | 4 votes |
public SkillFunc(ActiveXComponent activeDm) { this.activeDm=activeDm; this.press=new Press(this.activeDm); this.sleep=new Sleep(); this.mouse=new Mouse(this.activeDm); }
Example #16
Source File: ActiveBean.java From xnx3 with Apache License 2.0 | 4 votes |
public void setDm(ActiveXComponent dm) { this.dm = dm; }
Example #17
Source File: File.java From xunxian with Apache License 2.0 | 4 votes |
public File(ActiveXComponent active) { this.activeDm=active; }
Example #18
Source File: FindPic.java From xunxian with Apache License 2.0 | 4 votes |
public FindPic(ActiveXComponent active) { this.activeDm=active; }
Example #19
Source File: LanAnswer.java From xunxian with Apache License 2.0 | 4 votes |
public LanAnswer(ActiveXComponent active) { this.activeDm=active; }
Example #20
Source File: Window.java From xunxian with Apache License 2.0 | 4 votes |
public Window(ActiveXComponent activeDm,ActiveXComponent activeDb){ this.activeDm=activeDm; this.activeDbWindow=activeDb; }
Example #21
Source File: Window.java From xunxian with Apache License 2.0 | 4 votes |
public Window(ActiveXComponent activeDm){ this.activeDm=activeDm; }
Example #22
Source File: Mouse.java From xunxian with Apache License 2.0 | 4 votes |
public Mouse(ActiveXComponent activeDBMouseKey,ActiveXComponent activeDm){ this.activeDBMouseKey=activeDBMouseKey; this.activeDm=activeDm; }
Example #23
Source File: Press.java From xunxian with Apache License 2.0 | 4 votes |
public Press(ActiveXComponent active) { this.activeDm=active; }
Example #24
Source File: Color.java From xunxian with Apache License 2.0 | 4 votes |
public Color(ActiveXComponent active) { this.activeDm=active; }
Example #25
Source File: ActiveBean.java From xnx3 with Apache License 2.0 | 4 votes |
public ActiveXComponent getPlugin365() { return plugin365; }
Example #26
Source File: ActiveBean.java From xnx3 with Apache License 2.0 | 4 votes |
public void setPlugin365(ActiveXComponent plugin365) { this.plugin365 = plugin365; }
Example #27
Source File: IiTunes.java From The-5zig-Mod with GNU General Public License v3.0 | 4 votes |
/** * Initiate iTunes Controller. */ public IiTunes() { iTunes = new ActiveXComponent("iTunes.Application"); }
Example #28
Source File: Com.java From xunxian with Apache License 2.0 | 4 votes |
/** * 创建DM并进行绑定 */ public boolean createDm(){ boolean xnx3_result=false; for (int i = 0; i < 30; i++) { try { this.activeDm=new ActiveXComponent("dm.dmsoft"); //创建大漠对象 //设置当前资源路径 int setPath=activeDm.invoke("SetPath", Command.thisFilePath+"\\"+Command.resource).getInt(); if(setPath==0){ new Func.Message().showMessageDialog("设置当前资源路径出错!"); } //进行dm窗口绑定 Variant[] var=new Variant[5]; var[0]=new Variant(Command.hwnd); var[1]=new Variant("dx"); var[2]=new Variant("dx"); var[3]=new Variant("dx"); var[4]=new Variant(0); int bindWindow=activeDm.invoke("BindWindow",var).getInt(); var=null; if(bindWindow==0){ new File().log("窗口绑定失败,强制解除上次窗口的绑定,再次尝试中……"); this.activeDm.invoke("ForceUnBindWindow",Command.hwnd); new Sleep().sleep(60000); xnx3_result=false; }else{ //绑定成功 //加载点阵字库 this.activeDm.invoke("SetDict",new Variant(0),new Variant("elseSimpleDict.txt")); //自动扫货的“出售价格”,ffd800-88888, this.activeDm.invoke("SetDict",new Variant(1),new Variant("mapPositionDict.txt")); this.activeDm.invoke("SetDict",new Variant(2),new Variant("PanJunDict.txt")); this.activeDm.invoke("SetDict",new Variant(3),new Variant("elseDict.txt")); //宠物壳子的“神兽侍宠蛋”、宝宝的名字等dfdfdf-333333 this.activeDm.invoke("SetDict",new Variant(4),new Variant("tanMoneyNumDict.txt")); //自动扫货的摊位放上后提示的价格、购买后确认的价格,bea102-333333|efca00-222222|8ea7a7-444444|d7efef-444444 this.activeDm.invoke("SetDict",new Variant(5),new Variant("buyNumDict.txt")); //自动扫货确认购买后购买的数量,bea102-333333|efca00-222222|8ea7a7-444444|d7efef-444444 this.activeDm.invoke("SetDict",new Variant(6),new Variant("stoneGuaDict.txt")); //自动扫货摊位上扫描有卦象的八卦灵石,ff0000-222222|cc0000-000000 this.activeDm.invoke("SetDict",new Variant(7),new Variant("stoneDict.txt")); //自动扫货摊位上扫描有卦象的八卦灵石,35bfff-555555|00ff00-555555|acf003-555555|00ffff-555555 this.activeDm.invoke("SetDict",new Variant(8),new Variant("stoneNaiJiuDict.txt")); //八卦灵石读取耐久度 ff0000-333333|d30707-666666|ffffff-222222|efefef-555555|9f9d9b-333333|00ff00-333333|03d008-555555 if(Command.useOptimizeCpu){ //降低CPU占用 this.activeDm.invoke("DownCpu",50); } xnx3_result=true; Command.bindWindow=true; //dm窗口已绑定 Command.dmComLastCreateTime=include.Module.Now_date.xnx3_time(); //记录此次创建COM接口的时间 i=30; } } catch (Exception e) { xnx3_result=false; e.printStackTrace(); new Func.File().log("DM初始化Func.dmInit()异常捕获:"+e.getMessage()); } } if(xnx3_result){ //成功 }else{ if(Command.run){ //如果是在运行过冲中意外绑定失败,发送邮件,结束软件运行! // 绑定窗口失败后报警,待加入 new Func.SendMail().send("窗口绑定失败", "窗口绑定失败,请关闭游戏后重新打开!(游戏运行一段时间寻仙游戏客户端就容易出现各种错误,最常见的就是弹出错误英文框、卡屏、等等,需关闭后重新登录游戏)"); new Func.File().log("绑定窗口失败!软件已结束运行。请重新登录游戏"); Init.runEnd(); } } System.out.println("DM-COM开启"); return xnx3_result; }
Example #29
Source File: Invoke.java From xunxian with Apache License 2.0 | 4 votes |
public Invoke(ActiveXComponent active) { this.activeDm=active; }
Example #30
Source File: FindStr.java From xunxian with Apache License 2.0 | 4 votes |
public FindStr(ActiveXComponent active) { this.activeDm=active; }