Page 1 of 3

Hide Console plugin

Posted: 04 Apr 2008, 23:09
by kingkevz
How to use

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;

Re: Hide Console plugin

Posted: 06 Apr 2008, 04:47
by BotMyHobby
3. It only works if you are using the 'Console' interface.<

Wat Mean By 'Console' interface

Re: Hide Console plugin

Posted: 06 Apr 2008, 11:08
by h4rry84
it's when you use start.exe and not wxstart.exe , understood ?

Re: Hide Console plugin

Posted: 07 Apr 2008, 08:22
by BotMyHobby
Not Understand! me Using Open Kore 2.0.5.1, inside only got start.exe!

Re: Hide Console plugin

Posted: 08 Apr 2008, 10:12
by alpha
well then it should work perfectly fine for you..
here is a small tweak to this if u dont wanna be asked whether to hide or not
look for

Code: Select all

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");
                }
        }
}
and make it

Code: Select all

sub autoHideConsole {
        if ($config{hideConsole} > 0) 
                hideConsole();
               }
this way if u have hide console 1 in ur config.txt it will automatically hide :)

Re: Hide Console plugin

Posted: 11 Apr 2008, 12:17
by BotMyHobby
the 'Console' interface.
the original download of 2.0.5.1 not console interface!!!
how solve the problem! to make it can use hideconsole

Re: Hide Console plugin

Posted: 13 Apr 2008, 11:20
by -Fallen-
does this actually reduce computer memory usage (aka less lag even with multiple xkore0 opened?)

Re: Hide Console plugin

Posted: 17 Apr 2008, 07:19
by alpha
err if anything this increase the memory usage.. since its a plugin.. atleast thats what i have noticed...

Re: Hide Console plugin

Posted: 28 Apr 2008, 06:20
by adani_jmc
hmm ...
i'm currently use win32 not wx interface with 2.0.5.1 kore
but it not working

my bot "sound" likes
BotMyHobby
Console' interface
but when i use 2.0.3 kore it worked

hmm
what is the matter

*i have include

Code: Select all

hideConsole 10
in config.txt (10 is my timeout)

Re: Hide Console plugin

Posted: 30 Apr 2008, 09:34
by heerojsn
how can i make this bot to automatically hide in the taskbar upon starting
this is the bot i have, version 2. 0. 6.
Image