Is it possible to create a log?

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
mokshal1663
Junior Coder
Posts: 33
Joined: Sat Feb 27, 2010 8:11 pm

Is it possible to create a log?

Post by mokshal1663 » Sat Feb 27, 2010 8:25 pm

Is it possible to create a log where it states everything it is doing (Like a message or something but stays on top so it is constantly visable?). Also, can the style be changed so its wide etc? And is it possible to change the title of a message (Mouse Scheduler thingy)?

Thanks!

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

Post by Marcus Tettmar » Mon Mar 01, 2010 10:12 am

Of course. You can log to a file using WriteLn or TimeStamp and/or enable logging for the macro and even write to the same file.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

mokshal1663
Junior Coder
Posts: 33
Joined: Sat Feb 27, 2010 8:11 pm

Log

Post by mokshal1663 » Mon Mar 01, 2010 12:12 pm

But can it be like a dialog and stay open on the screen and display stuff that it is doing?

gdyvig
Automation Wizard
Posts: 447
Joined: Fri Jun 27, 2008 7:57 pm
Location: Seattle, WA

Post by gdyvig » Mon Mar 01, 2010 11:00 pm

Yes.

The simplest way is to use the Message command (Not MessageModal). It will display the most recently posted message, overwriting the previous. I believe the Dialog command lets you do this plus more.

You can also search the forums for a 3rd party (free I think) tool called "tail" that always displays the tail end of your logfile.


Gale

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

Post by sarver311 » Mon Mar 01, 2010 11:15 pm

Here is an example of a Dialog that displays an error log. When you Click the generate button it puts a timestamp and message in a log file and stores the updated file in the dialog box to the right.

Code: Select all

let>errorlogs=

//This checks to see if this script has been run before, if it has it puts the old logs in the dialog box.
IfFileExists>c:\datelog.txt
ReadFile>c:\datelog.txt,ErrorLogs
endif

Dialog>dialog1
   Caption=
   Width=790
   Height=398
   Top=187
   Left=20
   Memo=msMemo1,225,50,472,159,%ErrorLogs%
   Label=Log File Reports,224,24,true
   Button=Generate,48,62,75,25,5
   Label=Click to Create Time Stamp,48,40,true
   Button=Exit,50,136,75,25,2
EndDialog>dialog1


show>dialog1

label>actionloop

GetDialogAction>dialog1,r
wait>.10

//If it see the button was clicked it generates a timestamp log
if>r=5
//puts the timestamp and error to a file
DateStamp>c:\datelog.txt,Error was Generated

//reads the file, stores it in the variable
ReadFile>c:\datelog.txt,ErrorLogs

//assigns value to the dialog memo box
let>dialog1.Msmemo1=ErrorLogs
resetdialogaction>dialog1
endif

//If exit was clicked then Script closes and exits.
if>r=2
exit
endif

goto>actionloop

mokshal1663
Junior Coder
Posts: 33
Joined: Sat Feb 27, 2010 8:11 pm

Thanks

Post by mokshal1663 » Tue Mar 02, 2010 12:42 pm

Thanks!

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