Antiec Posted January 4, 2008 Posted January 4, 2008 (edited) Hi once again! I couldn't find anything about this... so is it possible to give Run() function a pause command, just like if I'd use .bat with PAUSE in the end of the file. I have a little start-gui for my java program, which ofcourse opens a cmd-promt window when started. But something goes wrong and the cmd window just disappears instantly and I'd like to see if my java program gives some errors to the cmd-prompt. Is it possible or do I just have to use a .bat to test my run parameters. I wouldn't like to use bat, because I'd need to reconstruct my command from @scriptdir/@windir etc. to .bat and back... Thx, Lassi PS. Oh gosh... I tried "cmd /?" and found out that you can use "Run( @comspec & " /K ...." )". Maybe someone will have this problem and can find it with search... Sorry for bothering you =/ Edited January 4, 2008 by Antiec
GEOSoft Posted January 4, 2008 Posted January 4, 2008 Hi once again!I couldn't find anything about this... so is it possible to give Run() function a pause command, just like if I'd use .bat with PAUSE in the end of the file. I have a little start-gui for my java program, which ofcourse opens a cmd-promt window when started. But something goes wrong and the cmd window just disappears instantly and I'd like to see if my java program gives some errors to the cmd-prompt. Is it possible or do I just have to use a .bat to test my run parameters. I wouldn't like to use bat, because I'd need to reconstruct my command from @scriptdir/@windir etc. to .bat and back...Thx,LassiTry RunWait(@Comspec & "bla..bla..bla") and IIRC don't use the /c switch when testing. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
Antiec Posted January 4, 2008 Author Posted January 4, 2008 RunWait(@Comspec & " bla.bat") only opens the cmd-prompt... Run(@Comspec & " /C bla.bat") runs the bat... Run(@Comspec & " /K bla.bat") runs the bat and pauses cmd-prompt, so I can see what the bat did (and this is what I want)... There's only one problem: using /K messes up the "" quotes badly. Like you can't use ( @comspec & " /K " & @scriptdir & "\bla.exe " & "-windowed" ) IF @scriptdir has spaces in it... without the "-windowed" parameter it works perfectly though...
GEOSoft Posted January 4, 2008 Posted January 4, 2008 RunWait(@Comspec & " bla.bat") only opens the cmd-prompt... Run(@Comspec & " /C bla.bat") runs the bat... Run(@Comspec & " /K bla.bat") runs the bat and pauses cmd-prompt, so I can see what the bat did (and this is what I want)... There's only one problem: using /K messes up the "" quotes badly. Like you can't use ( @comspec & " /K " & @scriptdir & "\bla.exe " & "-windowed" ) IF @scriptdir has spaces in it... without the "-windowed" parameter it works perfectly though...FileGetShortName(@ScriptDir) & "\bla.exe -windowed" should take care of that. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
Antiec Posted January 4, 2008 Author Posted January 4, 2008 Oh, cool! Didn't know that one... I managed to get it working by using double quotes ("") which isn't as nice to read. This one looks pretty awful: Run( @ComSpec & ' /K ""' & _CheckJavaPath("Java Runtime Environment\", $JAVA_CD_DIR) & '" -jar "' & @ScriptDir & '\bla.jar"' & " -param1 -param2 " & '"' & @ScriptDir & '\usethis.file""', @ScriptDir) Though my _CheckJavaPath-function returns the long name and should be altered too, and that means too much work! But I'll use FileGetShortName(@ScriptDir) in the future. Thx!
weaponx Posted January 4, 2008 Posted January 4, 2008 Oh, cool! Didn't know that one... I managed to get it working by using double quotes ("") which isn't as nice to read. This one looks pretty awful: Run( @ComSpec & ' /K ""' & _CheckJavaPath("Java Runtime Environment\", $JAVA_CD_DIR) & '" -jar "' & @ScriptDir & '\bla.jar"' & " -param1 -param2 " & '"' & @ScriptDir & '\usethis.file""', @ScriptDir) Though my _CheckJavaPath-function returns the long name and should be altered too, and that means too much work! But I'll use FileGetShortName(@ScriptDir) in the future. Thx! When your strings get that ugly, use StringFormat(). $string = StringFormat( @ComSpec & ' /K "%s" -jar "%s\bla.jar" -param1 -param2 "%s\usethis.file"', _CheckJavaPath("Java Runtime Environment\", $JAVA_CD_DIR), @ScriptDir, @ScriptDir) Run($string, @ScriptDir)
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