why is my repeat text script not working?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
teacrumpets
Posts: 2
Joined: 10 Aug 2022, 00:53

why is my repeat text script not working?

Post by teacrumpets » 10 Aug 2022, 01:11

hey i dont think i understand the format of these scripts. heres what i tried to do

Code: Select all

WinGetActiveTitle, Window_name
Window_name := "Telegram Web"

 WinActivate, Window_name 			
 ;
#Persistent
SetTimer, Repeat, 720000


 Send {Text}Test

Send, {Enter}
[Mod edit: [code][/code] tags added.]

Rohwedder
Posts: 7628
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: why is my repeat text script not working?

Post by Rohwedder » 10 Aug 2022, 02:16

Hallo,
why don't you try running it?
Error: Target label does not exist.

Line#
001: WinGetTitle,Window_name,A
002: Window_name := "Telegram Web"
003: WinActivate,Window_name
---> 006: SetTimer,Repeat,720000
007: Send,{Text}Test
008: Send,{Enter}
009: Exit
010: Exit
010: Exit

Repeat: missing!
Perhaps:

Code: Select all

#Persistent
WinGetActiveTitle, Window_name
Window_name := "Telegram Web"
SetTimer, Repeat, 720000

Repeat:
WinActivate, %Window_name%
Send {Text}Test
Send, {Enter}
Return

teacrumpets
Posts: 2
Joined: 10 Aug 2022, 00:53

Re: why is my repeat text script not working?

Post by teacrumpets » 12 Aug 2022, 03:21

Hey Rohwedder thanks for your help.

it seems to send messages now, but does not seem to register the specific application. it sends messages to whatever's active.

I'm hoping to be able to send messages to my chat groups to remind us of things, but also hope to use the computer at the same time.

BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: why is my repeat text script not working?

Post by BoBo » 12 Aug 2022, 05:42

a) get the PID of that window
b) use ControlSend with that PID to send the text - even it's in the background (without activating/getting that window on focus).

Post Reply

Return to “Ask for Help (v1)”