The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 895 - File: showthread.php PHP 7.2.34 (Linux)
File Line Function
/showthread.php 895 errorHandler->error




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Function: Do something when Telegram message arrives
#1
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).

 
Code:
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
else
,goto notopened

;notopened
if(scan("image:h7184D45F" w2 0 1|4|16|0x1100 25))
,lef
,wait 0.2
,goto topened
,opened=1
;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
else
,opened=0
,act w
,ret "no action needed"
;remotescreenshot
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
,lef
,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
,,lef
,,ret "Screenshot sent!"
;error
ret "TM not found!"
[/code]


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
Greetings

Remotehorst


Messages In This Thread
Function: Do something when Telegram message arrives - by Remotehorst23 - 07-17-2020, 03:40 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)