$CONSOLE: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
m (Protected "$CONSOLE" ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite)))
m (Add _ECHO to See Also)
 
(12 intermediate revisions by one other user not shown)
Line 6: Line 6:




{{PageDescription}}
* [[_CONSOLE]] '''ON''' or '''OFF''' may be used to show or hide the console window at run time.
* [[_CONSOLE]] '''ON''' or '''OFF''' may be used to show or hide the console window at run time.
* The ''':ONLY''' option can be used when only a console window is desired without a program window.
* The ''':ONLY''' option can be used when only a console window is desired without a program window.
Line 13: Line 14:
* '''QB64 [[Metacommand]]s are not commented out with ' or REM, unlike QuickBASIC metacommands'''
* '''QB64 [[Metacommand]]s are not commented out with ' or REM, unlike QuickBASIC metacommands'''
* Change the title of the [[$CONSOLE]] windows created using [[_CONSOLETITLE]]
* Change the title of the [[$CONSOLE]] windows created using [[_CONSOLETITLE]]
* '''Note:''' Text can be copied partially or totally from console screens in Windows by highlighting and using the title bar menu.  
* '''Note:''' Text can be copied partially or totally from console screens in Windows by highlighting and using the title bar menu.
:: To copy console text output, right click the title bar and select ''Edit'' for ''Mark'' to highlight and repeat to ''Copy''  
:: To copy console text output, right click the title bar and select ''Edit'' for ''Mark'' to highlight and repeat to ''Copy''




{{PageExamples}}
{{PageExamples}}
''Example 1:'' Hiding and displaying a console window. Use [[_DELAY]] to place console in front of main program window.
''Example 1:'' Hiding and displaying a console window. Use [[_DELAY]] to place console in front of main program window.
{{CodeStart}} '' ''
{{CodeStart}}
{{Cl|$CONSOLE}}
{{Cm|$CONSOLE}}
{{Cl|_DELAY}} 4
{{Cl|_DELAY}} {{Text|4|#F580B1}}


{{Cl|_CONSOLE}} OFF
{{Cl|_CONSOLE}} {{Cl|OFF}}
{{Cl|_DELAY}} 4
{{Cl|_DELAY}} {{Text|4|#F580B1}}
{{Cl|_CONSOLE}} ON
{{Cl|_CONSOLE}} {{Cl|ON}}


{{Cl|_DEST}} {{Cl|_CONSOLE}}
{{Cl|_DEST}} {{Cl|_CONSOLE}}
{{Cl|PRINT}} "Close this console window or click main window and press a key!" '' ''
{{Cl|PRINT}} {{Text|<nowiki>"Close this console window or click main window and press a key!"</nowiki>|#FFB100}}
{{CodeEnd}}
{{CodeEnd}}


----


''Example 2:'' How to use a Console window to copy screen output using the ''Edit'' menu by right clicking the console title bar.
''Example 2:'' How to use a Console window to copy screen output using the ''Edit'' menu by right clicking the console title bar.
{{CodeStart}} '' ''
{{CodeStart}}
{{Cl|$CONSOLE}}
{{Cm|$CONSOLE}}
{{Cl|_DEST}} {{Cl|_CONSOLE}}
{{Cl|_DEST}} {{Cl|_CONSOLE}}


c&& = -1: d& = -1: e% = -1: f%% = -1
c&& = {{Text|-1|#F580B1}}: d& = {{Text|-1|#F580B1}}: e% = {{Text|-1|#F580B1}}: f%% = {{Text|-1|#F580B1}}
hx$ = {{Cl|HEX$}}(f%%)
hx$ = {{Cl|HEX$}}(f%%)
{{Cl|PRINT}} "Max hex {{Cl|_BYTE}} = "; hx$; " with"; {{Cl|LEN}}(hx$); "digits ="; {{Cl|VAL}}("{{Cl|&H}}" + hx$)
{{Cl|PRINT}} {{Text|<nowiki>"Max hex _BYTE = "</nowiki>|#FFB100}}; hx$; {{Text|<nowiki>" with"</nowiki>|#FFB100}}; {{Cl|LEN}}(hx$); {{Text|<nowiki>"digits ="</nowiki>|#FFB100}}; {{Cl|VAL}}({{Text|<nowiki>"&H"</nowiki>|#FFB100}} + hx$)
hx$ = {{Cl|HEX$}}(e%)
hx$ = {{Cl|HEX$}}(e%)
{{Cl|PRINT}} "Max hex {{Cl|INTEGER}} = "; hx$; " with"; {{Cl|LEN}}(hx$); "digits ="; {{Cl|VAL}}("{{Cl|&H}}" + hx$)
{{Cl|PRINT}} {{Text|<nowiki>"Max hex INTEGER = "</nowiki>|#FFB100}}; hx$; {{Text|<nowiki>" with"</nowiki>|#FFB100}}; {{Cl|LEN}}(hx$); {{Text|<nowiki>"digits ="</nowiki>|#FFB100}}; {{Cl|VAL}}({{Text|<nowiki>"&H"</nowiki>|#FFB100}} + hx$)
hx$ = {{Cl|HEX$}}(d&)
hx$ = {{Cl|HEX$}}(d&)
{{Cl|PRINT}} "Max hex {{Cl|LONG}} = "; hx$; " with"; {{Cl|LEN}}(hx$); "digits ="; {{Cl|VAL}}("{{Cl|&H}}" + hx$)
{{Cl|PRINT}} {{Text|<nowiki>"Max hex LONG = "</nowiki>|#FFB100}}; hx$; {{Text|<nowiki>" with"</nowiki>|#FFB100}}; {{Cl|LEN}}(hx$); {{Text|<nowiki>"digits ="</nowiki>|#FFB100}}; {{Cl|VAL}}({{Text|<nowiki>"&H"</nowiki>|#FFB100}} + hx$)
hx$ = {{Cl|HEX$}}(c&&)
hx$ = {{Cl|HEX$}}(c&&)
{{Cl|PRINT}} "Max hex {{Cl|_INTEGER64}} = "; hx$; " with"; {{Cl|LEN}}(hx$); "digits ="; {{Cl|VAL}}("{{Cl|&H}}" + hx$)
{{Cl|PRINT}} {{Text|<nowiki>"Max hex _INTEGER64 = "</nowiki>|#FFB100}}; hx$; {{Text|<nowiki>" with"</nowiki>|#FFB100}}; {{Cl|LEN}}(hx$); {{Text|<nowiki>"digits ="</nowiki>|#FFB100}}; {{Cl|VAL}}({{Text|<nowiki>"&H"</nowiki>|#FFB100}} + hx$)
hx$ = {{Cl|HEX$}}(9223372036854775807)
hx$ = {{Cl|HEX$}}({{Text|9223372036854775807|#F580B1}})
{{Cl|PRINT}} "Max {{Cl|_INTEGER64}} value = "; hx$; " with"; {{Cl|LEN}}(hx$); "digits"
{{Cl|PRINT}} {{Text|<nowiki>"Max _INTEGER64 value = "</nowiki>|#FFB100}}; hx$; {{Text|<nowiki>" with"</nowiki>|#FFB100}}; {{Cl|LEN}}(hx$); {{Text|<nowiki>"digits"</nowiki>|#FFB100}}
hx$ = {{Cl|HEX$}}(-9223372036854775808)
hx$ = {{Cl|HEX$}}({{Text|-9223372036854775808|#F580B1}})
{{Cl|PRINT}} "Min {{Cl|_INTEGER64}} value = "; hx$; " with"; {{Cl|LEN}}(hx$); "digits" '' ''
{{Cl|PRINT}} {{Text|<nowiki>"Min _INTEGER64 value = "</nowiki>|#FFB100}}; hx$; {{Text|<nowiki>" with"</nowiki>|#FFB100}}; {{Cl|LEN}}(hx$); {{Text|<nowiki>"digits"</nowiki>|#FFB100}}
{{CodeEnd}}
{{CodeEnd}}
{{OutputStart}}Max hex _BYTE = FF with 2 digits = 255
{{OutputStart}}Max hex _BYTE = FF with 2 digits = 255
Line 58: Line 60:
Min _INTEGER64 value = 8000000000000000 with 16 digits
Min _INTEGER64 value = 8000000000000000 with 16 digits
{{OutputEnd}}
{{OutputEnd}}
: ''Console:'' Right click and select ''Edit'' > ''Select All'' (mouse highlight after) then hit Enter or select ''Edit'' > ''Copy'' to the [[_CLIPBOARD$ (function)|clipboard]].
: ''Console:'' Right click and select ''Edit'' > ''Select All'' (mouse highlight after) then hit Enter or select ''Edit'' > ''Copy'' to the clipboard.
{{TextStart}}Max hex _BYTE = FF with 2 digits = 255
{{TextStart}}Max hex _BYTE = FF with 2 digits = 255
Max hex INTEGER = FFFF with 4 digits = 65535
Max hex INTEGER = FFFF with 4 digits = 65535
Line 68: Line 70:


{{PageSeeAlso}}
{{PageSeeAlso}}
* [[_CONSOLE]]
* [[_CLIPBOARD$ (function)]], [[_CLIPBOARD$]] (statement)
* [[_CONSOLE]], [[_ECHO]]
* [[$SCREENHIDE]], [[$SCREENSHOW]] (QB64 [[Metacommand]]s)
* [[$SCREENHIDE]], [[$SCREENSHOW]] (QB64 [[Metacommand]]s)
* [[_SCREENHIDE]], [[_SCREENSHOW]]
* [[_SCREENHIDE]], [[_SCREENSHOW]]
* [[C_Libraries#Console_Window|C Console Library]]
* [[C Libraries#Console_Window|C Console Library]]




{{PageNavigation}}
{{PageNavigation}}

Latest revision as of 22:14, 4 June 2023

The $CONSOLE Metacommand creates a console window that can be used throughout a QB64 program module.


Syntax

$CONSOLE[:ONLY]


Description

  • _CONSOLE ON or OFF may be used to show or hide the console window at run time.
  • The :ONLY option can be used when only a console window is desired without a program window.
  • _DEST _CONSOLE may be used to send screen output to the console window.
  • _SCREENHIDE and _SCREENSHOW can be used to hide or show the main program window.
  • _DELAY or SLEEP can be used to allow the console window to be set in front of the main program window.
  • QB64 Metacommands are not commented out with ' or REM, unlike QuickBASIC metacommands
  • Change the title of the $CONSOLE windows created using _CONSOLETITLE
  • Note: Text can be copied partially or totally from console screens in Windows by highlighting and using the title bar menu.
To copy console text output, right click the title bar and select Edit for Mark to highlight and repeat to Copy


Examples

Example 1: Hiding and displaying a console window. Use _DELAY to place console in front of main program window.

$CONSOLE
_DELAY 4

_CONSOLE OFF
_DELAY 4
_CONSOLE ON

_DEST _CONSOLE
PRINT "Close this console window or click main window and press a key!"

Example 2: How to use a Console window to copy screen output using the Edit menu by right clicking the console title bar.

$CONSOLE
_DEST _CONSOLE

c&& = -1: d& = -1: e% = -1: f%% = -1
hx$ = HEX$(f%%)
PRINT "Max hex _BYTE = "; hx$; " with"; LEN(hx$); "digits ="; VAL("&H" + hx$)
hx$ = HEX$(e%)
PRINT "Max hex INTEGER = "; hx$; " with"; LEN(hx$); "digits ="; VAL("&H" + hx$)
hx$ = HEX$(d&)
PRINT "Max hex LONG = "; hx$; " with"; LEN(hx$); "digits ="; VAL("&H" + hx$)
hx$ = HEX$(c&&)
PRINT "Max hex _INTEGER64 = "; hx$; " with"; LEN(hx$); "digits ="; VAL("&H" + hx$)
hx$ = HEX$(9223372036854775807)
PRINT "Max _INTEGER64 value = "; hx$; " with"; LEN(hx$); "digits"
hx$ = HEX$(-9223372036854775808)
PRINT "Min _INTEGER64 value = "; hx$; " with"; LEN(hx$); "digits"
Max hex _BYTE = FF with 2 digits = 255
Max hex INTEGER = FFFF with 4 digits = 65535
Max hex LONG = FFFFFFFF with 8 digits = 4294967295
Max hex _INTEGER64 = FFFFFFFFFFFFFFFF with 16 digits =-1
Max _INTEGER64 value = 7FFFFFFFFFFFFFFF with 16 digits
Min _INTEGER64 value = 8000000000000000 with 16 digits
Console: Right click and select Edit > Select All (mouse highlight after) then hit Enter or select Edit > Copy to the clipboard.
Max hex _BYTE = FF with 2 digits = 255
Max hex INTEGER = FFFF with 4 digits = 65535
Max hex LONG = FFFFFFFF with 8 digits = 4294967295
Max hex _INTEGER64 = FFFFFFFFFFFFFFFF with 16 digits =-1
Copied text: The above text was copied after Select All was selected and the smaller area was re-highlighted with the mouse.


See also



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link