Jump to content

[?] Need Help with Script


 Share

Recommended Posts

Ok so I am trying to create this script (happens to be involving myspace, but I have been having trouble with the _IE functions in general for a while). Basically, the script will open up a page and send a message.

What I have so far:

$hIE = _IEPropertyGet($oIE, "hwnd") ; Get the handle
WinSetState($hIE, "", @SW_MAXIMIZE) 
_IELoadWait($oIE)
$oForm = _IEFormGetObjByName ($oIE, "Subject:") ; These next few lines I am having trouble with --> I have no idea how to 'set focus' to forms, type in forms, press submit, etc. Everything here is wrong, and I have tried and tried but cant figure it out
$oText = _IEFormElementGetObjByName ($oForm, "0")
_IEFormElementSetValue ($oText, "Hey! It works!")         
_IEFormSubmit ($oForm)
Send("Hey")
Sleep(100)
Send("{TAB}")
Sleep(100)
Send("^v")
Send("{ENTER}")
Send("{ENTER}")
Send("SADFSADFSADFSAFSDAFSADFSDAFSADF")
Sleep(100)
Send("{ENTER}")
Send("{ENTER}")
Send("ASDFSDAFSFDSAFSAFDAFSAFDFSFSDAF")
Sleep(100)
MouseClick("left", 353, 915)
MouseClick("left", 351, 878)
MouseClick("left", 349, 915)
MouseClick("left", 347, 915)
Sleep(5000)

What it is 'basically' supposed to do:

1.) Navigate to the 'send message' page

2.) Somehow set focus on the 'Subject:' field then type something in that field

3.) Set focus/navigate down to the 'Message:' field then type something in that field

4.) Send the message

I am trying to figure out ways to do this without using mouse click, something a bit more efficient.

Any help given would be greatly appreciated, thank you. <_<

EDIT: Sorry I forgot to post the screenshot of the page I am working with, in case it helps visualize any better. Thanks

Posted Image

Edited by andrew01
Link to comment
Share on other sites

Well, could anyone at least try to help me understand this:

It is the example under: _IEFormElementGetObjByName

; *******************************************************
; Example 1 - Get a reference to a specific form element by name.
;               In this case, submit a query to the Google search engine
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://www.google.com")
$oForm = _IEFormGetObjByName ($oIE, "f")
$oQuery = _IEFormElementGetObjByName ($oForm, "q")
_IEFormElementSetValue ($oQuery, "AutoIt IE.au3")
_IEFormSubmit ($oForm)

It opens up good and searches for autoit. I have no idea where "f" and "q" come from though, could someone explain the code above to me please?

Link to comment
Share on other sites

I've made one, it was easy useing the UDFS, but i'm not releasing it.

Your respond was completely useless and provide nothing but a "show-off" which isn't hard to accomplish + waste of Jon's bandwidth.

To get the form collection, try my loop below

#include<IE.au3>
$thread="http://www.website.com"
$Time=5000

_GetValue($thread,$Time)

Func _GetValue($ThreadLink,$oTimeout)
    Local $oIE,$oForm,$oQuery,$o_Query
    _IEErrorHandlerRegister()
    _IELoadWaitTimeout($oTimeout)
    $oIE=_IECreate($ThreadLink,0,1,1)
    MsgBox(64,"Warning","Input text into element and click ok to continue")
    $oForm = _IEFormGetCollection ($oIE)
    $iNumForm=@extended
    For $i=0 to $iNumForm-1
        $oForm = _IEFormGetCollection ($oIE, $i)
        $oQuery = _IEFormElementGetCollection ($oForm)
        $iNumElement=@extended
        For $n=0 to $iNumElement-1
            $o_Query=_IEFormElementGetCollection($oForm,$n)
            If String(_IEFormElementGetValue($o_Query))="English" Then
                MsgBox(64,"Form: "&$i,"Element: "&$n)
            EndIf
        Next
    Next
EndFunc

Edit: Change the "English" to desire text

Edited by Generator
Link to comment
Share on other sites

Generator, thank you so much <_< it's working now.

One more question, is it possible to enter some type of text that has quotes around it? For example

$hello = ""Hello""

Send($hello)

;or

Send(""hello"")

So the text being sent out is "hello" (with quotations).

Anyway to do that? Thanks.

Link to comment
Share on other sites

Your respond was completely useless and provide nothing but a "show-off" which isn't hard to accomplish + waste of Jon's bandwidth.

No, it wasn't useless; Not showing off (Just contributing to a thread). And taking less than a minute of Jon's bandwith. <_< Don't jet jealous, haha.

Posted Image

Edited by JustinReno
Link to comment
Share on other sites

No, it wasn't useless; Not showing off (Just contributing to a thread). And taking less than a minute of Jon's bandwith. <_< Don't jet jealous, haha.

Posted Image

Once again you did not answer thread opener's question and bring up something completely unrelated, i just can't see how your last thread is useful, there's a way around everything.

For quote use '"msg"'

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...