Jump to content

#AutoIt3Wrapper_Run_Before Problems?!?


Recommended Posts

Last night I discovered the power of the full SciTE package. I particularly like the addition of the AutoIt3Wrapper.exe. The ability to have a set of processes run before and after a compilation is genius. Finally I have a way to compile all my support scripts for inclusion in the master exe.

However, there is one problem. It seems that AutoIt3Wrapper.exe doesn't parse quotes appropriately. It sends these commands directly to the command line, so if you have commands with spaces in the path to an executable, for example, you need to enclose the path in quotes or the command processor will error on you. Well I enclosed my run before commands in proper quotes with the command lines in proper quotes, and I get a "'C:\Program' is not recognized as an internal or external command, operable program or batch file." error! Fabulous!! :rolleyes:

This is my #AutoIt3Wrapper_Run_Before directive:

#AutoIt3Wrapper_Run_Before="C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /in "%scriptdir%\runAs_Monitor_v1.0.1.au3"

Note there is no error in the syntax. If you were to replace the %scriptdir% with the actual path and run this command in cmd.exe you would get results. So I have to conclude that the "'C:\Program' is not recognized as an internal or external command, operable program or batch file." error I receive is a result of AutoIt3wrapper.exe not processing the #AutoIt3Wrapper_Run_Before directive correctly.

If I am right, there is a bug. Where do I report this bug? I can't find the authors contact information anywhere. If I am wrong, please tell me how to fix it. I like the idea of compiling all my support scripts at the same time when I compile the main file.

Thanks in advance.

Link to comment
Share on other sites

If you echo your command line then you see nothing wrong with it. But, CMD has strange rules with handling quotes sometimes.

Do it like this with extra pair of quotes on the outside of the whole command line.

#AutoIt3Wrapper_Run_Before=""%ProgramFiles%\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /in "%scriptdir%\runAs_Monitor_v1.0.1.au3""

:rolleyes:

Link to comment
Share on other sites

Methinks you are a genius!! :rolleyes:

That solved the situation entirely. I still feel there is a problem with how AutoIt3wrapper.exe processes the command, but this is a very acceptable work around.

You have made my day twice in a row now, and it hasn't even been 24 hours!!

Link to comment
Share on other sites

Methinks you are a genius!! :rolleyes:

That solved the situation entirely. I still feel there is a problem with how AutoIt3wrapper.exe processes the command, but this is a very acceptable work around.

You have made my day twice in a row now, and it hasn't even been 24 hours!!

AutoIt3wrapper source looks fine. It is the rules that CMD goes by. CMD does mention 2 quotes explicitly but does not mention what happens if you use 4 or 6 or 8..... So it is a dark area of ruling. I consider what is happening is that CMD sees the 4 quotes and strips the outer 2 quotes, thus your command fails.

Your original command after CMD interpretes it, may look like this. Notice outer quotes stripped.

%ProgramFiles%\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /in "%scriptdir%\runAs_Monitor_v1.0.1.au3

When the extra quotes are added to the outside, then CMD strips them and leaves the quotes next to them alone.

The strange ruling of CMD.

If /C or /K is specified, then the remainder of the command line after

the switch is processed as a command line, where the following logic is

used to process quote (") characters:

1. If all of the following conditions are met, then quote characters

on the command line are preserved:

- no /S switch

- exactly two quote characters

- no special characters between the two quote characters,

where special is one of: &<>()@^|

- there are one or more whitespace characters between the

two quote characters

- the string between the two quote characters is the name

of an executable file.

2. Otherwise, old behavior is to see if the first character is

a quote character and if so, strip the leading character and

remove the last quote character on the command line, preserving

any text after the last quote character.

Edit:

Notice point 2 above also

:rambo:

Edited by MHz
Link to comment
Share on other sites

Well there you have it.

The strange thing is I have been doing system administration for a long time using batch files, VBS, and JS scripts using the simple technique above and I have never had the command line act that way. I guess I never used the switches that yield this behavior.

Thanks for the help!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...