Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Function: Do something when Telegram message arrives
Hey QM Fans!

I hope someone can help me. I built a macro for my PC and I want to have a remote control in my Private Telegram Channel to play a game while not at home.

Actually I try to scan the Window in Telegram for specific commands. It already worked, but now it won't anymore.

My Macro to control the game works fine but the function (to retrieve commands) i made always puts the Telegram Window in focus even when no new commands arrived.

The function scans the screen for the correct Channel, clicks on it and searches for a command on the bottom of the chat window. This last part doesn't work anymore and i don't know why.

If someone can help me (or even has a better way to do it) i would be really happy!

I also could need some help how to get the Telegram command out of the function into the macro. Actually i only can create screenshots (command inside the function).

Copy      Help
Function [b]Telebot[/b] [help1][/help1]
[code]int w=win("Telegram" "Qt5QWindowIcon")
act w
wait 0.1
RECT Channel;
SetRect &Channel 8 8 340 970
int w2=win("Telegram" "Qt5QWindowIcon")
int opened;
if opened=1
,goto topened
,goto notopened

if(scan("image:h7184D45F" w2 0 1|4|16|0x1100 25))
,wait 0.2
,goto topened
wait 0.2
RECT TmScan;
SetRect &TmScan 0 850 940 940
int w3=win("Telegram" "Qt5QWindowIcon")
if(scan("image:remoteSCR" w3 TmScan 1|4|16 50))
,goto remotescreenshot
,act w
,ret "no action needed"
int w1=win("Game" "Chrome_WidgetWin_1")
act w1
wait 0.2
key A(44)       ;; ALT+PRTSCR
wait 0.1
if(scan("resource:BroadcastTmsg.bmp" 0 0 1|16 20))
,wait 0.1
,key Cv          ;; STRG+V
,wait 0.1
,key Y           ;; ENTER
,wait 0.1
,if(scan("resource:TmSend.bmp" 0 0 1|16 30))
,,wait 0.1
,,ret "Screenshot sent!"
ret "TM not found!"

Ps: As you maybe can see, im a coding noob. It would be great if you can explain if you send me code snippets!

Thanks very much in advance! Blush


Forum Jump:

Users browsing this thread: 1 Guest(s)