The problem with the accepted answer is that it will only work on the same computer (e.g. copying extension files from one Chrome Person/profile to another). When you do this onto a different PC, it won't work.
If you're like me, where you don't want to sync anything to a Google account and you can't be bothered to install the extensions manually, I wrote this script to automate that process (especially useful if you use tons of different personas in the same Chrome browser or across different machines):
Requirements:
- Have autohotkey v1.x installed (haven't tested this with v2)
- Save this
image file locally in the C:\ drive (if you put it somewhere else, you need to edit the path in this line of the code: ImageSearch, FoundX, FoundY, 0,0,1900,1070, C:\956PJ.png)
Steps:
- Save the script as a file with a .ahk extension i.e. installExt.ahk. Make sure to add/edit the extensions you want to install (or delete the ones I have listed). You declare a variable for each extension and then include it into the extensions array. Then
- Double click the .ahk file
- Open a Chrome window
- Press 'f' key
- Don't touch anything and wait
- Right click > Exit the green H icon in the taskbar icons
Script:
#NoEnv
SendMode Input
SetKeyDelay, 2000, 10 ; [delay, pressduration] for Send
WinActivate, ahk_exe chrome.exe
;Extensions to install
ublock_origin:= "chrome.google.com/webstore/detail/ublock-origin/cjpalhdlnbpafiamejdnhcphjbkeiagm"
no_cookies:= "chrome.google.com/webstore/detail/i-dont-care-about-cookies/fihnjjcciajhdojfnbdddfaoknhalnja"
dark_reader:="chrome.google.com/webstore/detail/dark-reader/eimadpbcbfnmbkopoojfekhnkhdbieeh"
speed_control:="chrome.google.com/webstore/detail/video-speed-controller/nffaoalbilbmmfgbnbgppjihopabppdk"
extensions:=[ublock_origin,no_cookies,dark_reader, speed_control]
f::
Install(extensions)
Install(url){
For k,v In url{
Send, ^t %v% {enter}
Sleep, 2000
if(k=1){ ;Find it only the first time around
coor:=FindButton()
MouseClick, left, coor[1],coor[2]
}
else{ ;After the 1st time, the cursor is in the right 'add to chrome' place, so just click
Click
}
Sleep, 1000
Send, {Left} {enter}
Sleep, 2000
; MouseMove, 0,0 ;to make sure cursor over button won't make FindButton unable to find it (since it's now darkened)
}
}
;ImageSearch version (more accurate, but you need to use a png _not_ a jpg ref)
FindButton(){
CoordMode Pixel ; Interprets the coordinates below as relative to the screen rather than the active window.
ImageSearch, FoundX, FoundY, 0,0,1900,1070, C:\956PJ.png
if (ErrorLevel = 2)
MsgBox Could not conduct the search.
else if (ErrorLevel = 1)
MsgBox Icon could not be found on the screen.
else
; MsgBox The icon was found at %FoundX%x%FoundY%.
return [FoundX,FoundY]
}
;PixelSearch (less accurate since it can get caught up in another part of the page with same color, you can use this if the Google changes the Chrome extension UI)
;FindButton(){
; CoordMode, Pixel, Screen
; PixelSearch, Px, Py, 0, 250, 1920, 1000, 0x1A73E8, 0, Fast RGB
; if ErrorLevel
; MsgBox, That color was not found in the specified region.
; else
;; MsgBox, results, %Px%, %Py%
; return [Px,Py]
;}
How it works:
- Opens a new tab, pastes extension URL
- Tracks the 'Add to Chrome' button
- Clicks and installs it, and then back to step 1 with the next extension (button is not searched every loop, since the cursor stays in the same place on the 'add to' button the whole time, so just a click is needed -that's why it's important not to touch anything after you run the script-)