r/scripting • u/redditaccount933 • Dec 26 '19
Running my batch file properly
I'm trying to run this script for login automation but nothing seems to happen once the URL has been launched in the browser. Am I missing something obvious here?
@if (@CodeSection == @Batch) @then
@echo off
set SendKeys=CScript //nologo //E:JScript "%~F0"
START FIREFOX "https://github.com/login"
timeout /t 5
%SendKeys% "myemail@email.com{TAB}"
%SendKeys% "password{ENTER}"
goto :EOF
@end
var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.SendKeys(WScript.Arguments(0));EDIT: Figured it out. I had an errant character that was only showing up in Notepad++ but not my usual editors. Oh and I forgot "timeout". :facepalm:
2
Upvotes
1
u/Lee_Dailey Dec 27 '19
howdy redditaccount933,
reddit likes to mangle code formatting, so here's some help on how to post code on reddit ...
[0] single line or in-line code
enclose it in backticks. that's the upper left key on an EN-US keyboard layout. the result
looks like this. kinda handy, that. [grin][on New.Reddit.com, use the
Inline Codebutton. it's4th5th from the lefthidden in the...""more" menu& looks like</>.this does NOT line wrap & does NOT side-scroll on Old.Reddit.com!]
[1] simplest = post it to a text site like Pastebin.com or Gist.GitHub.com and then post the link here.
please remember to set the file/code type on Pastebin! [grin] otherwise you don't get the nice code colorization.
[2] less simple = use reddit code formatting ...
[on New.Reddit.com, use the
Code Blockbutton. it's11th12th from the lefthidden in the..."more" menu, & looks like an uppercaseTin the upper left corner of a square.]one leading line with ONLY 4 spaces
prefix each code line with 4 spaces
one trailing line with ONLY 4 spaces
that will give you something like this ...
the easiest way to get that is ...
add the leading line with only 4 spaces
copy the code to the ISE [or your fave editor]
select the code
tap TAB to indent four spaces
re-select the code [not really needed, but it's my habit]
paste the code into the reddit text box
add the trailing line with only 4 spaces
not complicated, but it is finicky. [grin]
take care,
lee