To automatically hide the Console at startup, add an option named hideConsole in your config.txt. If this option is set to a positive number, this specifies the time in seconds Kore will wait before automatically hiding the console. Set this to 0 to disable auto-hide. If you press any key other than "y" when you are prompted during auto-hide, Kore will cancel auto-hide.
To hide the console manually, type hideconsole
Notes
1. This will simply hide the console and you will not be able to control the bot using console commands while it's running in the background (lame workaround to hide your bot). For clarification, there will be no icon in the system tray when you use this. You can however, control the bot using external means like Chat Commands, XKore 2, webMonitor Plugin, etc.
2. After you hide the console, you can only turn off the bot by ending the process using Task Manager (dangerous), or using an external bot control mechanism (see 1).
3. It only works if you are using the 'Console' interface.
Code: Select all
# =======================
# hideConsole v1.0
# =======================
# by hakore (hakore@users.sourceforge.net)
# see documentation at: http://forums.openkore.com/viewtopic.php?p=103437
package hideConsole;
use Globals qw(%config $interface);
use Log qw(message error);
if ($Settings::interface ne "Console") {
message("The hideConsole plugin only works with the Console interface.\n");
return 1;
}
Plugins::register('hideConsole', 'hide your console', \&onUnload);
my $hooks = Plugins::addHooks(
['initialized', \&autoHideConsole, undef],
['Command_post', \&cmdhideConsole, undef]
);
sub onUnload {
Plugins::delHooks($hooks);
}
sub autoHideConsole {
if ($config{hideConsole} > 0) {
message("Auto-hiding console in $config{hideConsole} seconds...\n");
message("Hide the console? (Y/n) ");
my $msg = $interface->getInput($config{hideConsole});
if ($msg =~ /y/i || $msg eq "") {
message("Console hidden\n\n");
hideConsole();
} else {
message("Cancelled auto-hide of console\n\n");
}
}
}
sub cmdhideConsole {
my (undef, $args) = @_;
my ($cmd) = split(' ', $args->{input}, 2);
if ($cmd eq "hideconsole") {
message("Console hidden\n\n");
hideConsole();
$args->{return} = 1;
}
}
sub hideConsole {
eval 'use Win32::Console;Win32::Console->new(STD_OUTPUT_HANDLE)->Free();';
}
return 1;