About WinExist

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Kevin_yeh2020
Posts: 106
Joined: 11 Apr 2020, 00:54

About WinExist

16 May 2020, 00:30

Hi,

How can I output the "TESTING" in Notepad of the VNC window ?

Code: Select all

Gui +AlwaysOnTop
Gui, Font, S10 C000000 , Tahoma
Gui, Show, x131 y91 h155 w300,Program
Gui, Font, S10 c000000 , Verdana
Gui, Add, Button, x10 y22 w100 h50,Button1

#Persistent
WinGet, a_ID, ID, A
SetTimer, aa, 500
return

aa:
WinGet, a1_ID, ID, A
If ( a_ID != a1_ID )
k_ID = %a1_ID%
Return

ButtonButton1:
  if WinExist ("New Text Document - Notepad")
  {
  WinActivate, ahk_id  %k_ID%
  SendInput TESTING{ENTER}
  }
Return

GuiClose:
ExitApp
Attachments
Untitled.jpg
Untitled.jpg (18.34 KiB) Viewed 480 times
poetbox
Posts: 112
Joined: 18 Apr 2018, 20:47

Re: About WinExist

16 May 2020, 02:13

Code: Select all

  if WinExist ("New Text Document - Notepad")
  {
  WinActivate
  SendInput TESTING{ENTER}
  }
You can write like this without "ID"
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: About WinExist

16 May 2020, 02:22

AFAIK, to push the button while VNC viewer isn't in full screen mode, means, that (probably most, if not all of the) events will only trigger locally, ignoring the remote session. Therefore your local script isn't able detect the remote Notepad session (well, except graphically), just the VNC viewers window instead. So, you have to find a way to handover your data in the most reliable way to that remote window/the remote box. I'd go the way and set up an AHK client that is sniffing for incomming commands/data on that remote box.

You can handover this data using options like a shared network drive/folder, shared ClipBoard, or things like an UDP/TCP-socket (that btw, you can use from your mobile as well!). Nevertheless, you can have a try triggering the VNC viewers window using AHKs Control set. But IMHO that means throwing a stone through an open window without being able to see its remote target.
gregster
Posts: 9000
Joined: 30 Sep 2013, 06:48

Re: About WinExist

16 May 2020, 02:44

The Space between the function name and its parameters is wrong for sure: if WinExist ("New Text Document - Notepad") --> if WinExist("New Text Document - Notepad").
Kevin_yeh2020
Posts: 106
Joined: 11 Apr 2020, 00:54

Re: About WinExist

16 May 2020, 03:01

poetbox wrote:
16 May 2020, 02:13

Code: Select all

  if WinExist ("New Text Document - Notepad")
  {
  WinActivate
  SendInput TESTING{ENTER}
  }
You can write like this without "ID"
Hi,
It can not output in VNC window.
Kevin_yeh2020
Posts: 106
Joined: 11 Apr 2020, 00:54

Re: About WinExist

16 May 2020, 03:18

Hi poetbox,
Thanks for your reply. It can not output in VNC window.

Hi BoBo,
It seems that is not possible to use AHK to export directly the VNC window? It seems to activate the VNC window but not the NOTEPAD window.

Hi gregster,
Thank you for your reminder, I tried it and it still works, but not the NOTEPAD of the VNC window. I will change my habits.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], mikeyww, zerox and 328 guests