Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with LogFile
#1
Hello i'm using this bit of code to logfile and its logging ok but it puts it like this.....

5/05/2007 1:39:00 a.m.
QuickMacros

is there away to have it log like this?

QuickMacros
5/05/2007 1:39:00 a.m.

Thanks

Code:
Copy      Help
LogFile("QuickMacros" 1 "C:\Documents and Settings\Owner\My Documents\Web.txt")
#2
you could build your own logfile. with some string function; i do that all the time.
An old blog on QM coding and automation.

The Macro Hook
#3
on second thought; use this

function name: "anything you want it to be"

Code:
Copy      Help
;/
function ~s [flags] [$logfile] ;;flags: 1 date/time

;Writes s to the end of the log file but puts the string in front of the date/time stamp.
;s - string or number to write.
;logfile - file name. Default: _logfile (global variable, read more in QM help).
;If file size exceeds _logfilesize (global variable, default is 50 KB), removes first half (oldest data).


;EXAMPLES
;LogFile "string"


;int a=10
;LogFile a 1



if(!len(logfile)) logfile=_logfile
File f.Open(logfile "a+")

int i=f.FileLen
if(!_logfilesize) _logfilesize=50*1024
if(i>_logfilesize)
,f.SetPos(_logfilesize/2)
,f.ReadToStr(_s)
,f.Close
,f.Open(logfile "w")
,i=findc(_s 10)+1
,f.Write(_s+i _s.len-i)

if(flags&1) s.from(s "[]" _s.time("%c"))
f.WriteLine(s)

err+ end ES_FAILED
An old blog on QM coding and automation.

The Macro Hook
#4
Hi thanks for the help...maybe its better for me to tell u and show u what i want u maybe able to tell me how or show me how to do it..i've tried to work it out but i'm so new and just trying to learn by trial and error.. not sure if my codes the best looking but it works.. :oops: i want it so when i click on a page in my list it will log the page, time and date... Its prob really simple and a 2 mins job to do..lol

Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

GdiObject- brush=CreateSolidBrush(ColorFromRGB(234 231 245))
GdiObject- red=CreateSolidBrush(ColorFromRGB(234 248 216))

str controls = "3 5"
str cb3 si5
cb3="XTRA[]QUICKMACROS[]T.A.B[]123RACING[]GOOGLE"
si5="&Games.ico"

if(!ShowDialog("Web_Pages" &Web_Pages &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 210 56 "WEB"
;2 Button 0x54030000 0x4 29 41 31 12 "Cancel"
;3 ComboBox 0x54230243 0x0 6 10 80 213 ""
;5 Static 0x54000003 0x0 181 7 24 19 ""
;7 Static 0x54000000 0x0 95 10 84 16 ""
;8 Edit 0x54030800 0x20000 139 28 66 10 ""
;9 Static 0x54000000 0x0 95 29 42 9 "Opened At"
;10 Static 0x54000000 0x0 95 42 12 9 "On"
;11 Edit 0x54030800 0x20000 108 41 97 9 ""
;6 Button 0x54020007 0x0 92 0 117 54 "STATUS"
;4 Button 0x54020007 0x0 2 0 88 54 "WEB PAGES"
;END DIALOG
;DIALOG EDITOR: "" 0x2010901 "" ""


ret
;messages
DATE-- t_date
;mov 706 588 hDlg
sel message

,case WM_INITDIALOG
,CFont-- f.Create("Courier New" 9 1)
,f.SetFontMulti(hDlg "8 9 10 11")
,CFont-- f1.Create("Courier New" 13 1)
,f1.SetFont(id(7 hDlg))
,case WM_COMMAND goto messages2
,case WM_CTLCOLORDLG ret brush
,case WM_CTLCOLORLISTBOX
,SetBkMode wParam 1
,SetTextColor wParam 0x984B7C
,ret red
,case WM_CTLCOLORSTATIC
,,SetBkMode wParam 1
,,ret brush

ret
;messages2
sel wParam
,case CBN_SELENDOK<<16|3
,_i=CB_SelectedItem(lParam)
,sel _i
,,case 0
,,web "http://nz.yahoo.com/" 0
,,_s="Xtra"; _s.setwintext(id(7 win("WEB" "#32770")))
,,t_date.getclock
,,SetDlgItemText hDlg 8 _s.time(t_date "%X")
,,goto date

,,case 1
,,web "www.quickmacros.com/forum" 0;_s="QuickMacros"; _s.setwintext(id(7 win("WEB" "#32770")))
,,_s="QuickMacros"; _s.setwintext(id(7 win("WEB" "#32770")))
,,t_date.getclock
,,SetDlgItemText hDlg 8 _s.time(t_date "%X")
,,goto date

,,case 2
,,web "www.tab.co.nz/racing/" 0;_s="T.A.B"; _s.setwintext(id(7 win("WEB" "#32770")))
,,_s="T.A.B"; _s.setwintext(id(7 win("WEB" "#32770")))
,,t_date.getclock
,,SetDlgItemText hDlg 8 _s.time(t_date "%X")
,,goto date

,,case 3
,,web "www.123racing.com" 0;_s="123Racing"; _s.setwintext(id(7 win("WEB" "#32770")))
,,_s="123Racing"; _s.setwintext(id(7 win("WEB" "#32770")))
,,t_date.getclock
,,SetDlgItemText hDlg 8 _s.time(t_date "%X")
,,goto date

,,case 4
,,web "www.google.com" 0;_s="Google"; _s.setwintext(id(7 win("WEB" "#32770")))
,,_s="Google"; _s.setwintext(id(7 win("WEB" "#32770")))
,,t_date.getclock
,,SetDlgItemText hDlg 8 _s.time(t_date "%X")
,,goto date    
,case IDOK
ret 1
;date
t_date.getclock
SetDlgItemText hDlg 11 _s.time(t_date "%#x")
#5
below the lines that start with "web blah blah blah" put in that "logfile" command you mentioned earlier but change the "Quick Macros" to whatever you need for each website.

web "www.quickmacros.com/forum" 0;_s="QuickMacros"; _s.setwintext(id(7...
LogFile("QuickMacros" 1 "C:\Documents and Settings\Owner\My Documents\Web.txt")
An old blog on QM coding and automation.

The Macro Hook


Forum Jump:


Users browsing this thread: 1 Guest(s)