Enter not sending messages to chat

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
labrint
Posts: 383
Joined: 14 Jun 2017, 05:06
Location: Malta

Enter not sending messages to chat

04 Apr 2022, 06:20

Code: Select all

Gui Add, ActiveX, vdoc xm w1000 h300, about:<!DOCTYPE html><meta http-equiv="X-UA-Compatible" content="IE=edge"> ; the "IE=edge" should force Shell.Explorer to use the latest IE renderer. I have internet explorer 11 and Microsoft Edge installed.
doc.silent := true ; Surpress JS Error boxes, commented out for debugging
doc.Navigate("https://stin.to/ozfc6")


Gui, Show
Return
Unlike on chrome where enter send the message, here I cannot send with enter key. Can anyone help?
User avatar
mikeyww
Posts: 27372
Joined: 09 Sep 2014, 18:38

Re: Enter not sending messages to chat

04 Apr 2022, 10:10

One workaround is a simple image search for the send button.

Code: Select all

imageDir = %A_ScriptDir%
send     = %imageDir%\sendIcon.png
edit     = %imageDir%\editIcon.png
url      = https://stin.to/ozfc6
Gui Add, ActiveX, w1000 h300 vdoc, about:<!DOCTYPE html><meta http-equiv="X-UA-Compatible" content="IE=edge">
doc.Silent := True, doc.Navigate(url)
Gui, Show,, Chat

#IfWinActive Chat ahk_class AutoHotkeyGUI ahk_exe AutoHotkey.exe
Enter::clikImage(send) && clikImage(edit, 9)
#IfWinActive

clikImage(image, xOffset := 0) {
 WinGetPos,,, width, height, A
 ImageSearch, x2, y2, 0, 0, width, height, %image%
 If !err := ErrorLevel {
  MouseGetPos, x1, y1
  MouseClick,, x2 + xOffset, y2
  MouseMove, x1, y1
 } Else SoundBeep, 1500
 Return !err
}
Attachments
editIcon.png
Edit control
editIcon.png (236 Bytes) Viewed 494 times
sendIcon.png
Send control
sendIcon.png (586 Bytes) Viewed 494 times
User avatar
tank
Posts: 3130
Joined: 28 Sep 2013, 22:15
Location: CarrolltonTX
Contact:

Re: Enter not sending messages to chat

04 Apr 2022, 10:39

have a look at this

viewtopic.php?t=6020
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Telegram is the best way to reach me
https://t.me/ttnnkkrr
If you have forum suggestions please submit a
Check Out WebWriter
User avatar
labrint
Posts: 383
Joined: 14 Jun 2017, 05:06
Location: Malta

Re: Enter not sending messages to chat

04 Apr 2022, 12:26

tank wrote:
04 Apr 2022, 10:39
have a look at this

viewtopic.php?t=6020
@tank I tried to integrate your code as such:

Code: Select all

Gui Add, ActiveX, vdoc xm w1000 h300, about:<!DOCTYPE html><meta http-equiv="X-UA-Compatible" content="IE=edge"> ; the "IE=edge" should force Shell.Explorer to use the latest IE renderer. I have internet explorer 11 and Microsoft Edge installed.
doc.silent := true ; Surpress JS Error boxes, commented out for debugging
doc.Navigate("https://stin.to/ozfc6")

   ;// necesary to accept enter and accelorator keys
   ;http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.ole.interop.ioleinplaceactiveobject(VS.80).aspx
   IOleInPlaceActiveObject_Interface:="{00000117-0000-0000-C000-000000000046}"
   
   ;// necesary to accept enter and accelorator keys
   ;// get the in place interface pointer
   pipa :=   ComObjQuery(doc, IOleInPlaceActiveObject_Interface)
   
   ;// necesary to accept enter and accelorator keys
   ;// capture key messages
   OnMessage(WM_KEYDOWN:=0x0100, "WM_KEYDOWN")
   OnMessage(WM_KEYUP:=0x0101, "WM_KEYDOWN")
   
   
Gui, Show
Return



WM_KEYDOWN(wParam, lParam, nMsg, hWnd)  ;// modeled after code written by lexikos
{
   global   wb, pipa
   static   fields :=   "hWnd,nMsg,wParam,lParam,A_EventInfo,A_GuiX,A_GuiY"
   WinGetClass, ClassName, ahk_id %hWnd%
   if   (ClassName = "Internet Explorer_Server")
   {
      ;// Build MSG Structure
      VarSetCapacity(Msg, 48)
      Loop Parse, fields, `,
         NumPut(%A_LoopField%, Msg, (A_Index-1)*A_PtrSize)
      ;// Call Translate Accelerator Method
      TranslateAccelerator :=   NumGet(NumGet(1*pipa)+5*A_PtrSize)
      Loop 2 ;// only necessary for Shell.Explorer Object
         r :=   DllCall(TranslateAccelerator, "Ptr",pipa, "Ptr",&Msg)
      until   wParam != 9 || wb.document.activeElement != ""
   
      if   r = 0 ;// S_OK: the message was translated to an accelerator.
         return   0
   }
}
It didn't work though, I must have done something wrong.
User avatar
labrint
Posts: 383
Joined: 14 Jun 2017, 05:06
Location: Malta

Re: Enter not sending messages to chat

06 Apr 2022, 03:39

Please help @tank . Thank you @mikeyww I wish to avoid the image search. Its not extremely reliable across different platforms/pcs.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Lpanatt, peter_ahk and 296 guests