Jump to content

super small little semi-useless thing


seandisanti
 Share

Recommended Posts

this is definitely not the prettiest way to do what i wanted to do, but it works. I use autoit at work alot, and typically i have alot of output from my scripts, either errors or completion notices etc. Alot of the time while i'm at work, i'm nowhere near my desk, either i'm away on a break or well yeah that's about it, i'm always away on break. anyway, this is just a little udf i did to shoot the output to my cell phone instead of to the display...it fires up the webpage provided by cingular/att and enters info to be sent. this could probably pretty easily be setup to run in the background so the page isn't displayed or anything, but it wasn't absolutely necessary for me, and i have it kill the window right after the message is sent anyway. if one of you wants to use com and dll's to make it nicer, that would be awesome (please post it if you do), if not, maybe one of you guys could tailor this to your own needs to avoid coming back from a break to see an error on your screen saying you have to re-run script and take another break....

func SendText($msg)
run("c:\program files\internet explorer\iexplore.exe http://www.mymmode.com/messagecenter/init")
WinWaitActive("Text Messaging")
send("{Tab 26}7025551212{tab}7025551212{tab}From work computer{tab}" & $msg & "{tab 6}{enter}")
sleep(3000)
send("!{F4}")
EndFunc
Link to comment
Share on other sites

Hi,

This will fill in the form.?...I have not written it as "func" at present

Best, randall

#include <ie.au3>

; Create a new browser window and navigate to a page

$oIE = _IECreate()

_IENavigate($oIE, "http://www.mymmode.com/messagecenter/init")

; Find the form and the form fields we are interested in

$o_form     = _IEFormGetObjByName($oIE, "WSForm")

$o_recipient     = _IEFormElementGetObjByName($o_form, "recipient")

$o_sender     = _IEFormElementGetObjByName($o_form, "sender")

$o_subject     = _IEFormElementGetObjByName($o_form, "subject")

$o_message     = _IEFormElementGetObjByName($o_form, "message")

; Set the value of the form fields

_IEFormElementSetValue($o_recipient, "7025551212")

_IEFormElementSetValue($o_sender, "7025551212")

_IEFormElementSetValue($o_subject, "From work computer")

_IEFormElementSetValue($o_message, "Message.... etc")

; The next line might submit the form -- but ? will need "clickimage; or just Enter Key and send as you did before?! ?:-)

_IEFormSubmit($o_form)

Exit

EDIT - Woops! - Apology for the SMS use! Edited by randallc
Link to comment
Share on other sites

Hi,

This will fill in the form.?...I have not written it as "func" at present

Best, randall

EDIT - Woops! - Apology for the SMS use!

<{POST_SNAPBACK}>

i tried to run this with the newest beta, and got 7 errors....

C:\Documents and Settings\lv_sdesanti\Desktop\scripts\TESTMSG2.AU3(1,10) : ERROR: can't open include file <ie.au3>
#include <ie.au3>
~~~~~~~~~^
C:\Documents and Settings\lv_sdesanti\Desktop\scripts\TESTMSG2.AU3(4,18) : ERROR: _IECreate(): undefined function.
$oIE = _IECreate()
~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\lv_sdesanti\Desktop\scripts\TESTMSG2.AU3(5,62) : ERROR: _IENavigate(): undefined function.
_IENavigate($oIE, "http://www.mymmode.com/messagecenter/init")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\lv_sdesanti\Desktop\scripts\TESTMSG2.AU3(8,49) : ERROR: _IEFormGetObjByName(): undefined function.
$o_form  = _IEFormGetObjByName($oIE, "WSForm")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\lv_sdesanti\Desktop\scripts\TESTMSG2.AU3(9,67) : ERROR: _IEFormElementGetObjByName(): undefined function.
$o_recipient     = _IEFormElementGetObjByName($o_form, "recipient")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\lv_sdesanti\Desktop\scripts\TESTMSG2.AU3(15,50) : ERROR: _IEFormElementSetValue(): undefined function.
_IEFormElementSetValue($o_recipient, "7025551212")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\lv_sdesanti\Desktop\scripts\TESTMSG2.AU3(21,22) : ERROR: _IEFormSubmit(): undefined function.
_IEFormSubmit($o_form)
~~~~~~~~~~~~~~~~~~~~~^

that's from SciTe after installing the newest beta and trying to run... it looks like all of the errors may boil down to my not having that file being included...<ie.au3>

going to see if i can't figure it out to work the way you wrote it, 'cause that looks like it would be alot better way to go about it...

Link to comment
Share on other sites

i tried to run this with the newest beta, and got 7 errors....

C:\Documents and Settings\lv_sdesanti\Desktop\scripts\TESTMSG2.AU3(1,10) : ERROR: can't open include file <ie.au3>
#include <ie.au3>
~~~~~~~~~^
C:\Documents and Settings\lv_sdesanti\Desktop\scripts\TESTMSG2.AU3(4,18) : ERROR: _IECreate(): undefined function.
$oIE = _IECreate()
~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\lv_sdesanti\Desktop\scripts\TESTMSG2.AU3(5,62) : ERROR: _IENavigate(): undefined function.
_IENavigate($oIE, "http://www.mymmode.com/messagecenter/init")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\lv_sdesanti\Desktop\scripts\TESTMSG2.AU3(8,49) : ERROR: _IEFormGetObjByName(): undefined function.
$o_form     = _IEFormGetObjByName($oIE, "WSForm")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\lv_sdesanti\Desktop\scripts\TESTMSG2.AU3(9,67) : ERROR: _IEFormElementGetObjByName(): undefined function.
$o_recipient     = _IEFormElementGetObjByName($o_form, "recipient")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\lv_sdesanti\Desktop\scripts\TESTMSG2.AU3(15,50) : ERROR: _IEFormElementSetValue(): undefined function.
_IEFormElementSetValue($o_recipient, "7025551212")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\lv_sdesanti\Desktop\scripts\TESTMSG2.AU3(21,22) : ERROR: _IEFormSubmit(): undefined function.
_IEFormSubmit($o_form)
~~~~~~~~~~~~~~~~~~~~~^

that's from SciTe after installing the newest beta and trying to run...  it looks like all of the errors may boil down to my not having that file being included...<ie.au3>

going to see if i can't figure it out to work the way you wrote it, 'cause that looks like it would be alot better way to go about it...

<{POST_SNAPBACK}>

it's looking like ie.au3 is a UDF i don't have... link?
Link to comment
Share on other sites

works great.  I just have to close the window after, and i think i'm gonna play with it a little to see if i can keep the window from showing up in start bar or anything... i'm sure it's possible.  thanks alot for your help man!

<{POST_SNAPBACK}>

looking through the ie.au3 i found the option to make it invisible. had to add a wait between the navigate and the form grabbing just because every other time or so it was trying to grab the form before it was loaded. and i had to add another wait after the submit before the close so that the message was completely sent before browser is closed... that ie.au3 is pretty awesome.... here's the finished code (with my cell number again replaced with the number for information). Thanks again for all the help man.

#include <ie.au3>
func SendText($msg)
; Create a new browser window and navigate to a page
$oIE = _IECreate(0)
_IENavigate($oIE, "http://www.mymmode.com/messagecenter/init")

; Find the form and the form fields we are interested in
sleep(2000)
$o_form     = _IEFormGetObjByName($oIE, "WSForm")
$o_recipient     = _IEFormElementGetObjByName($o_form, "recipient")
$o_sender     = _IEFormElementGetObjByName($o_form, "sender")
$o_subject     = _IEFormElementGetObjByName($o_form, "subject")
$o_message     = _IEFormElementGetObjByName($o_form, "message")


; Set the value of the form fields
_IEFormElementSetValue($o_recipient, "7025551212")
_IEFormElementSetValue($o_sender, "7025551212")
_IEFormElementSetValue($o_subject, "From work computer")
_IEFormElementSetValue($o_message,$MSG)

; The next line might submit the form -- but ? will need "clickimage; or just Enter Key and send as you did before?! ?:-)
_IEFormSubmit($o_form)
sleep(2000)
_IEQuit($oIE)
Exit
EndFunc
Edited by cameronsdad
Link to comment
Share on other sites

here's the finished code (with my cell number again replaced with the number for information).

I think you had better double-check that number. That does not appear to be the typical "555-1212" number to me.

By the way, great script. I have been automating my logon to my Yahoo! Mail accounts via waiting for windows to open and lots of tabs. If I can figure out how to get this to work for Yahoo! I will not get anymore passwords accidentally being typed into the user name field.

Edited by SerialKiller
Link to comment
Share on other sites

Hi, SerialKiller,

Can you tell me if my general WebLogin script works for Yahoo? [still not working on some sites with iframes at present, and where there is no "Login" button named "submit"]

WebLogin script description

WebLogin.au3

Best, Randall

Edited by randallc
Link to comment
Share on other sites

Hi, SerialKiller,

Can you tell me if my general WebLogin script works for Yahoo? [still not working on some sites with iframes at present, and where there is no "Login" button named "submit"]

WebLogin script description

WebLogin.au3

Best, Randall

<{POST_SNAPBACK}>

Your script works beautifully. I hadn't had the chance to write my own so I am glad you wrote this; it certainly saved me a lot of time. Thank you very much!
Link to comment
Share on other sites

Funny, I was thinking I was the only one who used this, I will post my code for sprint.

It was one of the first that I adapted when we got Obj/COM support.

I have my computer at work send me the status of things daily. Been doing it for for a year, but the new obj/com makes it a lot cleaner. :)

if $CmdLine[0]=1 then 
     $msg =  $CmdLine[1]
  Else
     Do
     $msg = InputBox("Sprint Phone Msg","Send a msg to Sprintkitty's Phone  (160 chars)")
     until stringlen($msg) >0 and stringlen($msg) < 160
EndIf

$msg=stringleft($msg,160)
;$IE=IE_connect()
    $IE=ObjCreate("InternetExplorer.Application")
    $IE.Navigate("http://messaging.sprintpcs.com/sml/guestCompose.do")
    Do
        Sleep(50)
    Until NOT $IE.Busy
$html=$IE.document.body.outerHTML
; msgbox(1,"html",$html)


With $IE.document.forms("composeForm")
      .phoneNumber.value = 8008575309; insert your number here
      .message.value = $msg
     ;.submit
EndWith
tooltip("sending "& $msg,100,0)
Do
   sleep(100)
until NOT $IE.busy
;$IE.visible = true
$IE.quit


func IE_connect()
; returns the internet explorer object if sucessful or makes a new one if not found
; mainly from DaleHohm's code

Dim $ObjShell = ObjCreate("Shell.Application")
Dim $ObjShellWindows = $ObjShell.Windows(); collection of all ShellWindows (IE and File Explorer)
Dim $ObjIE

For $Window in $ObjShellWindows
    If StringInStr($window.LocationURL,"https:")>0 or StringInStr($window.LocationURL,"http:")>0 or StringInStr($window.LocationURL,"ftp:")>0 Then
        $ObjIE = $Window
        Return $ObjIE; We found it...
    EndIf
Next
    $ObjIE=ObjCreate("InternetExplorer.Application")
    With $ObjIE
      ;.Visible = True
       .Navigate("http://messaging.sprintpcs.com/sml/guestCompose.do")
      Do
        Sleep(50)
      Until .ReadyState = 4
     EndWith
Return $ObjIE
EndFunc
Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...