Fundamental question on logging

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
aqua267
Junior Coder
Posts: 27
Joined: Thu Aug 19, 2010 7:57 pm

Fundamental question on logging

Post by aqua267 » Thu Nov 18, 2010 5:09 pm

Hello,
This is a very basic question. I am sorry if this is a repeat question. I searched the forums and could not find an answer.

I want to log each step of my script. In logging tab, I
a) checkmarked Log Progress of Macro
b) specified the filename C:\Users\\Documents\MacroLogs.txt
c) Log level: Log Start and completion of each step

I used one of the sample script. However once the script is executed, only the timestamp of the file is updated. MacroLogs.txt file is empty. What am I doing wrong here. Thanks much for your help. Should I use WriteLn in my script to log details? I thought the logging would do it for me.

Here's the sample script I am running:


MessageModal>This macro will gather some basic statistics and present them in a Message Box. This is a useful example of how to use variables. %CRLF% %CRLF%Press OK to continue.
GetDate>todays_date
GetTime>current_time
MessageModal>Date : %todays_date% %CRLF%Time : %current_time% %CRLF%Operating System : %OS_VER% %CRLF%Windows Directory : %WIN_DIR% %CRLF%System Directory : %SYS_DIR% %CRLF%Username : %USER_NAME% %CRLF%Computer Name : %COMPUTER_NAME% %CRLF%MSched Version: %MSCHED_VER%

sarver311
Pro Scripter
Posts: 84
Joined: Tue Jun 17, 2008 6:37 pm

Post by sarver311 » Thu Nov 18, 2010 5:18 pm

Are you trying to run the script by hitting F9 while you have the script open? I noticed it doesn't seem to write a log if you do it that way but if you exit the script editor and run your script from the MS screen where it lists all your scripts it seems to work.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Nov 18, 2010 5:20 pm

When you are in the editor and run your script you are DEBUGGING. Logs aren't written to while in debug mode. Similarly schedules don't work and neither do hot keys. For those things, save and close the script.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

sarver311
Pro Scripter
Posts: 84
Joined: Tue Jun 17, 2008 6:37 pm

Post by sarver311 » Thu Nov 18, 2010 5:46 pm

Ahh that makes sense, thanks for the clarification Marcus.

aqua267
Junior Coder
Posts: 27
Joined: Thu Aug 19, 2010 7:57 pm

Post by aqua267 » Thu Nov 18, 2010 7:31 pm

Thanks so much. I was running in the debug mode.

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts