Hack Forums
[Shell] login chrome browser using script? - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Shell] login chrome browser using script? (/showthread.php?tid=5701026)



login chrome browser using script? - megajonern - Aug 22, 2017

I use the school computers on a daily basis, but every time I use the computers, I have to login to all the websites again, including the chrome browser...
I know it only takes a minute or two, but it is quite annoying to do this every time you've been logged off the computer...
I've been using a script that opens all the necessary websites and the schools login site, but how can log in to the chrome browser with the same manner?

Code
@if (@CodeSection == @Batch) @then

@echo off
set SendKeys=CScript //nologo //E:JScript "%~F0"

rem open main login for school
start chrome "innsida ntnu no"
timeout /t 5

rem write username and password into the login
%SendKeys% "username"
%SendKeys% "{TAB}"
%SendKeys% "password"
%SendKeys% "{ENTER}"

rem open BlackBoard & other websites
start chrome "innsida ntnu no/blackboard"
start chrome "www youtube com/watch?v=xv01ZdrnJZI&list=RDxv01ZdrnJZI#"
start chrome "www symbolab com/solver"
start chrome "www falstad com/circuit/"
goto :EOF

@end
// JScript section

var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.SendKeys(WScript.Arguments(0));

I've used a hybrid VBScript-batch file that I found here:
stackoverflow com/questions/42188600/sending-keyboard-input-with-batch-commands

thanks for any help in advance! 🙂

NOTE: cannot posts links


* - RainbowDynamix - Aug 23, 2017

Hey there!

Your script looks okay. I'm not sure what the problem is, but I tested one on facebook.

NOTE: Rather than doing
Code
%SendKeys% "username"
%SendKeys% "{TAB}"
%SendKeys% "password"
%SendKeys% "{ENTER}"

You can do...
Code
%SendKeys% "username{TAB}"
%SendKeys% "password{ENTER}"

Anyways, here's my script...
Code
@if (@CodeSection == @Batch) @then

@echo off
set SendKeys=CScript //nologo //E:JScript "%~F0"

:: Start website
start chrome "<schoolwebsite>"
timeout /t 5

:: Send login info
:: NOTE: You musts use "{TAB}" to navigate to the username and password fields on the desired site...
%SendKeys% "username{TAB}"
%SendKeys% "password{ENTER}"

goto :EOF

@end
// JScript section

var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.SendKeys(WScript.Arguments(0));

There you go! This should do it... 🙂

~Rainbow :3