script Lclicking when it should Mclick Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
HeXaDeCiMaToR
Posts: 155
Joined: 08 Feb 2021, 12:42

script Lclicking when it should Mclick

21 Apr 2021, 14:16

This SHOULD be middle clicking all links with "pdf" in it. It works... for the most part, but the first run through the loop it's opening the doc in a New WINDOW when it should be opening it up in a New TAB.

Any thoughts?

Code: Select all

#SingleInstance, Force
#NoEnv
#Include C:\Users\tdidr\Desktop\Scripts\Chrome.ahk_v1.2\Chrome.ahk

!rbutton::
page := Chrome.GetPage()

Loop, 10
{
num := A_Index-1
PDFS = document.querySelectorAll("a[href*='pdf']")[%num%].dispatchEvent(new MouseEvent( "click", { "button":1, "which":2}))
try
{
	page.Evaluate(PDFS)
	sleep 100
}
catch e
{
	return
}
}
return
HeXaDeCiMaToR
Posts: 155
Joined: 08 Feb 2021, 12:42

Re: script Lclicking when it should Mclick  Topic is solved

22 Apr 2021, 23:39

Code: Select all

#SingleInstance, Force
#NoEnv
#Include C:\Users\tdidr\Desktop\Scripts\Chrome.ahk_v1.2\Chrome.ahk

!rbutton::
page := Chrome.GetPage()

Loop, 10
{
PDFS = document.querySelectorAll("a[href*='Attachments']")[%A_Index%].href

try
{
	url_%A_Index% := page.Evaluate(PDFS).value
	sleep 100
}
catch e
{

}
}

Loop, 10
{
	if (url_%A_Index% = "")
	{
	}
	else
	{
	page.Call("Target.createTarget", {url : url_%A_Index%})
	}
}

return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: aitaixy, Joey5 and 239 guests