Jump to content

Recommended Posts

Posted

Morning,

 

I have recently discovered AutoIT following a need to create a script which acts as a panic button type of thing. However, how does the 'Window Info' tool work exactly? There are one or two aspects which will require the mouse pointer to select a certain button on the screen in a certain location. This is not to send bulk emails or text for marketing etc.

 

Any help would be very welcome!

 

 

The idea being,

 

The compiled script executable is clicked

IE then opens

The URL for a webmail provider (Gmail, Hotmail etc) is entered

The credentials are then entered to log in

Compose new email is selected

Pre-defined - Message recipitents are entered

Pre-defined -Message subject entered

Pre-defined - Message body entered

and then click send

 

Following this,

 

Another IE window is opened

The URL is entered for a free txt messaging website (Such as 02)

Credentials are entered

Send new text selected

Pre-defined - Message recipitents are entered

Pre-defined -Message subject entered

Pre-defined - Message body entered

and then click send

Alarm raised

Guest TheLibrarian
Posted

That's a lot of fuss to send a panic e-mail, doesn't your school have an e-mail server?

 

If so you would probably be better sending the e-mail through that, of course if you don't...

 

As for the Window Info tool, I'm not entirely sure that will help much when you are pointing it at IE. IIRC the tool is used when you need information about a window to help you code the script in regards to which window to activate / work on.

Guest TheLibrarian
Posted

We have a system specifically designed for reporting bullying etc. issues. Funding was provided by West Midlands Police although I think it was only a couple of hundred pounds for the year.

 

It's called the Sharp system The SHARP System | School Help Advice Reporting Page.

 

We have had some genuine reports through this and as such it's worth every penny.

Posted
We have a system specifically designed for reporting bullying etc. issues. Funding was provided by West Midlands Police although I think it was only a couple of hundred pounds for the year.

 

It's called the Sharp system The SHARP System | School Help Advice Reporting Page.

 

We have had some genuine reports through this and as such it's worth every penny.

 

Thanks for the reply, to be honest, this isn't for work use, I had a family situation a while back and wanted to implement something to reduce the time it takes for someone to respond, otherwise, the email server would be spot on or going down the line of procuring some third party solution such as the Sharp System as you suggested.

 

I'm simply wanting something which sends an email/text alert at the click of a button. The idea being this can complement any other system, such as a phone to dial the 999 service and not replace anything.

Guest TheLibrarian
Posted
In which case I'd suggest trying AutoIT on Outlook Express, you will likely find that much easier.
Posted
The compiled script executable is clicked

IE then opens

The URL for a webmail provider (Gmail, Hotmail etc) is entered

The credentials are then entered to log in

Compose new email is selected

Pre-defined - Message recipients are entered

Pre-defined -Message subject entered

Pre-defined - Message body entered

and then click send

Personally I would avoid doing this, especially when better alternatives exist - there are far too many things that could go wrong with a script which clicks buttons. What if the webpage times out, the way you login to the webmail system changes or an update to your web browser (or an add-on) causes a dialog box to popup which you are not expecting?

 

A better alternative would be to use a command-line mailer or a script which sends the e-mail programmatically via an SMTP server which you can authenticate against. The VBScript below is just one method you could use. This is a working example for GMail.

 

SendE-mailViaGmail.vbs

Const schema   = "http://schemas.microsoft.com/cdo/configuration/"
Const cdoBasic = 1
Const cdoSendUsingPort = 2
Dim oMsg, oConf

' E-mail Properties
Set oMsg      = CreateObject("CDO.Message")
oMsg.From     = "[email protected]"         ' or "Sender Name "
oMsg.To       = "[email protected]"           ' or "Recipient Name "
oMsg.Subject  = "Subject goes here"
oMsg.TextBody = "Body text"

' GMail SMTP server configuration and authentication info
Set oConf = oMsg.Configuration
oConf.Fields(schema & "smtpserver")       = "smtp.gmail.com"
oConf.Fields(schema & "smtpserverport")   = 465
oConf.Fields(schema & "sendusing")        = cdoSendUsingPort
oConf.Fields(schema & "smtpauthenticate") = cdoBasic
oConf.Fields(schema & "smtpusessl")       = True
oConf.Fields(schema & "sendusername")     = "[email protected]"
oConf.Fields(schema & "sendpassword")     = "senders_password"
oConf.Fields.Update

oMsg.Send

  • Thanks 2
Posted
Personally I would avoid doing this, especially when better alternatives exist - there are far too many things that could go wrong with a script which clicks buttons. What if the webpage times out, the way you login to the webmail system changes or an update to your web browser (or an add-on) causes a dialog box to popup which you are not expecting?

 

A better alternative would be to use a command-line mailer or a script which sends the e-mail programmatically via an SMTP server which you can authenticate against. The VBScript below is just one method you could use. This is a working example for GMail.

 

SendE-mailViaGmail.vbs

Const schema   = "http://schemas.microsoft.com/cdo/configuration/"
Const cdoBasic = 1
Const cdoSendUsingPort = 2
Dim oMsg, oConf

' E-mail Properties
Set oMsg      = CreateObject("CDO.Message")
oMsg.From     = "[email protected]"         ' or "Sender Name "
oMsg.To       = "[email protected]"           ' or "Recipient Name "
oMsg.Subject  = "Subject goes here"
oMsg.TextBody = "Body text"

' GMail SMTP server configuration and authentication info
Set oConf = oMsg.Configuration
oConf.Fields(schema & "smtpserver")       = "smtp.gmail.com"
oConf.Fields(schema & "smtpserverport")   = 465
oConf.Fields(schema & "sendusing")        = cdoSendUsingPort
oConf.Fields(schema & "smtpauthenticate") = cdoBasic
oConf.Fields(schema & "smtpusessl")       = True
oConf.Fields(schema & "sendusername")     = "[email protected]"
oConf.Fields(schema & "sendpassword")     = "senders_password"
oConf.Fields.Update

oMsg.Send

 

Thank you, much appreciated. I totally understand where your coming from with regards to unknown entities around updates and page changes etc. That was a major concern of mine also, however, at the same time, I just wanted 'a solution' to solve a problem close to hand.

 

I've just given that a try and it worked a teat. Very impressed!

 

You don't happen to know of a solution to send SMS text messages online do you? :-)

Posted
You don't happen to know of a solution to send SMS text messages online do you? :-)

JamesB's suggestion of an e-mail to SMS gateway is a good one. I am not sure how accurate it is but there is a list of e-mail addresses you can use for this purpose for each of the main mobile networks in the UK here.

 

I currently use FastMail's e-mail to SMS service whenever I am unable to use my mobile phone, mainly because I have had an account with them for years, it is dead easy to use and more importantly, cheap. It costs $4.95 (£3.09) per year for a basic "Ad Free" account which enables you to use thier SMTP servers for sending e-mails, plus $0.12 (7p) per text message. To send a text message, you would create an e-mail in the usual way (or via a script), write your message in either the subject or body and then send it to a special e-mail address: [email protected] (the bit before the @ symbol being the recipients mobile phone number in international format) and that's all there is to it. The text message will be received by the other person seconds later. :)

 

Another IE window is opened

The URL is entered for a free txt messaging website (Such as 02)

Credentials are entered

Send new text selected

Pre-defined - Message recipitents are entered

Pre-defined -Message subject entered

Pre-defined - Message body entered

and then click send

Alarm raised

Rather than use the MouseMove, MouseClick & Send (or ControlClick & ControlSend) functions in AutoIt, you should find the various UDFs for Internet Explorer to be more reliable (details on these can be found in AutoIt's help file).

 

Here's a script I created earlier which uses some of these functions to log into the Orange website and send a text message. To find the correct form values and names, I used the Web Developer extension (for Chrome or Firefox) and selected the "Display Form Details" option under Forms. I found this was a lot easier compared to searching through the source code of the webpage in question. Whoever did Orange's website has obviously never learnt about using CSS for layout. ;)

 

#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Description=Send a text message via Orange's website
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_SaveSource=y
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#AutoIt3Wrapper_Run_After=upx.exe --best --compress-resources=0 "%out%"
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include 
$oIE = _IECreate ("http://www.orange.co.uk/redirect/redirect=ext&linkfrom=hp4&link=dashboard_pos_3_link_1&article=todaypage09dashboardsendafreetext&destdomain=orange&linkto=https://services.orange.co.uk/sms/send", 0, 1, 1, 1) ; You could also use a short URL: http://goo.gl/EKuB

; LOGIN OR REGISTER
$oForm = _IEFormGetObjByName($oIE, "registrationForm")
$oLogin = _IEFormElementGetObjByName($oForm, "txtMSISDN")
_IEFormElementSetValue($oLogin, "07973123999") ; Your Orange mobile number
$oLogin = _IEFormElementGetObjByName($oForm, "txtPassword")
_IEFormElementSetValue($oLogin, "Pa$$W0rd") ; Your password

; Click "Continue" button. If the button wasn't an image, you would use: _IEFormSubmit($oForm)
_IEFormImageClick ($oIE, "continue", "name", "", 1)

; SEND A TEXT MESSAGE
$oTextForm = _IEFormGetObjByName($oIE, "smsform")
_IEFormElementRadioSelect($oTextForm, "1", "sms_from_rad") ; 0 = Send from website / 1 = Send as if from your phone

$oNumber = _IEFormElementGetObjByName($oTextForm, "sendSmsMessageToNumber")
_IEFormElementSetValue($oNumber, "07973100150") ; Recipients number
$oMessage = _IEFormElementGetObjByName($oTextForm, "sendSmsMessage")
_IEFormElementSetValue($oMessage, "Hello!")     ; Message

; Click "Send" button
_IEFormImageClick ($oIE, "Send the message", "name", "", 1)

; Click "Send" button again to confirm
_IEFormImageClick ($oIE, "request2", "name", "", 1)

  • Thanks 1
Posted

Thank you Arthur, I'll check out the AutoIT code. I am currently using the VB script as mentioned earlier to cover the user for the time being. I would just like to build upon this to keep as many angles covered as possible. Everyone's input has been much appreciated.

 

The SMS gateway's are a great idea, I have looked into these, however, one of the main mobile networks which I need it to work with is Vodafone, however Vodafone kindly closed their SMS gateway when they got rid of Vodafone.net mail in late 2009. However. FastMail certainly sounds like a more viable option.

 

Cheers, AC

Posted
Personally I would avoid doing this, especially when better alternatives exist - there are far too many things that could go wrong with a script which clicks buttons. What if the webpage times out, the way you login to the webmail system changes or an update to your web browser (or an add-on) causes a dialog box to popup which you are not expecting?

 

A better alternative would be to use a command-line mailer or a script which sends the e-mail programmatically via an SMTP server which you can authenticate against. The VBScript below is just one method you could use. This is a working example for GMail.

 

SendE-mailViaGmail.vbs

Const schema   = "http://schemas.microsoft.com/cdo/configuration/"
Const cdoBasic = 1
Const cdoSendUsingPort = 2
Dim oMsg, oConf

' E-mail Properties
Set oMsg      = CreateObject("CDO.Message")
oMsg.From     = "[email protected]"         ' or "Sender Name "
oMsg.To       = "[email protected]"           ' or "Recipient Name "
oMsg.Subject  = "Subject goes here"
oMsg.TextBody = "Body text"

' GMail SMTP server configuration and authentication info
Set oConf = oMsg.Configuration
oConf.Fields(schema & "smtpserver")       = "smtp.gmail.com"
oConf.Fields(schema & "smtpserverport")   = 465
oConf.Fields(schema & "sendusing")        = cdoSendUsingPort
oConf.Fields(schema & "smtpauthenticate") = cdoBasic
oConf.Fields(schema & "smtpusessl")       = True
oConf.Fields(schema & "sendusername")     = "[email protected]"
oConf.Fields(schema & "sendpassword")     = "senders_password"
oConf.Fields.Update

oMsg.Send

 

That is great just what I am looking for. Been wanting to have a report this computer icon for a while.

 

Russ

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



  • 43 When would you like EduGeek EDIT 2025 to be held?

    1. 1. Select a time period you can attend


      • I can make it in June\July
      • I can make it in August\Sept
      • Other time period. Comment below
      • Either time

×
×
  • Create New...