Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reading and writing from a log file
#1
What a great macro program. I was faced with an obsticle that involved the manual spooling of print jobs to a specific printer, with a time delay between spooling. This software has allowed me to perform the action effortlessly, by prompting me for the number of records to be spooled and the wait between spooling.

However the print server that we are running requires a shut down and restart after 80 jobs have been spooled. Is there a way I can count the number of times the macro is run, and create a tabulation of the number of times the PC has spooled to the printer, so that when it reachs 80, it provides me with a prompt saying print server needs to be restarted.

Can I do this by writing to and reading from a txt file, every time the macro is run.
#2
You can use global int variable, or registry functions rget and rset. If file is required, then you can use string functions getfile and setfile. I can help you if it is hard to understand or must be implemented in other way: please send me email.
Alternatively, you can use ini file. Sample below saves variable to ini file. If you run it 5 times, it will show message. Sample equires "winapiQM.txt" file to be selected in Options\Files\Reference_file.

...
int i=GetPrivateProfileInt("Print" "count" 0 "c:\qm.ini") + 1
if(i>=5) i=0; mes ""
str s = i
WritePrivateProfileString("Print" "count" s "c:\qm.ini")


Forum Jump:


Users browsing this thread: 1 Guest(s)