Writing entries on an existing file in Logs folder

All about the macro plugin can be found in this forum. This forum is intended for the macro plugin only.

Moderator: Moderators

ptcarino
Plain Yogurt
Plain Yogurt
Posts: 62
Joined: 17 Jul 2010, 00:48
Noob?: No
Location: pRO Valkyrie

Writing entries on an existing file in Logs folder

#1 Post by ptcarino »

so i decided to make my own kind of logs and i found this neat code off the internet

Code: Select all

do eval open(FILE, ">>", Settings::getControlFilename("filename.txt")); print FILE "insert entry here\n"; close FILE;
and was wondering how would i change it to logs folder instead of control folder.
Image
rocknroll
Been there done that!
Been there done that!
Posts: 118
Joined: 19 Sep 2011, 07:30
Noob?: Yes

Re: Writing entries on an existing file in Logs folder

#2 Post by rocknroll »

ptcarino wrote:so i decided to make my own kind of logs and i found this neat code off the internet

Code: Select all

do eval open(FILE, ">>", Settings::getControlFilename("filename.txt")); print FILE "insert entry here\n"; close FILE;
and was wondering how would i change it to logs folder instead of control folder.
macro

Code: Select all

$::Settings::logs_folder

plugin / subroutine

Code: Select all

$Settings::logs_folder
macro.txt

Code: Select all

macro IO {
	$file = "$::Settings::logs_folder/filename.txt";
	do eval open FILE, ">>:utf8", $file; print FILE "insert entry here\n"; close FILE;
}
Sorry, my english is very bad !
ptcarino
Plain Yogurt
Plain Yogurt
Posts: 62
Joined: 17 Jul 2010, 00:48
Noob?: No
Location: pRO Valkyrie

Re: Writing entries on an existing file in Logs folder

#3 Post by ptcarino »

rocknroll wrote:
ptcarino wrote:so i decided to make my own kind of logs and i found this neat code off the internet

Code: Select all

do eval open(FILE, ">>", Settings::getControlFilename("filename.txt")); print FILE "insert entry here\n"; close FILE;
and was wondering how would i change it to logs folder instead of control folder.
macro

Code: Select all

$::Settings::logs_folder

plugin / subroutine

Code: Select all

$Settings::logs_folder
macro.txt

Code: Select all

macro IO {
	$file = "$::Settings::logs_folder/filename.txt";
	do eval open FILE, ">>:utf8", $file; print FILE "insert entry here\n"; close FILE;
}
wow thanks. i didn't expect for a full code. i thought it's gonna be a step by step process :lol:

i appreciate the help! thanks!
Image