For one of my projects, I had to manually open the browser and resize it to the
9:16 aspect ratio. Doing this task manually and hitting those
9:16 aspect ratio numbers was time-consuming and prone to errors. Trust me it was also boring to resize the window. Another challenge was to position the browser every time perfectly at the same position on the screen.
I thought to automate the steps by automatically opening the Chrome browser from the command line and resize it by passing arguments to the startup command line
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome". Make sure you put command inn double quotes as the path is having spaces.
--window-position=100,100as an argument. This will position the Chrome browser at
100 pixelsfrom the left and
100 pixelsfrom the top
sh automation.shand wait for the magic to happen
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --window-size=502,984 --window-position=100,100
You might also want to get rid of notification “Google API Keys are missing…“. To disable notification add below environment variables just above the command to launch Chrome
export GOOGLE_API_KEY="no" export GOOGLE_DEFAULT_CLIENT_ID="no" export GOOGLE_DEFAULT_CLIENT_SECRET="no"
export GOOGLE_API_KEY="no" export GOOGLE_DEFAULT_CLIENT_ID="no" export GOOGLE_DEFAULT_CLIENT_SECRET="no" "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --window-size=502,984 --window-position=100,100