I want to set the shortcut key for "translate this page" of Google translation plugin. How do I do it?
I used the ControlClick command to click on the corresponding coordinates for "translate this page", but it failed. How to resolve it?
I want to set the shortcut key for "translate this page" of Google translation plugin. How do I do it?
-
- Posts: 188
- Joined: 17 Jan 2019, 10:13
Re: I want to set the shortcut key for "translate this page" of Google translation plugin. How do I do it?
Hi there,
You can use ImageSearch
Hope this helps!
You can use ImageSearch
Code: Select all
^t::
FilePath:="C:\Path.png"
loop
ImageSearch, FoundX, FoundY, 0, 0, A_Screenwidth, A_Screenheight, %FilePath%
Until !ErrorLevel
MouseClick,, FoundX, FoundY
return
Re: I want to set the shortcut key for "translate this page" of Google translation plugin. How do I do it?
I can't test it now on the MAC. This method requires saving an image. It's not very rational.AviationGuy wrote: ↑14 May 2019, 02:39Hi there,
You can use ImageSearchHope this helps!Code: Select all
^t:: FilePath:="C:\Path.png" loop ImageSearch, FoundX, FoundY, 0, 0, A_Screenwidth, A_Screenheight, %FilePath% Until !ErrorLevel MouseClick,, FoundX, FoundY return
In addition, How can I use AutoHotKey on my MAC?
Re: I want to set the shortcut key for "translate this page" of Google translation plugin. How do I do it?
The popup window of the Chrome extension is a different window than the main window of Chrome, their hwnds are different. So if you're using ControlClick but not aware of this fact you probably did it wrong.
Example 1:
Example 2:
Using acc.ahk to click the "Google Translate" extension icon.
Example 1:
Code: Select all
F9::TranslateThisPage()
TranslateThisPage() {
if !WinExist("ahk_class Chrome_WidgetWin_1")
throw "chrome not found!"
WinGetTitle, ExcludeTitle ; Omit WindowTitle makes AHK to use the last found window, this can also improve performance.
ControlClick, x1757 y59,,,,, NA ; Click "Google Translate" extension icon
; Wait another Chrome_WidgetWin_1 window with a different title (The extension window has no title)
WinWait, % "ahk_class Chrome_WidgetWin_1",,, % ExcludeTitle
ControlClick, x65 y75 ; Click "Translate This Page"
}
Using acc.ahk to click the "Google Translate" extension icon.
Spoiler
Last edited by tmplinshi on 14 May 2019, 16:44, edited 10 times in total.
Who is online
Users browsing this forum: Google [Bot], mesutakcan, mexican scientist, mikeyww and 131 guests