Runwait with Comspec and WritetoLog

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Peter2
Posts: 325
Joined: 21 Sep 2014, 14:38
Location: CH

Runwait with Comspec and WritetoLog

26 Jul 2019, 09:54

I have something like this to call my defined EXE with defined parameters in a loop

Code: Select all

RunWait, %ComSpec% /c color 16 && echo my job is running.... && "%main_exedatei%" "%Config%" 
Works fine, and waits(!!) fine with the next loop.

But when I add an output -option like this

Code: Select all

RunWait, %ComSpec% /c color 16 && echo my job is running.... && "%main_exedatei%" "%Config%" >> "mylog.txt"
then it does not wait - it fires both all commands of the loops without waiting.

Bug or feature?

Peter
Peter (AHK Beginner) / Win 10 x64, AHK Version v1.1.33
tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

Re: Runwait with Comspec and WritetoLog

26 Jul 2019, 11:14

Works fine:

Code: Select all

RunWait, %ComSpec% /c color 16 && echo my job is running.... && ping bing.com >> "ping.txt"
MsgBox bye
TAC109
Posts: 1111
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Runwait with Comspec and WritetoLog

26 Jul 2019, 17:41

Enclose all the DOS commands in another set of double-quotes:-

Code: Select all

RunWait, %ComSpec% /c "color 16 && echo my job is running.... && "%main_exedatei%" "%Config%" >> "mylog.txt""
My scripts:-
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
Peter2
Posts: 325
Joined: 21 Sep 2014, 14:38
Location: CH

Re: Runwait with Comspec and WritetoLog

29 Jul 2019, 03:25

TAC109 wrote:
26 Jul 2019, 17:41
Enclose all the DOS commands in another set of double-quotes:-....
Thanks, but it does not work.

Without the output-paraneter ">> d:\mylog.txt" it..
- starts the cmd-window
- sets the color
- starts the exe with the params
- it runs approx. 20 sec and brings some progress-messages to the window
- it closes the window

With the output-paraneter ">> d:\mylog.txt" it..
- starts the cmd-window
- sets the color
- starts the exe with the params
- it runs approx. 1 sec and says "Press any key to continue..."
- it writes ssome internal proframm messages to d:\mylog.txt
Last edited by Peter2 on 29 Jul 2019, 05:20, edited 1 time in total.
Peter (AHK Beginner) / Win 10 x64, AHK Version v1.1.33
TAC109
Posts: 1111
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Runwait with Comspec and WritetoLog

29 Jul 2019, 04:59

You mentioned c:\mylog.txt. Generally Windows does not allow files to be created in the root directory of c:. Try specifying your file in a suitable directory.
My scripts:-
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
Peter2
Posts: 325
Joined: 21 Sep 2014, 14:38
Location: CH

Re: Runwait with Comspec and WritetoLog

29 Jul 2019, 05:19

TAC109 wrote:
29 Jul 2019, 04:59
You mentioned c:\mylog.txt. Generally Windows does not allow files to be created in the root directory of c:. Try specifying your file in a suitable directory.
My fault - I tried to write the example as simple as possible. I modified the posting above.
But the (not-)writing of the log is not the problem; it influences the "Runwait"-Behaviour.
Peter (AHK Beginner) / Win 10 x64, AHK Version v1.1.33
TAC109
Posts: 1111
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Runwait with Comspec and WritetoLog

29 Jul 2019, 17:06

You’ll need to reveal more of your code and the name of the program you are trying to run if you want more help from the forum.
My scripts:-
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Joey5, mcd, NullRefEx, supplementfacts and 141 guests