Chrome.ahk "Cannot read and write..." error

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Seamndel
Posts: 8
Joined: 25 Jul 2021, 03:46

Chrome.ahk "Cannot read and write..." error

Post by Seamndel » 06 Feb 2022, 06:24

Here's the code I've copied from Joe Glines - AutoHotkey Guru on YouTube:

Code: Select all

#NoEnv
#SingleInstance, force
#include, C:\Users\seamn\OneDrive\My Apps & Softwares\Chrome.ahk App Version 1.2\lib\Chrome.ahk

if !FIleExist("profile")
	FileCreateDir, % "profile"

chrome := new chrome("profile", "https://www.the-automator.com/autohotkey/chrome-with-autohotkey/")
page := chrome.getpage()

page.WaitForLoad("complete")
page.Evaluate("document.querySelectorAll('#post-4101 > div > p:nth-child(4) > a:nth-child(4)')[0].click()")
return
These are the error massages I get:
image.png
image.png (103.81 KiB) Viewed 536 times
image.png
image.png (29.49 KiB) Viewed 536 times
image.png
image.png (20.17 KiB) Viewed 536 times
Worth mentioning that the script DOES end up launching the correct window ONLY AFTER I click "OK" on the error in the third image.

If I run the script a second time immediately afterwards it even continues on to the correct page (the programmer's PayPal page).Regardless the "Cannot read and write..." error appears EVERYTIME I run the script, while the others don't.

Also, I've added the " --remote-debugging-port=9222" to chrome.exe in the properties tab, closed all instances of chrome and relaunched it.
geek
Posts: 1055
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

Re: Chrome.ahk "Cannot read and write..." error

Post by geek » 06 Feb 2022, 20:55

I'd imagine Chrome isn't very happy about using a profile folder contained within OneDrive. Try running the script outside of OneDrive, or having it create and use a profile folder outside of OneDrive.
Post Reply

Return to “Ask for Help (v1)”