Page 1 of 1

batch script to log into email account

Posted: 19 Apr 2009 11:25
by 9melon
Hi,
Is it possible to fill in an HTML form by simply clicking on a batch script? I want to write an batch script that allows me to simply log into a website by filling in various fields (such as username and password) as well as perform an action (log in) on the page.

Any ideas on how i can go about this?

Re: batch script to log into email account

Posted: 14 Jan 2022 06:16
by Jedininja
i have tried this before, but it is hard to target the username/password boxes
simply add the link as a line in your batch file and it will open a tab in the default browser at that page. im not sure how to log into it though.

Code: Select all

start "" "www.gmail.com"
the link must start with www. or http. or https. in order for the start command to consider it a link

Re: batch script to log into email account

Posted: 14 Jan 2022 07:42
by ShadowThief
Batch can't interact with GUIs. Use Selenium if you want to automate interacting with a web browser.

Re: batch script to log into email account

Posted: 15 Jan 2022 03:35
by Jedininja
ShadowThief wrote:
14 Jan 2022 07:42
Batch can't interact with GUIs. Use Selenium if you want to automate interacting with a web browser.
you could just set the browser to auto log in? and then start it from a batch file. perhaps adding the loggin & password to the browsers cookies?

Re: batch script to log into email account

Posted: 15 Jan 2022 05:10
by penpen
1) The OP is from 2009.
2) We don't know the browser the op is using, so we can't know whether or not that browser is capable of auto login.
3) Adding login and password to cookies never ever is a good idea.
4) Unless the website doesn't support outo login, adding login and password to a cookie have no effect;
also the website probably has no auto login, or the OP didn't want to use that feature, else he would have used that.

Re: batch script to log into email account

Posted: 17 Jan 2022 03:50
by Jedininja
penpen wrote:
15 Jan 2022 05:10
1) The OP is from 2009.
2) We don't know the browser the op is using, so we can't know whether or not that browser is capable of auto login.
3) Adding login and password to cookies never ever is a good idea.
4) Unless the website doesn't support outo login, adding login and password to a cookie have no effect;
also the website probably has no auto login, or the OP didn't want to use that feature, else he would have used that.
i went backwards through unanswered posts! lots of interesting stuff and interesting questions!

Technically nothing these people do is a good idea. now that i think of it having your browser auto log into things, and save logins and passwords and credit cards and address and so on and so forth is not a good idea but for arguments sake

Code: Select all

start "" "www.gmail.com"
is all that's really needed form a batch script if the browser itself has already been set to login automatically.

Re: batch script to log into email account

Posted: 17 Jan 2022 04:28
by Jedininja
I have an idea. since op is stuck 13 years in the past. we need to save him from the gravitational time anomaly he and/or she is most likely stuck in, and do to the severity of op's assumed problems we must deduce the variables needed to answer op's clearly imperative question.

So...
A) Op's need to open his and/or her browser is of life, limb and time travel important, But we don't know what it is and we have no way to ask. so our solution to op's problem must apply generally to browsers of the time, which leaves us at "what windows does op got 13 years ago". Windows 7! probably...

Browsers available at the time for windows 7. Opera, firefox, chrome, internet explorer. which rules out Microsoft edge. so the is in some regard to a function of windows 7 that will; 1) open default browser, 2) goto most used email providers website 3) log into email.

i have step 1) covered, Start "" "www.emailprovider.com" will open a web address on windows 7 to the default browser. but how to find the email provider.

Options:
- Bookmarks and an array of popular email providers.
- cookies and an array of popular email providers.
- recent programs and an array of popular email providers.
- an array of popular email providers registry entries.
- (add more if got more)

using the environment variable %AppData% on windows 7 will open the users account data folder. from there we need to figure out what the email provider is

Code: Select all

%appdata% = %systemdrive%\users\%username%\roaming
on windows 10

Code: Select all

C:\Users\user\AppData\Roaming\Mozilla\Firefox\Profiles\dk9e0tkt.default-release\bookmarkbackups
is where bookmarks are stored for firefox browser: which is

Code: Select all

::Paths are for windows 10 but is a place to start
If exist %systemdrive%\Users\%username%\AppData\Roaming\Mozilla\Firefox\Profiles\dk9e0tkt.default-release\bookmarkbackups 
If exist %appdata%\mozilla\firefox\dk9e0tkt.default-release\bookmarkbackups
if exist %systemdrive%\ProgramData\Microsoft\Windows\Start Menu\Programs\firefox.exe

::formautofill@mozilla.org.xpi has 31 matchs for the search term  "mail"
if exist %systemdrive%\Program Files\Mozilla Firefox\browser\features\formautofill@mozilla.org.xpi

::always there anyways
if exist %systemdrive%\%appdata%\Microsoft\Windows\Start Menu\Programs\Accessories\iexplorer.exe
if exist %systemdrive%\Program Files\Internet Explorer\iexplore.exe

%appdata%\chrome here
%appdata%\opera here
i need vmware\win7 or something --- more digging!

bump, bump, bump. :P