Sign in to follow this  
Followers 0
SlimShady

Au3Check wrapper

15 posts in this topic

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)

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by SlimShady

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by this-is-me

Who else would I be?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I really really really hoped it would work. But, no luck :idiot:.

Edited by SlimShady

Share this post


Link to post
Share on other sites

What OS are you using? It works OK on WinXP.


Who else would I be?

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by SlimShady

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

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?

:idiot:

Share this post


Link to post
Share on other sites

#9 ·  Posted (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?

:idiot:

<{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 by SlimShady

Share this post


Link to post
Share on other sites

#10 ·  Posted (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 by this-is-me

Who else would I be?

Share this post


Link to post
Share on other sites

#11 ·  Posted (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 by SlimShady

Share this post


Link to post
Share on other sites

So it is working now?


Who else would I be?

Share this post


Link to post
Share on other sites

So it is working now?

<{POST_SNAPBACK}>

I said that 3 times in this topic.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0