Welcome, Guest
You have to register before you can post on our site.

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 308
» Latest member: Donaldvem
» Forum threads: 1,741
» Forum posts: 17,901

Full Statistics

Latest Threads
The QB64 IDE shell
Forum: Utilities
Last Post: JasonPag
09-16-2024, 05:37 PM
» Replies: 9
» Views: 764
Importance regarding Ches...
Forum: Utilities
Last Post: JasonPag
09-01-2024, 06:34 PM
» Replies: 0
» Views: 31
Chess and Analysis and En...
Forum: Utilities
Last Post: JasonPag
08-28-2024, 02:37 PM
» Replies: 0
» Views: 32
DAY 009:_PutImage
Forum: Keyword of the Day!
Last Post: grymmjack
09-02-2023, 02:57 PM
» Replies: 54
» Views: 2,034
Fall Banner Contest?
Forum: Site Suggestions
Last Post: grymmjack
08-31-2023, 11:50 PM
» Replies: 36
» Views: 1,262
ColorPicker - Function th...
Forum: Dav
Last Post: Dav
08-31-2023, 11:04 PM
» Replies: 3
» Views: 316
Goals(1) = New Tile()
Forum: Works in Progress
Last Post: RhoSigma
08-31-2023, 09:45 PM
» Replies: 3
» Views: 127
micro(A)v11
Forum: QBJS, BAM, and Other BASICs
Last Post: bplus
08-31-2023, 09:14 PM
» Replies: 90
» Views: 3,589
Updating The Single Most ...
Forum: QBJS, BAM, and Other BASICs
Last Post: bplus
08-31-2023, 09:13 PM
» Replies: 7
» Views: 254
QBJS Image Question
Forum: QBJS, BAM, and Other BASICs
Last Post: bplus
08-31-2023, 05:49 PM
» Replies: 5
» Views: 155

 
  DAY 006: _KEYCLEAR
Posted by: SMcNeill - 11-11-2022, 04:33 PM - Forum: Keyword of the Day! - Replies (2)

This is, in my opinion, one of those essential keywords that everyone should know and make use of.

What is it?  Keyclear is the simple command which clears the keyboard buffers for us.

How does one use it?  Just call _KEYCLEAR where your program would need to clear the buffers at.

Example of the command:

Code: (Select All)
Print "Kindly play around with your keyboard some, and just press a few random keys for the next few seconds."
_Delay 5
Print "The keys you pressed were:"
Do
    k = _KeyHit
    If k > 0 Then i$ = InKey$: Print k, i$
Loop Until k = 0

Print
Print
Print "Well now, isn't that something?  Your keystrokes were recorded and reported several seconds AFTER you typed them into the keyboard, and affected your program even after your _DELAY!"
Print
Print "So how to prevent that type of issue?"
Print
Print "Captain _KEYCLEAR to the rescue!!!"
Print
Print "Press <ANY KEY> to see the solution in action."
Sleep
_KeyClear
Cls
Print "Kindly play around with your keyboard some, and just press a few random keys for the next few seconds."
_Delay 5
Print "The keys you pressed were:"
_KeyClear: Print "<<Captian _KEYCLEAR to the rescue here!!!>>"
Do
    k = _KeyHit
    If k > 0 Then i$ = InKey$: Print k, i$
Loop Until k = 0


As you can see from the simple example above, _DELAY doesn't stop our program from recording keypresses and adding them into our internal keyboard buffers.   (Neither does SLEEP, or several other "pause" type commands.)  Even though our program appears inactive, it's actually running the keyboard handlers in the background and collecting our last several keystrokes and saving those in a buffer for us.

How could that be bad for us?

Imagine you have a game which pauses execution with a series of set _DELAYs so it can shell out to a video player to play a cutscene for that game.  The user doesn't want to watch the cutscene, so they hit ESC, CTRL-F4, ALT-F4, and multiple other things to try and close the video early, only to find out the video doesn't support those keystrokes...  They watch the cutscene.  Control moves past the delays and back to your program.. Which now tries to process all those keystrokes in the buffer and...  BAM!!  Game closes without saving!!

AAARRRGGHHH!!!   (Who else just threw their controller through the monitor??  Fess up and admit it!  We've all been there. Tongue )

So, what's the easiest way to fix that type of issue?

Simply _KEYCLEAR after playing your cutscene and be done with it.  

Lots of programs have issues by reading unintended keystrokes from the buffers after a pause or delay.  The easiest way to fix those issues is with _KEYCLEAR.  It's your friend -- get to know him well.  Wink

Print this item

  Screen Filler Zakraska
Posted by: DANILIN - 11-11-2022, 01:55 PM - Forum: Programs - Replies (3)

Screen Filler Zakraska

Zakraska.bas program fills screen with dots
by dividing field into a 4x4 section or arbitrarily
and better sides of field of multiples of small sections

Row under label 3:
rotating row checks condition and repeats itself

Dot is placed strictly in an empty place and field is filled in 100%
and there are also counters of points not set and a time counter

Results:
2x2 = 2 seconds & 27ooo repetitions for 25ooo points
4x4 = 5 seconds & 65ooo repetitions for 25ooo points
8x8 = 15 seconds & 95ooo repetitions for 25ooo points
16x16 = 55 seconds & 135ooo repetitions for 25ooo points
32x32 many seconds & many repetitions for 25ooo points

Field is filled in by 100%

[Image: zakraska.gif]

Conclusion: random control is real

Code: (Select All)
w = 640: h = 400: p = w * h: Screen 12 ' zakraska.bas by Danilin
s = 8: a = w / s: b = h / s: Randomize Timer: n = 0: t = Timer

For k = 1 To s ^ 2
    For i = 0 To a - 1
        For j = 0 To b - 1
3 c = Int(Rnd * s) + 1: d = Int(Rnd * s) + 1: If Point(i * s + c, j * s + d) = 4 Then n = n + 1: GoTo 3
            PSet (i * s + c, j * s + d), 4 '+ k Mod 3
        Next: Locate h / 16 + 2, 1: Print n; "points repetition from"; p
        _Title "3akpacka: points repetition " + Str$(n)
Next: _Delay .205: Next: _Delay 1:
Print Timer - t; "seconds for"; s; "x"; s ': GoTo 5

For k = 1 To 2 ' quick
    For i = 0 To w
        For j = 0 To h
            c = Int(Rnd * w) + 1: d = Int(Rnd * h) + 1
            PSet (c, d), 0 '1: '_Delay .00005
Next: Next: Next
_Delay 1':End

5 For k = 1 To s ^ 2 * 2 ' variant
    For i = 0 To a - 1
        For j = 0 To b - 1
            c = Int(Rnd * s) + 1: d = Int(Rnd * s) + 1
            PSet (i * s + c, j * s + d), 0 '+ k Mod 3
Next: Next: _Delay .205: Next: _Delay 1
End


At end dark dots are sprayed without checking for repetitions
in number of points of product of length and width
shaded points remain

Option of canceling shading by increasing number of cycles
all one leaves shaded points

Conclusion: random without control unmanaged

This shading algorithm can show state flags from stripes

Plus there is an idea: exe reads from beginning of basic program parameters
width and height and size of square
and it is possible to paint text screen sign
and colorable quadrats possibly multicolored like a chessboard

TOTAL: absolutely random quickly fill the screen by 100%

[Image: danZELen.gif]

Print this item

  Change font size / Maintain screen size.
Posted by: Pete - 11-11-2022, 01:22 PM - Forum: Utilities - Replies (14)

This is a simple demo for SCREEN 0, but someone could work up a graphics counterpart easily enough...

Code: (Select All)
SCREEN 0
fontsize% = 16
style$ = "monospace"
fontpath$ = ENVIRON$("SYSTEMROOT") + "\fonts\lucon.ttf"
font& = _LOADFONT(fontpath$, fontsize%, style$)
_FONT font&
ww = 600: wh = 350
WIDTH ww \ _FONTWIDTH, wh \ _FONTHEIGHT
PALETTE 7, 63: COLOR 0, 7: CLS
_FONT font&
_SCREENMOVE 0, 0
PRINT "Press ctrl + to increase font size or ctrl - to decrease."
DO
    _LIMIT 30
    c = _KEYHIT
    IF c THEN
        SELECT CASE c
            CASE -189
                IF fontsize% > 9 THEN fontsize% = fontsize% - 2
            CASE -187
                IF fontsize% < 31 THEN fontsize% = fontsize% + 2
        END SELECT
    END IF
    IF oldf% AND fontsize% <> oldf% THEN
        _SCREENHIDE: _FONT 8
        _FREEFONT font&
        font& = _LOADFONT(fontpath$, fontsize%, style$)
        _FONT font&
        _SCREENSHOW
        fw% = _FONTWIDTH: fh% = _FONTHEIGHT
        WIDTH ww / fw%, wh / fh%
        PALETTE 7, 63: COLOR 0, 7: CLS
        _FONT font&
        _SCREENMOVE 0, 0
        PRINT "Font size changed to:"; fontsize%, "width ="; _WIDTH
        _KEYCLEAR
    END IF
    oldf% = fontsize%
LOOP

It's a bit of a trick to capture ctrl combos with some keys like + and -. I used inp(96) as it is one of the easiest. The actual trigger happens when the + or - key is released, and nothing registers when either is pressed.

The routine can be expanded to use $RESIZE:ON but the user would need to decide what changes as the screen size changes. Probably the most popular use would be a fixed number of characters across the screen, so when resize increases the widt, the width statement adjusts to the size, and the font size adjusts to as close to the same number of characters across the screen. To do a perfect operation would also require the development of a margin system.

EDIT: Addressed memory leak, thanks Steve!

Pete

Print this item

Information I have issues with Github
Posted by: mnrvovrfc - 11-10-2022, 11:35 PM - Forum: General Discussion - No Replies

I cannot create an account with Github because it goes against my pride, and some web browsers cannot handle well content of that site. Therefore this very bored user will bore you further with creating a thread just to offer even more opinions that might not be wanted...

If you want to "visit" the issue just drop into the address blank of your web browser:

s://github.com/QB64-Phoenix-Edition/QB64pe/issues/NUMBER

Purposely beheaded so it's not "clickable," and "NUMBER" should be the number shown after pound-sign below.

#233
I support this; just make release (middle) number padded with zero but not make it obvious to the programmer because some code exists that would test for "0.5.0", for "3.2.0" and it's only the beginning. For "3.2.0" case "internally" test for "3.02.0". In fact do it for "03.02.00" in case this programming system could reach version 10!

#219
One fault is that some users like "small" terminal windows, while a typical dialog could require at least 100 characters across. It would be impossible to predict when an user maliciously resizes that window to smaller size to see if the user program crashes. Would have to stick to low-bit characters to draw the dialog. I've discovered "ANSI" codes for coloring not reliable on some "terminal emulators" of Linux distros. This was from using a library called "Lua-term" which allowed simple output to the terminal with coloring and positioning, by using Lua code.

#212
Have "_RESULT" keyword, a lot like Pascal/Delphi, as alternative to "_RETVAL". I resist "EXIT FUNCTION" more than "EXIT SUB", I think it's a retarded way to break out of a function early, and there is too much code already which keeps using function name on LHS which is bad form. This new keyword should put an end to it at least for new programs.

#211
I support this. However, instead of lame-ass keywords from Visual Basic, as alternative how about a compiler option for it? I would like the short-circuit evaluation to be absolute if I choose.

#206
(To the one who opened this issue: ) You would have to change your way of thinking about this. If the concept of MAK file is insisted on you must rearrange your "project" so there is only one main program, and the other BAS files then become BI to be included into the main program. Each "main program" in "slave" BAS files should be put into their own "SUB's" to be called in a desired order by the only true main program. Otherwise each BAS file is destined to be compiled into a separate executable file, without relation to one another. This could be a pain because "CHAIN" and "COMMON SHARED" weren't meant to be used in 32-bit and 64-bit environment where security has some emphasis.

#187
On the Linux side you guys might want to talk to "angros47" that Italian guy who did an audio/MIDI playback library for Freebasic.

#30
This is one of my longest requests.

Print this item

  Karnaugh maps?
Posted by: madscijr - 11-10-2022, 10:02 PM - Forum: General Discussion - No Replies

"A Karnaugh map reduces the need for extensive calculations by taking advantage of humans' pattern-recognition capability. It also permits the rapid identification and elimination of potential race conditions."

I was not familiar with this, I only happened to see a news article about its inventor, who died just this week. 

But it looks like just the kind of thing the folks here might find interesting!

Print this item

  BAM and QBJS: web browser (OFFLINE as well as ONLINE)
Posted by: CharlieJV - 11-10-2022, 08:05 PM - Forum: QBJS, BAM, and Other BASICs - Replies (6)

Maybe silly to mention, but just in case:

Yeah, very cool to get your QB64PE program on the web.

But also cool for sharing to keep locally a program that needs only a web browser to run and you aren't connected to the web.

Bookmark the local program in your browser favourites, and it makes for quick access to the thing.

Print this item

  BAM: How to embed your program in a web page
Posted by: CharlieJV - 11-10-2022, 06:33 PM - Forum: QBJS, BAM, and Other BASICs - Replies (7)

Create your program in BASIC Anywhere Machine.

Once you're happy with your development version, promote it to production (if you want).

Go to the Project menu, and click on Export.

In the Export Options window, click on either Program Deployment (DEV) or Program Deployment (PROD) (to create either a deployment file for the development version of your application or the production version of your application.

Take the HTML file and upload it to your web server/site.  If you just want to share that program as is, share the URL link to that HTML file.

To embed your in-the-one-HTML-file program in any website, do like I'm showing below for this program I have hosted on the web:

Code: (Select All)
<iframe src="https://basicanywheremachine.neocities.org/sample_programs/Rotating%204D%20cube.prod.run.html" style="width:500px;height:400px;"></iframe>

[Image: Screenshot-2022-11-10-2-57-37-PM.png]

Print this item

  SENDKEYS Win32 API Constants
Posted by: Pete - 11-10-2022, 06:15 PM - Forum: Utilities - Replies (15)

Hi Royal Subjects,

Ever get tired of looking up virtual key codes for things like using SENDKEYS in Win32 API? I sure do, and no matter how many Midol I pop, it doesn't seem to help. Did you know they now come in chewables? Umm, cherry, but I digress...

So while we went off topic to talk bloat, here's some bloat that's back on topic!

Code: (Select All)
DECLARE DYNAMIC LIBRARY "user32"
    SUB SENDKEYS ALIAS keybd_event (BYVAL bVk AS LONG, BYVAL bScan AS LONG, BYVAL dwFlags AS _UNSIGNED LONG, BYVAL dwExtraInfo AS _UNSIGNED LONG)
END DECLARE

CONST KEYEVENTF_KEYUP = &H2 ' Key up (Released).
CONST VK_LBUTTON = &H01 'Left mouse button
CONST VK_RBUTTON = &H02 'Right mouse button
CONST VK_CANCEL = &H03 'Control-break processing
CONST VK_MBUTTON = &H04 'Middle mouse button (three-button mouse)
CONST VK_XBUTTON1 = &H05 'X1 mouse button
CONST VK_XBUTTON2 = &H06 'X2 mouse button
CONST VK_BACK = &H08 'BACKSPACE key
CONST VK_TAB = &H09 'TAB key
CONST VK_CLEAR = &H0C 'CLEAR key
CONST VK_RETURN = &H0D 'ENTER key
CONST VK_SHIFT = &H10 'SHIFT key
CONST VK_CONTROL = &H11 'CTRL key
CONST VK_MENU = &H12 'ALT key
CONST VK_PAUSE = &H13 'PAUSE key
CONST VK_CAPITAL = &H14 'CAPS LOCK key
CONST VK_KANA = &H15 'IME Kana mode
CONST VK_HANGUEL = &H15 'IME Hanguel mode (maintained for compatibility; use VK_HANGUL)
CONST VK_HANGUL = &H15 'IME Hangul mode
CONST VK_IME_ON = &H16 'IME On
CONST VK_JUNJA = &H17 'IME Junja mode
CONST VK_FINAL = &H18 'IME final mode
CONST VK_HANJA = &H19 'IME Hanja mode
CONST VK_KANJI = &H19 'IME Kanji mode
CONST VK_IME_OFF = &H1A 'IME Off
CONST VK_ESCAPE = &H1B 'ESC key
CONST VK_CONVERT = &H1C 'IME convert
CONST VK_NONCONVERT = &H1D 'IME nonconvert
CONST VK_ACCEPT = &H1E 'IME accept
CONST VK_MODECHANGE = &H1F 'IME mode change request
CONST VK_SPACE = &H20 'SPACEBAR
CONST VK_PRIOR = &H21 'PAGE UP key
CONST VK_NEXT = &H22 'PAGE DOWN key
CONST VK_END = &H23 'END key
CONST VK_HOME = &H24 'HOME key
CONST VK_LEFT = &H25 'LEFT ARROW key
CONST VK_UP = &H26 'UP ARROW key
CONST VK_RIGHT = &H27 'RIGHT ARROW key
CONST VK_DOWN = &H28 'DOWN ARROW key
CONST VK_SELECT = &H29 'SELECT key
CONST VK_PRINT = &H2A 'PRINT key
CONST VK_EXECUTE = &H2B 'EXECUTE key
CONST VK_SNAPSHOT = &H2C 'PRINT SCREEN key
CONST VK_INSERT = &H2D 'INS key
CONST VK_DELETE = &H2E 'DEL key
CONST VK_HELP = &H2F 'HELP key
CONST VK_LWIN = &H5B 'Left Windows key (Natural keyboard)
CONST VK_RWIN = &H5C 'Right Windows key (Natural keyboard)
CONST VK_APPS = &H5D 'Applications key (Natural keyboard)
CONST VK_SLEEP = &H5F 'Computer Sleep key
CONST VK_NUMPAD0 = &H60 'Numeric keypad 0 key
CONST VK_NUMPAD1 = &H61 'Numeric keypad 1 key
CONST VK_NUMPAD2 = &H62 'Numeric keypad 2 key
CONST VK_NUMPAD3 = &H63 'Numeric keypad 3 key
CONST VK_NUMPAD4 = &H64 'Numeric keypad 4 key
CONST VK_NUMPAD5 = &H65 'Numeric keypad 5 key
CONST VK_NUMPAD6 = &H66 'Numeric keypad 6 key
CONST VK_NUMPAD7 = &H67 'Numeric keypad 7 key
CONST VK_NUMPAD8 = &H68 'Numeric keypad 8 key
CONST VK_NUMPAD9 = &H69 'Numeric keypad 9 key
CONST VK_MULTIPLY = &H6A 'Multiply key
CONST VK_ADD = &H6B 'Add key
CONST VK_SEPARATOR = &H6C 'Separator key
CONST VK_SUBTRACT = &H6D 'Subtract key
CONST VK_DECIMAL = &H6E 'Decimal key
CONST VK_DIVIDE = &H6F 'Divide key
CONST VK_F1 = &H70 'F1 key
CONST VK_F2 = &H71 'F2 key
CONST VK_F3 = &H72 'F3 key
CONST VK_F4 = &H73 'F4 key
CONST VK_F5 = &H74 'F5 key
CONST VK_F6 = &H75 'F6 key
CONST VK_F7 = &H76 'F7 key
CONST VK_F8 = &H77 'F8 key
CONST VK_F9 = &H78 'F9 key
CONST VK_F10 = &H79 'F10 key
CONST VK_F11 = &H7A 'F11 key
CONST VK_F12 = &H7B 'F12 key
CONST VK_F13 = &H7C 'F13 key
CONST VK_F14 = &H7D 'F14 key
CONST VK_F15 = &H7E 'F15 key
CONST VK_F16 = &H7F 'F16 key
CONST VK_F17 = &H80 'F17 key
CONST VK_F18 = &H81 'F18 key
CONST VK_F19 = &H82 'F19 key
CONST VK_F20 = &H83 'F20 key
CONST VK_F21 = &H84 'F21 key
CONST VK_F22 = &H85 'F22 key
CONST VK_F23 = &H86 'F23 key
CONST VK_F24 = &H87 'F24 key
CONST VK_NUMLOCK = &H90 'NUM LOCK key
CONST VK_SCROLL = &H91 'SCROLL LOCK key
CONST VK_LSHIFT = &HA0 'Left SHIFT key
CONST VK_RSHIFT = &HA1 'Right SHIFT key
CONST VK_LCONTROL = &HA2 'Left CONTROL key
CONST VK_RCONTROL = &HA3 'Right CONTROL key
CONST VK_LMENU = &HA4 'Left ALT key
CONST VK_RMENU = &HA5 'Right ALT key
CONST VK_BROWSER_BACK = &HA6 'Browser Back key
CONST VK_BROWSER_FORWARD = &HA7 'Browser Forward key
CONST VK_BROWSER_REFRESH = &HA8 'Browser Refresh key
CONST VK_BROWSER_STOP = &HA9 'Browser Stop key
CONST VK_BROWSER_SEARCH = &HAA 'Browser Search key
CONST VK_BROWSER_FAVORITES = &HAB 'Browser Favorites key
CONST VK_BROWSER_HOME = &HAC 'Browser Start and Home key
CONST VK_VOLUME_MUTE = &HAD 'Volume Mute key
CONST VK_VOLUME_DOWN = &HAE 'Volume Down key
CONST VK_VOLUME_UP = &HAF 'Volume Up key
CONST VK_MEDIA_NEXT_TRACK = &HB0 'Next Track key
CONST VK_MEDIA_PREV_TRACK = &HB1 'Previous Track key
CONST VK_MEDIA_STOP = &HB2 'Stop Media key
CONST VK_MEDIA_PLAY_PAUSE = &HB3 'Play/Pause Media key
CONST VK_LAUNCH_MAIL = &HB4 'Start Mail key
CONST VK_LAUNCH_MEDIA_SELECT = &HB5 'Select Media key
CONST VK_LAUNCH_APP1 = &HB6 'Start Application 1 key
CONST VK_LAUNCH_APP2 = &HB7 'Start Application 2 key
CONST VK_OEM_1 = &HBA 'Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the ';:' key
CONST VK_OEM_PLUS = &HBB 'For any country/region, the '+' key
CONST VK_OEM_COMMA = &HBC 'For any country/region, the ',' key
CONST VK_OEM_MINUS = &HBD 'For any country/region, the '-' key
CONST VK_OEM_PERIOD = &HBE 'For any country/region, the '.' key
CONST VK_OEM_2 = &HBF 'Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the '/?' key
CONST VK_OEM_3 = &HC0 'Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the '`~' key
CONST VK_OEM_4 = &HDB 'Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the '[{' key
CONST VK_OEM_5 = &HDC 'Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the '\|' key
CONST VK_OEM_6 = &HDD 'Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the ']}' key
CONST VK_OEM_7 = &HDE 'Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the 'single-quote/double-quote' key
CONST VK_OEM_8 = &HDF 'Used for miscellaneous characters; it can vary by keyboard.
CONST VK_OEM_102 = &HE2 'The <> keys on the US standard keyboard, or the \\| key on the non-US 102-key keyboard
CONST VK_PROCESSKEY = &HE5 'IME PROCESS key
CONST VK_PACKET = &HE7 'Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT, SendInput, WM_KEYDOWN, and WM_KEYUP
CONST VK_ATTN = &HF6 'Attn key
CONST VK_CRSEL = &HF7 'CrSel key
CONST VK_EXSEL = &HF8 'ExSel key
CONST VK_EREOF = &HF9 'Erase EOF key
CONST VK_PLAY = &HFA 'Play key
CONST VK_ZOOM = &HFB 'Zoom key
CONST VK_NONAME = &HFC 'Reserved
CONST VK_PA1 = &HFD 'PA1 key
CONST VK_OEM_CLEAR = &HFE 'Clear key

REM Keyboard numbers and letters reference.
REM &H30 '0 key
REM &H31 '1 key
REM &H32 '2 key
REM &H33 '3 key
REM &H34 '4 key
REM &H35 '5 key
REM &H36 '6 key
REM &H37 '7 key
REM &H38 '8 key
REM &H39 '9 key
REM &H41 'A key
REM &H42 'B key
REM &H43 'C key
REM &H44 'D key
REM &H45 'E key
REM &H46 'F key
REM &H47 'G key
REM &H48 'H key
REM &H49 'I key
REM &H4A 'J key
REM &H4B 'K key
REM &H4C 'L key
REM &H4D 'M key
REM &H4E 'N key
REM &H4F 'O key
REM &H50 'P key
REM &H51 'Q key
REM &H52 'R key
REM &H53 'S key
REM &H54 'T key
REM &H55 'U key
REM &H56 'V key
REM &H57 'W key
REM &H58 'X key
REM &H59 'Y key
REM &H5A 'Z key

' Use Code (Block $IF/THEN REM statement hack.)
$IF  THEN
        SENDKEYS Constant, 0, 0, 0 'stant Value Description
        SENDKEYS Constant, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_LBUTTON, 0, 0, 0 'Left mouse button
        SENDKEYS VK_LBUTTON, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_RBUTTON, 0, 0, 0 'Right mouse button
        SENDKEYS VK_RBUTTON, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_CANCEL, 0, 0, 0 'Control-break processing
        SENDKEYS VK_CANCEL, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_MBUTTON, 0, 0, 0 'Middle mouse button (three-button mouse)
        SENDKEYS VK_MBUTTON, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_XBUTTON1, 0, 0, 0 'X1 mouse button
        SENDKEYS VK_XBUTTON1, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_XBUTTON2, 0, 0, 0 'X2 mouse button
        SENDKEYS VK_XBUTTON2, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_BACK, 0, 0, 0 'BACKSPACE key
        SENDKEYS VK_BACK, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_TAB, 0, 0, 0 'TAB key
        SENDKEYS VK_TAB, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_CLEAR, 0, 0, 0 'CLEAR key
        SENDKEYS VK_CLEAR, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_RETURN, 0, 0, 0 'ENTER key
        SENDKEYS VK_RETURN, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_SHIFT, 0, 0, 0 'SHIFT key
        SENDKEYS VK_SHIFT, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_CONTROL, 0, 0, 0 'CTRL key
        SENDKEYS VK_CONTROL, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_MENU, 0, 0, 0 'ALT key
        SENDKEYS VK_MENU, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_PAUSE, 0, 0, 0 'PAUSE key
        SENDKEYS VK_PAUSE, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_CAPITAL, 0, 0, 0 'CAPS LOCK key
        SENDKEYS VK_CAPITAL, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_KANA, 0, 0, 0 'IME Kana mode
        SENDKEYS VK_KANA, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_HANGUEL, 0, 0, 0 'IME Hanguel mode (maintained for compatibility; use VK_HANGUL)
        SENDKEYS VK_HANGUEL, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_HANGUL, 0, 0, 0 'IME Hangul mode
        SENDKEYS VK_HANGUL, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_IME_ON, 0, 0, 0 'IME On
        SENDKEYS VK_IME_ON, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_JUNJA, 0, 0, 0 'IME Junja mode
        SENDKEYS VK_JUNJA, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_FINAL, 0, 0, 0 'IME final mode
        SENDKEYS VK_FINAL, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_HANJA, 0, 0, 0 'IME Hanja mode
        SENDKEYS VK_HANJA, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_KANJI, 0, 0, 0 'IME Kanji mode
        SENDKEYS VK_KANJI, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_IME_OFF, 0, 0, 0 'IME Off
        SENDKEYS VK_IME_OFF, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_ESCAPE, 0, 0, 0 'ESC key
        SENDKEYS VK_ESCAPE, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_CONVERT, 0, 0, 0 'IME convert
        SENDKEYS VK_CONVERT, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_NONCONVERT, 0, 0, 0 'IME nonconvert
        SENDKEYS VK_NONCONVERT, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_ACCEPT, 0, 0, 0 'IME accept
        SENDKEYS VK_ACCEPT, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_MODECHANGE, 0, 0, 0 'IME mode change request
        SENDKEYS VK_MODECHANGE, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_SPACE, 0, 0, 0 'SPACEBAR
        SENDKEYS VK_SPACE, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_PRIOR, 0, 0, 0 'PAGE UP key
        SENDKEYS VK_PRIOR, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_NEXT, 0, 0, 0 'PAGE DOWN key
        SENDKEYS VK_NEXT, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_END, 0, 0, 0 'END key
        SENDKEYS VK_END, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_HOME, 0, 0, 0 'HOME key
        SENDKEYS VK_HOME, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_LEFT, 0, 0, 0 'LEFT ARROW key
        SENDKEYS VK_LEFT, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_UP, 0, 0, 0 'UP ARROW key
        SENDKEYS VK_UP, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_RIGHT, 0, 0, 0 'RIGHT ARROW key
        SENDKEYS VK_RIGHT, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_DOWN, 0, 0, 0 'DOWN ARROW key
        SENDKEYS VK_DOWN, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_SELECT, 0, 0, 0 'SELECT key
        SENDKEYS VK_SELECT, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_PRINT, 0, 0, 0 'PRINT key
        SENDKEYS VK_PRINT, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_EXECUTE, 0, 0, 0 'EXECUTE key
        SENDKEYS VK_EXECUTE, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_SNAPSHOT, 0, 0, 0 'PRINT SCREEN key
        SENDKEYS VK_SNAPSHOT, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_INSERT, 0, 0, 0 'INS key
        SENDKEYS VK_INSERT, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_DELETE, 0, 0, 0 'DEL key
        SENDKEYS VK_DELETE, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_HELP, 0, 0, 0 'HELP key
        SENDKEYS VK_HELP, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_LWIN, 0, 0, 0 'Left Windows key (Natural keyboard)
        SENDKEYS VK_LWIN, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_RWIN, 0, 0, 0 'Right Windows key (Natural keyboard)
        SENDKEYS VK_RWIN, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_APPS, 0, 0, 0 'Applications key (Natural keyboard)
        SENDKEYS VK_APPS, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_SLEEP, 0, 0, 0 'Computer Sleep key
        SENDKEYS VK_SLEEP, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_NUMPAD0, 0, 0, 0 'Numeric keypad 0 key
        SENDKEYS VK_NUMPAD0, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_NUMPAD1, 0, 0, 0 'Numeric keypad 1 key
        SENDKEYS VK_NUMPAD1, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_NUMPAD2, 0, 0, 0 'Numeric keypad 2 key
        SENDKEYS VK_NUMPAD2, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_NUMPAD3, 0, 0, 0 'Numeric keypad 3 key
        SENDKEYS VK_NUMPAD3, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_NUMPAD4, 0, 0, 0 'Numeric keypad 4 key
        SENDKEYS VK_NUMPAD4, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_NUMPAD5, 0, 0, 0 'Numeric keypad 5 key
        SENDKEYS VK_NUMPAD5, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_NUMPAD6, 0, 0, 0 'Numeric keypad 6 key
        SENDKEYS VK_NUMPAD6, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_NUMPAD7, 0, 0, 0 'Numeric keypad 7 key
        SENDKEYS VK_NUMPAD7, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_NUMPAD8, 0, 0, 0 'Numeric keypad 8 key
        SENDKEYS VK_NUMPAD8, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_NUMPAD9, 0, 0, 0 'Numeric keypad 9 key
        SENDKEYS VK_NUMPAD9, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_MULTIPLY, 0, 0, 0 'Multiply key
        SENDKEYS VK_MULTIPLY, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_ADD, 0, 0, 0 'Add key
        SENDKEYS VK_ADD, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_SEPARATOR, 0, 0, 0 'Separator key
        SENDKEYS VK_SEPARATOR, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_SUBTRACT, 0, 0, 0 'Subtract key
        SENDKEYS VK_SUBTRACT, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_DECIMAL, 0, 0, 0 'Decimal key
        SENDKEYS VK_DECIMAL, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_DIVIDE, 0, 0, 0 'Divide key
        SENDKEYS VK_DIVIDE, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F1, 0, 0, 0 'F1 key
        SENDKEYS VK_F1, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F2, 0, 0, 0 'F2 key
        SENDKEYS VK_F2, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F3, 0, 0, 0 'F3 key
        SENDKEYS VK_F3, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F4, 0, 0, 0 'F4 key
        SENDKEYS VK_F4, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F5, 0, 0, 0 'F5 key
        SENDKEYS VK_F5, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F6, 0, 0, 0 'F6 key
        SENDKEYS VK_F6, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F7, 0, 0, 0 'F7 key
        SENDKEYS VK_F7, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F8, 0, 0, 0 'F8 key
        SENDKEYS VK_F8, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F9, 0, 0, 0 'F9 key
        SENDKEYS VK_F9, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F10, 0, 0, 0 'F10 key
        SENDKEYS VK_F10, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F11, 0, 0, 0 'F11 key
        SENDKEYS VK_F11, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F12, 0, 0, 0 'F12 key
        SENDKEYS VK_F12, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F13, 0, 0, 0 'F13 key
        SENDKEYS VK_F13, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F14, 0, 0, 0 'F14 key
        SENDKEYS VK_F14, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F15, 0, 0, 0 'F15 key
        SENDKEYS VK_F15, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F16, 0, 0, 0 'F16 key
        SENDKEYS VK_F16, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F17, 0, 0, 0 'F17 key
        SENDKEYS VK_F17, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F18, 0, 0, 0 'F18 key
        SENDKEYS VK_F18, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F19, 0, 0, 0 'F19 key
        SENDKEYS VK_F19, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F20, 0, 0, 0 'F20 key
        SENDKEYS VK_F20, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F21, 0, 0, 0 'F21 key
        SENDKEYS VK_F21, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F22, 0, 0, 0 'F22 key
        SENDKEYS VK_F22, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F23, 0, 0, 0 'F23 key
        SENDKEYS VK_F23, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_F24, 0, 0, 0 'F24 key
        SENDKEYS VK_F24, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_NUMLOCK, 0, 0, 0 'NUM LOCK key
        SENDKEYS VK_NUMLOCK, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_SCROLL, 0, 0, 0 'SCROLL LOCK key
        SENDKEYS VK_SCROLL, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_LSHIFT, 0, 0, 0 'Left SHIFT key
        SENDKEYS VK_LSHIFT, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_RSHIFT, 0, 0, 0 'Right SHIFT key
        SENDKEYS VK_RSHIFT, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_LCONTROL, 0, 0, 0 'Left CONTROL key
        SENDKEYS VK_LCONTROL, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_RCONTROL, 0, 0, 0 'Right CONTROL key
        SENDKEYS VK_RCONTROL, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_LMENU, 0, 0, 0 'Left ALT key
        SENDKEYS VK_LMENU, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_RMENU, 0, 0, 0 'Right ALT key
        SENDKEYS VK_RMENU, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_BROWSER_BACK, 0, 0, 0 'Browser Back key
        SENDKEYS VK_BROWSER_BACK, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_BROWSER_FORWARD, 0, 0, 0 'Browser Forward key
        SENDKEYS VK_BROWSER_FORWARD, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_BROWSER_REFRESH, 0, 0, 0 'Browser Refresh key
        SENDKEYS VK_BROWSER_REFRESH, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_BROWSER_STOP, 0, 0, 0 'Browser Stop key
        SENDKEYS VK_BROWSER_STOP, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_BROWSER_SEARCH, 0, 0, 0 'Browser Search key
        SENDKEYS VK_BROWSER_SEARCH, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_BROWSER_FAVORITES, 0, 0, 0 'Browser Favorites key
        SENDKEYS VK_BROWSER_FAVORITES, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_BROWSER_HOME, 0, 0, 0 'Browser Start and Home key
        SENDKEYS VK_BROWSER_HOME, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_VOLUME_MUTE, 0, 0, 0 'Volume Mute key
        SENDKEYS VK_VOLUME_MUTE, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_VOLUME_DOWN, 0, 0, 0 'Volume Down key
        SENDKEYS VK_VOLUME_DOWN, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_VOLUME_UP, 0, 0, 0 'Volume Up key
        SENDKEYS VK_VOLUME_UP, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_MEDIA_NEXT_TRACK, 0, 0, 0 'Next Track key
        SENDKEYS VK_MEDIA_NEXT_TRACK, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_MEDIA_PREV_TRACK, 0, 0, 0 'Previous Track key
        SENDKEYS VK_MEDIA_PREV_TRACK, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_MEDIA_STOP, 0, 0, 0 'Stop Media key
        SENDKEYS VK_MEDIA_STOP, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_MEDIA_PLAY_PAUSE, 0, 0, 0 'Play/Pause Media key
        SENDKEYS VK_MEDIA_PLAY_PAUSE, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_LAUNCH_MAIL, 0, 0, 0 'Start Mail key
        SENDKEYS VK_LAUNCH_MAIL, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_LAUNCH_MEDIA_SELECT, 0, 0, 0 'Select Media key
        SENDKEYS VK_LAUNCH_MEDIA_SELECT, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_LAUNCH_APP1, 0, 0, 0 'Start Application 1 key
        SENDKEYS VK_LAUNCH_APP1, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_LAUNCH_APP2, 0, 0, 0 'Start Application 2 key
        SENDKEYS VK_LAUNCH_APP2, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_OEM_1, 0, 0, 0 'Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the ';:' key
        SENDKEYS VK_OEM_1, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_OEM_PLUS, 0, 0, 0 'For any country/region, the '+' key
        SENDKEYS VK_OEM_PLUS, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_OEM_COMMA, 0, 0, 0 'For any country/region, the ',' key
        SENDKEYS VK_OEM_COMMA, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_OEM_MINUS, 0, 0, 0 'For any country/region, the '-' key
        SENDKEYS VK_OEM_MINUS, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_OEM_PERIOD, 0, 0, 0 'For any country/region, the '.' key
        SENDKEYS VK_OEM_PERIOD, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_OEM_2, 0, 0, 0 'Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the '/?' key
        SENDKEYS VK_OEM_2, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_OEM_3, 0, 0, 0 'Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the '`~' key
        SENDKEYS VK_OEM_3, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_OEM_4, 0, 0, 0 'Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the '[{' key
        SENDKEYS VK_OEM_4, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_OEM_5, 0, 0, 0 'Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the '\|' key
        SENDKEYS VK_OEM_5, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_OEM_6, 0, 0, 0 'Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the ']}' key
        SENDKEYS VK_OEM_6, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_OEM_7, 0, 0, 0 'Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the 'single-quote/double-quote' key
        SENDKEYS VK_OEM_7, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_OEM_8, 0, 0, 0 'Used for miscellaneous characters; it can vary by keyboard.
        SENDKEYS VK_OEM_8, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_OEM_102, 0, 0, 0 'The <> keys on the US standard keyboard, or the \\| key on the non-US 102-key keyboard
        SENDKEYS VK_OEM_102, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_PROCESSKEY, 0, 0, 0 'IME PROCESS key
        SENDKEYS VK_PROCESSKEY, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_PACKET, 0, 0, 0 'Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT, SendInput, WM_KEYDOWN, and WM_KEYUP
        SENDKEYS VK_PACKET, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_ATTN, 0, 0, 0 'Attn key
        SENDKEYS VK_ATTN, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_CRSEL, 0, 0, 0 'CrSel key
        SENDKEYS VK_CRSEL, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_EXSEL, 0, 0, 0 'ExSel key
        SENDKEYS VK_EXSEL, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_EREOF, 0, 0, 0 'Erase EOF key
        SENDKEYS VK_EREOF, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_PLAY, 0, 0, 0 'Play key
        SENDKEYS VK_PLAY, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_ZOOM, 0, 0, 0 'Zoom key
        SENDKEYS VK_ZOOM, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_NONAME, 0, 0, 0 'Reserved
        SENDKEYS VK_NONAME, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_PA1, 0, 0, 0 'PA1 key
        SENDKEYS VK_PA1, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS VK_OEM_CLEAR, 0, 0, 0 'Clear key
        SENDKEYS VK_OEM_CLEAR, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H30, 0, 0, 0 '0 key
        SENDKEYS &H30, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H31, 0, 0, 0 '1 key
        SENDKEYS &H31, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H32, 0, 0, 0 '2 key
        SENDKEYS &H32, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H33, 0, 0, 0 '3 key
        SENDKEYS &H33, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H34, 0, 0, 0 '4 key
        SENDKEYS &H34, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H35, 0, 0, 0 '5 key
        SENDKEYS &H35, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H36, 0, 0, 0 '6 key
        SENDKEYS &H36, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H37, 0, 0, 0 '7 key
        SENDKEYS &H37, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H38, 0, 0, 0 '8 key
        SENDKEYS &H38, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H39, 0, 0, 0 '9 key
        SENDKEYS &H39, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H41, 0, 0, 0 'A key
        SENDKEYS &H41, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H42, 0, 0, 0 'B key
        SENDKEYS &H42, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H43, 0, 0, 0 'C key
        SENDKEYS &H43, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H44, 0, 0, 0 'D key
        SENDKEYS &H44, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H45, 0, 0, 0 'E key
        SENDKEYS &H45, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H46, 0, 0, 0 'F key
        SENDKEYS &H46, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H47, 0, 0, 0 'G key
        SENDKEYS &H47, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H48, 0, 0, 0 'H key
        SENDKEYS &H48, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H49, 0, 0, 0 'I key
        SENDKEYS &H49, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H4A, 0, 0, 0 'J key
        SENDKEYS &H4A, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H4B, 0, 0, 0 'K key
        SENDKEYS &H4B, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H4C, 0, 0, 0 'L key
        SENDKEYS &H4C, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H4D, 0, 0, 0 'M key
        SENDKEYS &H4D, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H4E, 0, 0, 0 'N key
        SENDKEYS &H4E, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H4F, 0, 0, 0 'O key
        SENDKEYS &H4F, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H50, 0, 0, 0 'P key
        SENDKEYS &H50, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H51, 0, 0, 0 'Q key
        SENDKEYS &H51, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H52, 0, 0, 0 'R key
        SENDKEYS &H52, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H53, 0, 0, 0 'S key
        SENDKEYS &H53, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H54, 0, 0, 0 'T key
        SENDKEYS &H54, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H55, 0, 0, 0 'U key
        SENDKEYS &H55, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H56, 0, 0, 0 'V key
        SENDKEYS &H56, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H57, 0, 0, 0 'W key
        SENDKEYS &H57, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H58, 0, 0, 0 'X key
        SENDKEYS &H58, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H59, 0, 0, 0 'Y key
        SENDKEYS &H59, 0, KEYEVENTF_KEYUP, 0

        SENDKEYS &H5A, 0, 0, 0 'Z key
        SENDKEYS &H5A, 0, KEYEVENTF_KEYUP, 0
$END IF

Kidding aside, I hope to make availble snippets like this, eventually, in my Sam-Clip project at:

Sam-Clip: https://staging.qb64phoenix.com/showthread.php?tid=1042

Special thanks to Dav for the DECLARE LIBRARY header:

Pete (API Princess)
[Image: b6b7782ed5fa6b3493e346c22db729e4.jpg]

Print this item

  My Second Game
Posted by: Gadgetjack - 11-10-2022, 05:29 PM - Forum: Programs - Replies (3)

I remembered playing Apple Panic many years ago. It was based on the arcade Space Panic game. I think it was the very first platformer game to be made. I again "borrowed" a lot of sprites and ideas from the tutorial and created the first level of Mario Apple Panic. It plays a lot like the original game , dig a hole and the apples fall in. The space bar digs. Esc key quits. If you get hit about 3 times , game over. If you clear all 4 apples, you win and game over. It could use some more levels if I get time later , or someone here got really interested. I will include the game and all its parts in a zip, and a screen shot of the game. Again . play it , improve it. It is all open.



Attached Files Thumbnail(s)
   

.zip   Apple.zip (Size: 2.21 MB / Downloads: 39)
Print this item

  Pete's Front Nine
Posted by: dbox - 11-10-2022, 03:35 PM - Forum: QBJS, BAM, and Other BASICs - Replies (6)

Hey Pete, here's a little proof of concept for your golf score card project.  I didn't have your background image file so I just focused on the mechanics of what I think you are trying to achieve.

As you enter the scores the total field is updated automatically.  Clicking the Save Scores button will add the current set of scores to the saved score list.  This list will be saved to the browser's local storage as well as to a "scores.csv" file in the QBJS virtual file system.  You can access this in the Files tab of the Console.

Code: (Select All)
Import Dom From "lib/web/dom.bas"
Import Storage From "lib/web/storage.bas"

Dim Shared savedScores As String
Dim Shared scores(10) As Object

_Title "Pete's Front Nine"

' Load the saved scores from local browser storage
savedScores = Storage.Get("savedScores")
Print savedScores
RefreshSavedScores

' Create the containing div
Dim div: div = Dom.Create("div")
div.style.backgroundColor = "#ccc"
div.style.padding = "20px"

' Create the inputs
Dim i As Integer
For i = 1 To 10
    scores(i) = Dom.Create("input", div)
    scores(i).tabIndex = i
    scores(i).type = "number"
    scores(i).style.width = "40px"
    scores(i).style.marginRight = "2px"
    If i = 10 Then
        scores(i).disabled = true
    Else
        Dom.Event scores(i), "change", sub_UpdateScore
    End If
Next i

Dim btn As Object
Dom.Create "br", div
Dom.Create "br", div
btn = Dom.Create("button", div, "Save Scores")
Dom.Event btn, "click", sub_SaveScores

' Updates the total when one of the scores is changed
Sub UpdateScore
    Dim total As Integer
    Dim i As Integer
    For i = 1 To 9
        total = total + CInt(scores(i).value)
    Next i
    scores(10).value = total
End Sub

' Saves the scores when the button is clicked
Sub SaveScores
    If savedScores <> "" Then
        savedScores = savedScores + Chr$(10)
    End If
   
    savedScores = savedScores + Date$ + " " + Time$
    Dim i As Integer
    For i = 1 To 10
        savedScores = savedScores + ", " + scores(i).value
        scores(i).value = ""
    Next i
   
    ' Save the scores to the browser's local storage
    Storage.Set "savedScores", savedScores
   
    ' Save the scores to the QBJS virtual file system
    Open "scores.csv" For Output As #1
    Print #1, savedScores
    Close #1

    RefreshSavedScores
End Sub

' Refreshes the saved score display
' Using the main QB screen for testing
Sub RefreshSavedScores
    Cls
    Print "Saved Scores"
    Print "--------------------------------------------------------"
    Print savedScores
End Sub

View in QBJS

Print this item