mik Posted September 11, 2007 Share Posted September 11, 2007 (edited) I wrote some scripts, and had compiled them to .exe files. And I want to call them in a java method, but how can I get the return value of the .exe file after it's executed. One way I think is to use the shared clipboard: .exe process pastes the return value to the clipboard, and the java process gets the value from clipboard. What I want to know is whether or not there exists other ways to complete it? Thank you! Good night! Edited September 11, 2007 by mik Link to comment Share on other sites More sharing options...
weaponx Posted September 11, 2007 Share Posted September 11, 2007 I wrote some scripts, and had compiled them to .exe files. And I want to call them in a java method, but how can I get the return value of the .exe file after it's executed. One way I think is to use the shared clipboard: .exe process pastes the return value to the clipboard, and the java process gets the value from clipboard. What I want to know is whether or not there exists other ways to complete it? Thank you!Good night!I think this is more of a generic exit code question meant for a Java forum, as it isn't AutoIt specific. Link to comment Share on other sites More sharing options...
weaponx Posted September 11, 2007 Share Posted September 11, 2007 This will get you started:http://www.java2s.com/Code/JavaAPI/java.la...cesswaitFor.htm Link to comment Share on other sites More sharing options...
mik Posted September 12, 2007 Author Share Posted September 12, 2007 (edited) This will get you started:http://www.java2s.com/Code/JavaAPI/java.la...cesswaitFor.htm Thank you very much for your answer:-). Maybe I haven't express my question clearly. I just want to know the communication way between a java method and a .exe file. Exactly speaking, I want to use autoit to develop some scripts, for example, I use OpenFile($fileName,$filePath) to open the specified file, and I want the caller, java method, to know whether the file is opened successfully. That's to say, the .au3 or .exe file should tell something to the caller, how can I realize it? and I have realized it by using the system clipboard, and I want to know if there are other better ways:-)Thank you! Edited September 12, 2007 by mik Link to comment Share on other sites More sharing options...
leuce Posted September 12, 2007 Share Posted September 12, 2007 That's to say, the .au3 or .exe file should tell something to the caller, how can I realize it?I'm very stupid when it comes to this sort of thing, but how about writing the answer to a file, and let your Java app read the file?For example, if a file is successfully opened, then AutoIt creates a file named "temp.txt" with "1" in it, but if the file doesn't open successfully, AutoIt creates a file named "temp.txt" with "0" in it. Java then just reads the file. It's like a clipboard... kinda... only the clipboard is an actual file. Link to comment Share on other sites More sharing options...
StooJ Posted September 12, 2007 Share Posted September 12, 2007 It depends how Java will handle the return codes of course, but when I call AutoIt exes from other AutoIt exes I always pass a return code using: Exit (return code)oÝ÷ ÙèºÚ"µÍY ÌÍÜÝXØÙÜÈHH[Q^] H B[ÙBQ^] B[Y I can then add a simple case statement into the parent exe to interpret the returned code. If you need something more verbose then I'm with Leuce - writing to a log file and then interpreting the results in another (java) app. Link to comment Share on other sites More sharing options...
mik Posted September 17, 2007 Author Share Posted September 17, 2007 It depends how Java will handle the return codes of course, but when I call AutoIt exes from other AutoIt exes I always pass a return code using: Exit (return code)oÝ÷ ÙèºÚ"µÍY ÌÍÜÝXØÙÜÈHH[Q^] H B[ÙBQ^] B[Y I can then add a simple case statement into the parent exe to interpret the returned code. If you need something more verbose then I'm with Leuce - writing to a log file and then interpreting the results in another (java) app. Thank you all! I haven't come here several days. The operation of IO, via shard file, is rather slow, I think. But it seems no other better solution. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now