Jump to content

RunWait calling another script, but can't see ConsoleWrite in the subscript


Recommended Posts

Hello, 

I'm trying to call a Subscript using a Mainscript. 

This is my Mainscript: 

;#pragma("AutoItExecuteAllowed", True)

ConsoleWrite("Start Loop" & @CRLF)
For $i = 1 To 3
    ConsoleWrite("Looping..." & @CRLF)
    Sleep(1000)
    RunWait(@AutoItExe & " /AutoIt3ExecuteScript Subscript.au3")
Next
ConsoleWrite("Loop Finished" & @CRLF)

This is my Subscript: 

_write15()
;ConsoleWrite("Hello" & @CRLF)
MsgBox(0, "", "Hello")


Func _write15()
    ;ConsoleWrite("15" & @CRLF)
    MsgBox(0, "", "15")
EndFunc

 

If I run exactly like above, it's working correctly. I can see the message boxes every time; first "Hello" and then "15". No problem at all. This is my output: 

+>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop.
Start Loop
Looping...
Looping...
Looping...
+>18:07:37 AutoIt3.exe ended.rc:0
+>18:07:37 AutoIt3Wrapper Finished.

 

BUT: If I comment MsgBox and open the ConsoleWrite in the Subscript, I cannot see "Hello" and "15" in the output window: 

_write15()
ConsoleWrite("Hello" & @CRLF)
;MsgBox(0, "", "Hello")


Func _write15()
    ConsoleWrite("15" & @CRLF)
    ;MsgBox(0, "", "15")
EndFunc

The output is the same as above: 

+>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop.
Start Loop
Looping...
Looping...
Looping...
Loop Finished
+>18:10:45 AutoIt3.exe ended.rc:0
+>18:10:45 AutoIt3Wrapper Finished.

 

Is there a way that I can see "Hello" and "15" as ConsoleWrite in the output window? What I'm expecting is something like this: 

Start Loop
Looping...
15
Hello
Looping...
15
Hello
Looping...
15
Hello
Loop Finished

 

Side note-1: I don't want to use #include <Subscript.au3> because I want to change and edit the content of Subscript any time I want. If I include Subscript.au3, even if I change the content while the Mainscript is running, I cannot see the changes until I start Mainscript again. 

Side note-2: I found #pragma("AutoItExecuteAllowed", True) in some other topics, but I couldn't make use of it, so I commented it. 

 

Edited by taylansan

TY.

Link to comment
Share on other sites

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

×
×
  • Create New...