Page 1 of 1

":put" problem in scripting

Posted: Tue Jan 01, 2019 4:16 am
by Okietim
Unable to use :put to display contents of global var from within script.
Terminal cli works fine and can see that global var is changed from script, just no output on console
when initiated from script.
Using 6.43.7 and latest Winbox.
Have searched forum and google for answer without success.
Suggestions appreciated.
2018-12-31_17-56-01.jpg
console.jpg

Re: ":put" problem in scripting  [SOLVED]

Posted: Tue Jan 01, 2019 4:38 am
by mducharme
This is normal behavior. If you want the script to print output while it runs, use the :log command which will output to the system log.

Re: ":put" problem in scripting

Posted: Tue Jan 01, 2019 4:42 am
by sebastia
:put outputs in current session, but since the script is run in separate thread with it's own environment, the output won't be visible.
If you were to call on it from a shell you have open, it will output: "/system script run script1"
Another option: use :log

Re: ":put" problem in scripting

Posted: Tue Jan 01, 2019 6:15 pm
by Okietim
This is normal behavior. If you want the script to print output while it runs, use the :log command which will output to the system log.
Thank you mducharme! Now I know the answer.

Re: ":put" problem in scripting

Posted: Tue Jan 01, 2019 6:16 pm
by Okietim
:put outputs in current session, but since the script is run in separate thread with it's own environment, the output won't be visible.
If you were to call on it from a shell you have open, it will output: "/system script run script1"
Another option: use :log
Thank you sebastia! I'll give that a try.