1.

Solve : Batch to Open Email, Read, Then show result.?

Answer»

Hello!

I want a batch file to open (url here), read how many UNREAD messages there are, then echo BACK on how many there are, if any.

I know it's

Code: [Select]Start (url)
But I don't know the rest.

Thanks, BR
You're going to be SOL on this one .it's impossible in pure cmd batch.
Oke Doke. Thanks.Quote from: Reno on March 11, 2009, 10:57:29 PM

it's impossible in pure cmd batch.


Not if you download a free Pop3 client such as Getmail or PopClient.
I wouldn't do that. I would use Auto-It. It's a programming language that can do key STROKES. Click on things for you. Create macros and such. It's a very cool language. yeah, but that involves third-party application.

i am not saying it's impossible in any means, but with just the available cmd prompt environment, it's just not possible.
i think this can be DONE by wrapping a vbs code inside batch (depends on the complexity of the website).if the Email works via MS outlook, then you could try to use the CDO (Collaboration Data Objects) to connect and enumerate the emails.

I've never used CDO though; never had the need.Quote from: BatchRocks on March 11, 2009, 04:34:20 PM
Hello!

I want a batch file to open (url here), read how many UNREAD messages there are, then echo back on how many there are, if any.

I know it's

Code: [Select]Start (url)
But I don't know the rest.

Thanks, BR

what kind of email? a web mail like gmail /hotmail??
He uses Gmail. I know that.@OP, you can't really do that using just your cmd.exe. There are gmail APIS for languages such as PHP, Python, Perl, Java, etc. Please do some research on that using google. Alternatively, you can try setting your POP (or IMAP) options in Gmail, then using programming language (or ready POP client tools) with POP libraries to communicate with your POP inbox.

Here's how i once did what you wanted (roughly) using Python and its IMAP library
Code: [Select]#!/usr/bin/python

import imaplib,sys
try:
M = imaplib.IMAP4_SSL("gmail-pop.l.google.com")
M.login("gmail_username", "password")
typ , data = M.select('INBOX')
PRINT data[0]
for num in data[0].split():
typ, data = M.fetch(num, '(RFC822)')
print 'Message %s\n%s\n' % (num, data[0][1])
except Exception,e:
print e
else:
M.close()
M.logout()

there is still vbs to get this kind of job done, which apparently wscript is already installed in windows-based pc:

This is still prototype...
Code: [Select]set ie = wsh.createobject("internetexplorer.application")
with ie
.visible=true
.navigate2 "http://mail.google.com/"
while .readystate<4:wsh.sleep 100:wend
On Error Resume Next
.document.forms(0).all("Email").value = "username here"
if err.number = 0 Then
err.clear
.document.forms(0).all("Passwd").value = "password here"
.document.forms(0).submit
while .readystate=4:wsh.sleep 100:wend
while .readystate<4:wsh.sleep 100:wend
end if
wsh.sleep 1000:wsh.echo .document.title
wsh.echo "Unread Mail: " & split(split(.document.title,"(")(1),")")(0)
end with
set ie=nothing
Thanks guys, but It is Gmail, like BFC said, and, I really just needed batch.

Thanks anyways.hey, batchrocks, if wrapping the code inside batch will count as batch to you??

it's really simple to do it, using cscript as the engine and batch to parse the string. internet explorer window can also be set to run at background.Python is really simple, and instructive too.


Discussion

No Comment Found