AllSystemGo Posted September 29, 2006 Share Posted September 29, 2006 (edited) Please bare with me on this. It's my first script and I'm open to constructives commentaries.. I'm posting it here so that I can get feed back from you guys to help me get better at this. The main purpose of the script is to modify some stuff on a webpage then send me a mail via relay cause on that server I don't have any Mail Server. So just let me know what you think of it and if there is any way I can optimize it. expandcollapse popup#include <IE.au3> Global $Paused $Initialization = "helo" $MAILFROM = "MAIL FROM: support.ti@ville.terrebonne.qc.ca" $SENDTO = "RCPT TO: support.ti@ville.terrebonne.qc.ca" $STARTBODY = "data" $SUBJECT = "subject: Point de Chute" $MESSAGE = "Hunt group modification has been made with success" HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") HttpSetProxy(1) AutoItSetOption("WinTitleMatchMode", 2) $sUrl = "http://10.128.0.10/ccmadmin/logon.asp" $oIE = _IECreate($sUrl) WinSetState("Cisco CallManager 3.3 Administration - Log On - Microsoft Internet Explorer", "", @SW_MAXIMIZE) Send("auto_script") Send("{TAB}") Send("321987") Send("{ENTER}") WinWaitActive("Cisco CallManager Administration - Microsoft Internet Explorer") MouseClick("left", 176, 112) MouseMove(193, 148) Sleep(1000) MouseClick("left", 409, 149) Sleep(2000) MouseClick("left", 68, 293) Sleep(5000) MouseClick("left", 500, 466) MouseClick("left", 342, 450) Sleep(500) MouseClick("left", 342, 450) Sleep(500) MouseClick("left", 342, 450) Sleep(500) MouseClick("left", 500, 437) MouseClick("left", 342, 450) MouseClick("left", 496, 436) MouseClick("left", 342, 450) MouseClick("left", 500, 486) MouseClick("left", 342, 450) Sleep(500) MouseClick("left", 342, 450) Sleep(500) MouseClick("left", 342, 450) Sleep(500) MouseClick("left", 500, 436) MouseClick("left", 342, 450) MouseClick("left", 500, 437) MouseClick("left", 342, 450) MouseClick("left", 500, 451) MouseClick("left", 342, 450) MouseClick("left", 500, 518) MouseClick("left", 342, 450) MouseClick("left", 356, 352) MouseClick("left", 500, 110) Sleep(2000) MouseClick("left", 525, 137) SendMail() WinWaitClose("Microsoft Internet Explorer") Func SendMail() Run("cmd") Sleep(500) Send("telnet 10.14.0.45 25") Send("{ENTER}") Send("helo") Send("{ENTER}") Send($MAILFROM) Send("{ENTER}") Send($SENDTO) Send("{ENTER}") Send($STARTBODY) Send("{ENTER}") Send($SUBJECT) Send("{ENTER}") Send($MESSAGE) Send("{ENTER}") Send(".") Send("{ENTER}") Send("quit") Send("{ENTER}") Send("exit") Send("{ENTER}") EndFunc Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc BTW the last WinWaitClose isn't working the Internet page isn't closing properly so if anyone has a great idea how to make it work that would be great!!! Thxs Cheers!!! Edited September 29, 2006 by AllSystemGo Link to comment Share on other sites More sharing options...
dabus Posted September 29, 2006 Share Posted September 29, 2006 Dump the stuff that can be interrupted if your window loses focus, eg you type your notes, messages pop up... or someone changes the desktopsize. If that happens , your script will do funny things, maybe even harm your system by deleting files... At least it looks like this could happen to you since you click like mad without checking if your ie-window is active/at the place it should be... So... ... your telnet-solution could be replaced with a blat-udf (search scripts-section). ... I don't think you should use send and mouseclick if you want to automate ie. You already used an ie-command. Why stop here? Look at the ie-section in the helpfile. You can emulate the clicking of buttons, set text, get text -- you can even hide the window doing it. Link to comment Share on other sites More sharing options...
AllSystemGo Posted October 2, 2006 Author Share Posted October 2, 2006 Thank you for your input dabus it's greatly appreciated!! I'll make modifications to the script and I'll post it back when ever I'll be done!!! Cheers Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now