gregster wrote: ↑31 May 2019, 11:45
Seems to work here..
That is the part that worries me haha! I am not sure what's up with my setup that is preventing it from working.
gregster wrote: ↑31 May 2019, 11:45
...although I don't see the point of the timers
I'm just using them as an easy way to exit the script when I close chrome.
gregster wrote: ↑31 May 2019, 11:45
...Also, Chrome responds to the use of the command line flag "--disable-web-security" with the message that it is not supported here and that this could negatively affect browser stability and security. But the javascript and the tooltip work anyway.
I added that flag because I'll be injecting some JavaScript later.
gregster wrote: ↑31 May 2019, 11:45
...But a Chrome instance with a google.com page is opening for you?
Yes indeed. The google opens but it is not instantized.
gregster wrote: ↑31 May 2019, 11:45
What about opening the Chrome browser first with a blank page, then
getting this blank page and navigating it to google.com ?
(this is my preferred way of doing it; you can still create more tabs later)
Here is my updated coded adding in that suggestion:
Code: Select all
#Persistent
#SingleInstance, force
#NoEnv
SetBatchLines, -1
SetTitleMatchMode, 2
SetWorkingDir, %A_ScriptDir%
#Include Chrome.ahk
;-----------CREATE CHROME OBJECT--------------------
createChromeObj:
SetTimer, createChromeObj, off
FileCreateDir, ChromeProfile
ChromeInst := new Chrome("ChromeProfile",," --remote-debugging-port=9222 --disable-web-security")
if !(ChromeInst){
msgbox, chrome is not an object
}
while !(PageInst := ChromeInst.GetPage())
{
tooltip, could not retrieve page!
Sleep 1000
}
tooltip, connected to page!
PageInst.WaitForLoad()
;----------EXECUTE JAVASCRIPT--------
PageInst.Evaluate("alert('Hello World!');")
Return
This still does not work for me. Any other suggestions? I really appreciate the help!