bot-a-bing. A screen reading chat bot for QB64 IRC.

by Pete (Login The-Universe)
Admin

 
This is a simple screen reading chat bot. A real one would either be a Javascript or in QB64, it could be done using _OPENCLIENT and writing a function. I haven't worked with that in a loooooong time, so i threw this together in 30 min of chat. I woud have stayed longer, but apparently debugging an annoying little bot in chat is something that is frowned on! :D

REM Bot-a-Bing
' Open to irc chat manually and log in.
bing1$ = https://www.bing.com/search?q="
bing2$ = "&pc=MOZI&form=MOZTSB"
_SCREENMOVE 850, 0
_DELAY 1.25
DO
    _SCREENCLICK 200, 500
    _DELAY .25
    _SCREENPRINT CHR$(1)
    _DELAY .1
    _SCREENPRINT CHR$(3)
    a1$ = _CLIPBOARD$
    OPEN "tmp.tmp" FOR OUTPUT AS #1
    PRINT #1, a1$
    CLOSE #1
    x$ = "": newx$ = ""
    OPEN "tmp.tmp" FOR INPUT AS #1
    DO UNTIL EOF(1)
        x$ = a$
        LINE INPUT #1, a$
        IF INSTR(a$, ":") AND INSTR(a$, "M") THEN
            IF LTRIM$(x$) <> "" AND INSTR(x$, "bot-a-bing") = 0 AND INSTR(x$, "http") = 0 AND MID$(x$, 1, 1) <> "?" THEN
                newx$ = x$
            END IF
        END IF
        IF INSTR(a$, " Users") THEN EXIT DO
    LOOP
    CLOSE #1
    IF oldx$ <> newx$ THEN
        oldx$ = newx$
        x$ = newx$
        DO UNTIL INSTR(x$, "  ") = 0
            x$ = MID$(x$, 1, INSTR(x$, "  ") - 1) + MID$(x$, INSTR(x$, "  ") + 1)
        LOOP
        FOR i = 1 TO LEN(x$)
            IF MID$(x$, i, 1) = " " THEN
                MID$(x$, i, 1) = "+"
            END IF
        NEXT
        botabing$ = bing1$ + x$ + bing2$
        PRINT botabing$
        GOTO 200
        _SCREENCLICK 250, 770
        _DELAY .2
        _SCREENPRINT botabing$
        _DELAY .75
        _SCREENCLICK 250, 770
        _SCREENPRINT CHR$(13)
        _DELAY .5
        _SCREENPRINT "bot-a-boom-bot-a-bing!"
        _DELAY .2
        _SCREENPRINT CHR$(13)
        200
    ELSE
        _SCREENCLICK 250, 770
        _DELAY .2
    END IF
    SLEEP 30
    IF INKEY$ = CHR$(27) THEN END
LOOP

--------------------------------------------------------

It simply reads the last post and makes it into a Bing Mozilla search hyperlink.

To try it would be a pain, because screen sizes are different, so _SCREENPRINT and _SCREENCLICK positions would probably need to be changed to fit other people's desktop and browser configurations. It only single clicks, btw, but if you have single click substitute for the traditional double click in your operating system, I'd be very careful before trying it out. I'd recommend opening something full screen in the background, like Notepad, just to shield any exposed areas of the desktop.

Pete happy.gif

Posted on Feb 25, 2018, 11:30 AM

Respond to this message   

Return to Index

 Copyright © 1999-2018 Network54. All rights reserved.   Terms of Use   Privacy Statement  

Quantcast