Java 代码
//定义exe 文件存放的绝对路径 File file2 = new File("."); String command = file2.getCanonicalPath()+"\resources\pages\testdata\"+"UploadFile.exe"; //Java中调用autoit.exe程序 Runtime run = Runtime.getRuntime(); try{ Process pro=run.exec(command); BufferedInputStream in=new BufferedInputStream(pro.getInputStream()); BufferedReader br=new BufferedReader(new InputStreamReader(in)); String s; while((s=br.readLine())!=null){ System.out.println(s); } } catch(IOException e){ System.out.println(e); }
=========================================================
Autoit.exe代码:实现功能:将文件的路径粘贴
WinActivate("Choose file to upload") ControlFocus("Choose file to upload", "", "1148") Dim $nr $nr=ClipGet() Send($nr) Send("{Enter}")