SlimShady Posted December 1, 2004 Share Posted December 1, 2004 I really can't make this work. The command window appears for 0.5 seconds and disappears again. Does someone know why? BTW I managed to solve this at work, but I can't remember and I forgot to upload the script. Can someone take a quick look? $Filename = FileOpenDialog("Choose an Au3 script", @ScriptDir, "Au3 Scripts (*.au3)", 1) If @error Then Exit If StringInStr($Filename, " ") Then $Filename = '"' & $Filename & '"' Run(@ComSpec & ' /c "' & @ScriptDir & '\Au3Check.exe" ' & $Filename & ' && PAUSE', @SystemDir) Link to comment Share on other sites More sharing options...
SlimShady Posted December 1, 2004 Author Share Posted December 1, 2004 (edited) This is f*cked up.I tried with the /K switch and the command window shows up as expected.But that's not what I want. I want a pause at the end so I can press a key to quickly close the window.$Filename = FileOpenDialog("Choose an Au3 script", @ScriptDir, "Au3 Scripts (*.au3)", 1) If @error Then Exit If StringInStr($Filename, " ") Then $Filename = '"' & $Filename & '"' $Command = @ComSpec & ' /K ' & @ScriptDir & '\Au3Check.exe ' & $Filename & ' && PAUSE' ;ClipPut($Command) Run($Command, @SystemDir) Edited December 1, 2004 by SlimShady Link to comment Share on other sites More sharing options...
this-is-me Posted December 1, 2004 Share Posted December 1, 2004 (edited) $Filename = FileOpenDialog("Choose an Au3 script", @ScriptDir, "Au3 Scripts (*.au3)", 1) If @error Then Exit If StringInStr($Filename, " ") Then $Filename = '"' & $Filename & '"' $Command = @ComSpec & ' /c ""' & @ScriptDir & '\Au3Check.exe" ' & $Filename & ' && PAUSE"' ;ClipPut($Command) Run($Command, @SystemDir)Those quotes will kill ya. Translation:cmd.exe /c "complete command to execute"complete command to execute = "C:\spaces name\exefile.exe" -param "C:\spaces name\filename.txt"You have to wrap the entire command in double quotes, but still quote long filenames inside the quoted command. Edited December 1, 2004 by this-is-me Who else would I be? Link to comment Share on other sites More sharing options...
SlimShady Posted December 1, 2004 Author Share Posted December 1, 2004 (edited) I really really really hoped it would work. But, no luck . Edited December 1, 2004 by SlimShady Link to comment Share on other sites More sharing options...
this-is-me Posted December 1, 2004 Share Posted December 1, 2004 What OS are you using? It works OK on WinXP. Who else would I be? Link to comment Share on other sites More sharing options...
SlimShady Posted December 1, 2004 Author Share Posted December 1, 2004 (edited) Windows XP SP1 - I first tried it in my scripts folder that contains no spaces compiled and not compiled - I tried it then on my desktop compiled and not compiled with Au3check and .def on the desktop The command window still appears for 0.5 seconds! The weirdest thing is that it same happened at work on Win2k English. I fixed the problem there. What I did was use absolute, literal paths. That worked and then I converted every path (eg: @COMSPEC, path to AU3check, file path) into a variable again. That worked very well. I'll try that again. Edited December 1, 2004 by SlimShady Link to comment Share on other sites More sharing options...
SlimShady Posted December 2, 2004 Author Share Posted December 2, 2004 It broke again here at work. Then I tried many, many things. Nothing. Then I tried 3 ampersands, 4 ampersands. I solved it by using 1 ampersand. $Filename = FileOpenDialog("Choose an Au3 script", @ScriptDir, "Au3 Scripts (*.au3)", 1) If @error Then Exit $Command = @ComSpec & ' /c ' & @ScriptDir & '\Au3Check.exe -q ' & $Filename & ' & PAUSE' Run($Command, @SystemDir) Link to comment Share on other sites More sharing options...
Guest shaun Posted December 2, 2004 Share Posted December 2, 2004 Assuming you are are working on a Win2K or a WinXP system..There are two command interpreters, i.e. CMD.EXE and COMMAND.COM. Both are located in C:\WINNT\SYSTEM32. The latter is old MS-DOS and by default does not close automatically.So instead of...@COMSPEC & "/C " & ...Try...@SYSTEMDIR & "\COMMAND /C " & ...User will be required to close command window manually. Is this the effect you want? Link to comment Share on other sites More sharing options...
SlimShady Posted December 2, 2004 Author Share Posted December 2, 2004 (edited) Assuming you are are working on a Win2K or a WinXP system..There are two command interpreters, i.e. CMD.EXE and COMMAND.COM. Both are located in C:\WINNT\SYSTEM32. The latter is old MS-DOS and by default does not close automatically.So instead of...@COMSPEC & "/C " & ...Try...@SYSTEMDIR & "\COMMAND /C " & ...User will be required to close command window manually. Is this the effect you want? <{POST_SNAPBACK}>(No offense)1. What you said is not true; When I try the above with Au3Check the window closes after 0.5s, the main problem I had.2. It sucks. It really sucks.I'm glad I solved it. Edited December 2, 2004 by SlimShady Link to comment Share on other sites More sharing options...
this-is-me Posted December 2, 2004 Share Posted December 2, 2004 (edited) Try this one: $9x = (@OSTYPE = "WIN32_WINDOWS") $Filename = FileOpenDialog("Choose an Au3 script", @ScriptDir, "Au3 Scripts (*.au3)", 1) If @error Then Exit $fullcommand = '"' & @ScriptDir & '\Au3Check.exe" "' & $Filename & '" && PAUSE' if $9x = 0 then $fullcommand = '"' & $fullcommand & '"' $Command = @ComSpec & ' /c ' & $fullcommand ;ClipPut($Command) Run($Command, @SystemDir) EDIT: this should work in all sitiations. Edited December 2, 2004 by this-is-me Who else would I be? Link to comment Share on other sites More sharing options...
SlimShady Posted December 2, 2004 Author Share Posted December 2, 2004 (edited) Try this one:$9x = (@OSTYPE = "WIN32_WINDOWS") $Filename = FileOpenDialog("Choose an Au3 script", @ScriptDir, "Au3 Scripts (*.au3)", 1) If @error Then Exit $fullcommand = '"' & @ScriptDir & '\Au3Check.exe" "' & $Filename & '" && PAUSE' if $9x = 0 then $fullcommand = '"' & $fullcommand & '"' $Command = @ComSpec & ' /c ' & $fullcommand ;ClipPut($Command) Run($Command, @SystemDir)EDIT: this should work in all sitiations.<{POST_SNAPBACK}>I tried that. I got the same problem.Solved by using 1 ampersand instead of 2:$fullcommand = '"' & @ScriptDir & '\Au3Check.exe" "' & $Filename & '" & PAUSE'It could be that this has something to do with "command extensions".I'll test some more.Edit:I was wrong about command extensions. Turning it off didn't help a thing.I performed several tests:;Working: ;$Command = @ComSpec & ' /c ' & @ScriptDir & '\Au3Check.exe -q ' & $Filename & ' & PAUSE' ;$Command = @ComSpec & ' /c "' & @ScriptDir & '\Au3Check.exe -q ' & $Filename & '" & PAUSE' ;$Command = @ComSpec & ' /c ""' & @ScriptDir & '\Au3Check.exe" -q "' & $Filename & '" & PAUSE"' ;Not working: ;$Command = @ComSpec & ' /c ' & @ScriptDir & '\Au3Check.exe -q ' & $Filename & ' && PAUSE' ;$Command = @ComSpec & ' /c "' & @ScriptDir & '\Au3Check.exe -q ' & $Filename & '" && PAUSE' ;$Command = @ComSpec & ' /c "' & @ScriptDir & '\Au3Check.exe" -q "' & $Filename & '" && PAUSE' ;$Command = @ComSpec & ' /c ""' & @ScriptDir & '\Au3Check.exe" -q "' & $Filename & '" && PAUSE"' ;$Command = @ComSpec & ' /c "' & @ScriptDir & '\Au3Check.exe" -q "' & $Filename & '" & PAUSE' ;$Command = @ComSpec & ' /c /E:OFF ' & @ScriptDir & '\Au3Check.exe -q ' & $Filename & ' && PAUSE' ;$Command = @ComSpec & ' /c /E:OFF "' & @ScriptDir & '\Au3Check.exe -q ' & $Filename & '" && PAUSE' ;$Command = @ComSpec & ' /c /E:OFF ""' & @ScriptDir & '\Au3Check.exe" -q "' & $Filename & '" && PAUSE"' ;$Command = @ComSpec & ' /c /E:OFF "' & @ScriptDir & '\Au3Check.exe" -q "' & $Filename & '" & PAUSE' Edited December 2, 2004 by SlimShady Link to comment Share on other sites More sharing options...
this-is-me Posted December 2, 2004 Share Posted December 2, 2004 So it is working now? Who else would I be? Link to comment Share on other sites More sharing options...
SlimShady Posted December 2, 2004 Author Share Posted December 2, 2004 So it is working now?<{POST_SNAPBACK}>I said that 3 times in this topic. Link to comment Share on other sites More sharing options...
this-is-me Posted December 2, 2004 Share Posted December 2, 2004 O well, it seemed at one time like you fixed it, then broke it, then fixed it again. I just didn't know if you broke it again... Who else would I be? Link to comment Share on other sites More sharing options...
SlimShady Posted December 2, 2004 Author Share Posted December 2, 2004 No. Yesterday at work, it worked but I forgot to bring the script home.So I tried to solve here at home. I couldn't.When I was at work this morning, the script that worked yesterday didn't work now.The command interpreter wants 1 ampersand & instead of 2.That solved my problem.I didn't understand why, so I tested 30 minutes.But I still don't understand why it doesn't want 2 ampersands, because I'm used to that. 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