How to enable console outside debug mode

console always appear in debug mode when we checked the show console option. but when in game mode (run by clicking Game.exe), the console doesn't appear anymore. how can i make the console also appear when in game mode? is there any way to do it?
http://forums.rpgmakerweb.com/index.php?/topic/8000-f12-reset-fix/

Code:
def attach_console  # Get game window text  console_w = Win32API.new('user32','GetForegroundWindow', 'V', 'L').call  buf_len = Win32API.new('user32','GetWindowTextLength', 'L', 'I').call(console_w)  str = ' ' * (buf_len + 1)  Win32API.new('user32', 'GetWindowText', 'LPI', 'I').call(console_w , str, str.length)    # Initiate console  Win32API.new('kernel32.dll', 'AllocConsole', '', '').call  Win32API.new('kernel32.dll', 'SetConsoleTitle', 'P', '').call('RGSS Console')  $stdout.reopen('CONOUT$')    # Sometimes pressing F12 will put the editor in focus first,  # so we have to remove the program's name  game_title = str.strip  game_title.sub! ' - RPG Maker VX Ace', ''    # Set game window to be foreground. This is purely for user convenience  hwnd = Win32API.new('user32.dll', 'FindWindow', 'PP','N').call(0, game_title)  Win32API.new('user32.dll', 'SetForegroundWindow', 'P', '').call(hwnd)end# Call this at the beginningattach_console
it works tsuki 😀 thanks a lot for your help

anyway this can be closed, this has been solved
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-enable-console-outside-debug-mode.22028/