Jump to content

IE function in hide mode


Recommended Posts

I've done this simple simple script that go to upload button on youtube and click it....

#include <IE.au3>

Opt("MouseCoordMode", 0)

$username = filereadline(@ScriptDir&"\username.txt",1)

$password = filereadline(@ScriptDir&"\password.txt",1)

_IECreate ("http://it.youtube.com/login?next=/my_videos_upload",1,1)

sleep(400)

send($username &"{tab}")

sleep(200)

send($password &"{tab}")

sleep(200)

send("{enter}")

sleep(3000)

send("{tab 31}")

sleep(200)

send("n95 di notte{tab}")

sleep(200)

send("qualità video n95 di notte{tab}")

sleep(200)

send("{DOWN 15}")

sleep(200)

send("{tab}")

sleep(200)

send("smartphone nokia video n95{tab}")

sleep(400)

send("{tab}")

send("{DOWN 20}")

sleep(400)

mousemove(60,295,1)

sleep(400)

mouseclick("left",60,295,1,1)

mousemove(250,230,1)

sleep(5000)

mouseclick("left",250,230,1,1)

sleep(800)

send("c:\video.mp4{enter}")

exit

If I set _IECreate ("http://it.youtube.com/login?next=/my_videos_upload",1,0)

I'm not able to use this script...... there's a way to use autoit, like program that use for example vodafone site or orange to navigate over, in hide mode and send sms without see page loading?

thanks

Link to comment
Share on other sites

@ficofico....For example

#include <IE.au3>
Opt("MouseCoordMode", 0)
$username = filereadline(@ScriptDir&"\username.txt",1)
$password = filereadline(@ScriptDir&"\password.txt",1)

$oIE=_IECreate ("http://youtube.com/login?next=/my_videos_upload")
$oForm = _IEFormGetObjByName ($oIE, "loginForm")

$oQuery = _IEFormElementGetObjByName ($oForm, "username")
_IEFormElementSetValue ($oQuery, $username)

$oQuery2 = _IEFormElementGetObjByName ($oForm, "password")
_IEFormElementSetValue ($oQuery2, $password)
_IEFormSubmit ($oForm)
Link to comment
Share on other sites

ok I've studied!! ahahah

this is my new script, but for some reason don't work well, any suggestion?

#include <IE.au3>
Opt("MouseCoordMode", 0)
$username = filereadline(@ScriptDir&"\username.txt",1)
$password = filereadline(@ScriptDir&"\password.txt",1)

$oIE=_IECreate ("http://youtube.com/login?next=/my_videos_upload",1,1,1)
$oForm = _IEFormGetObjByName ($oIE, "loginForm")


$oQuery = _IEFormElementGetObjByName ($oForm, "username")
_IEFormElementSetValue ($oQuery, $username)
sleep(400)
$oQuery2 = _IEFormElementGetObjByName ($oForm, "password")
_IEFormElementSetValue ($oQuery2, $password)
_IEFormSubmit ($oForm)
sleep(400)
$oForm2 = _IEFormGetObjByName ($oIE, "theform")
$oQuery3 = _IEFormElementGetObjByName ($oForm2, "video_title")
_IEFormElementSetValue ($oQuery3, "title...........")
_IEFormSubmit ($oForm2)
sleep(400)
$oForm2 = _IEFormGetObjByName ($oIE, "theform")
$oQuery4 = _IEFormElementGetObjByName ($oForm2, "video_description")
_IEFormElementSetValue ($oQuery4, "video descriptions...")
_IEFormSubmit ($oForm2)
sleep(400)



; from here script doesn't work well , video categories and video tags become empty before click on the upload file




$oForm2 = _IEFormGetObjByName ($oIE, "theform")
$oQuery5 = _IEFormElementGetObjByName ($oForm2, "video_categories")
_IEFormElementOptionselect ($oQuery5, "23", 1, "byValue",1)
Sleep(400)
$oForm2 = _IEFormGetObjByName ($oIE, "theform")
$oQuery6 = _IEFormElementGetObjByName ($oForm2, "video_tags")
_IEFormElementSetValue ($oQuery6, "nokia n95 rigenerator")
_IEFormSubmit ($oForm2)
sleep(400)

$oSubmit = _IEGetObjByName ($oIE, "action_upload")
_IEAction ($oSubmit, "click")
exit
Link to comment
Share on other sites

Quick suggestion based on where you are haing trouble... Read the Remarks for _IEFormSubmit and then change

_IEFormSubmit ($oForm2)

to

_IEFormSubmit ($oForm2, 0)

_IELoadWait($oIE)

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

You get errors? Please share them -- you are running in SciTe right? Explain more.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

I get no error during script... the only one at the begins is

IE.au3 V2.4-0 Warning from function _IEAttach, $_IEStatus_NoMatch

but script works and I can connect using user and password, write the title form, the description form, chose a category and write the tags form, but i don't know why... the category ElementOption and the tags form became empty and when i click the upload i cannot go to 2/2 upload page

my scite is:

SciTE

Version 1.76

Mar 30 2008 21:05:14

by Neil Hodgson.

Updated: Valik & Jos

Link to comment
Share on other sites

Explain more... does the script pause/hang? Does it continue to completion and just not do what you expect? Have you followed the exact steps manually and gotten different results? Elaborate. I don't have a YouTube account, so cannot test.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

script don't pause, and go to the end correctly. Does it continue to completion and just not do what I expect, every time script insert text or option there's a refresh of the page, but video_categories and video_tags after refresh were erased, but at the moment to write the info script work well, it's only after refresh that info were erased

Link to comment
Share on other sites

I've find the error.... ie function it's able to select the true element option, but youtube web page it's very sad and need to select by mouse the option, because using ie.au3 video_tags form it's not selected...

here 2 image that explain better than me wath i've tried to ex....

ie.au3

Posted Image

and this using mouse normally

Posted Image

Link to comment
Share on other sites

ok, now that I see the end of the tunnel..... i'm already stopped......

here my working script

#include <IE.au3>

Opt("MouseCoordMode", 0)
$username = filereadline(@ScriptDir&"\username.txt",1)
$password = filereadline(@ScriptDir&"\password.txt",1)

$oIE=_IECreate ("http://youtube.com/login?next=/my_videos_upload",1,0,1)

$oForm = _IEFormGetObjByName ($oIE, "loginForm")

$oQuery = _IEFormElementGetObjByName ($oForm, "username")
_IEFormElementSetValue ($oQuery, $username)
sleep(2000)

$oQuery2 = _IEFormElementGetObjByName ($oForm, "password")
_IEFormElementSetValue ($oQuery2, $password)
_IEFormSubmit ($oForm,1)
sleep(2000)

$oForm2 = _IEFormGetObjByName ($oIE, "theform")
$oQuery3 = _IEFormElementGetObjByName ($oForm2, "video_title")
_IEFormElementSetValue ($oQuery3, "title...........")
_IEFormSubmit ($oForm2, 0)
;~ sleep(1200)

$oForm2 = _IEFormGetObjByName ($oIE, "theform")
$oQuery4 = _IEFormElementGetObjByName ($oForm2, "video_description")
_IEFormElementSetValue ($oQuery4, "video descriptions...")
_IEFormSubmit ($oForm2, 0)
;~ sleep(1200)

$oForm2 = _IEFormGetObjByName ($oIE, "theform")
$oQuery5 = _IEFormElementGetObjByName ($oForm2, "field_myvideo_categories")
_IEFormElementOptionselect ($oQuery5, "19", 1, "byValue",1)
;~ sleep(1200)

$oForm2 = _IEFormGetObjByName ($oIE, "theform")
$oQuery6 = _IEFormElementGetObjByName ($oForm2, "field_myvideo_keywords")
_IEFormElementSetValue ($oQuery6, "nokia n95 rigenerator")
_IEFormSubmit ($oForm2, 0)

$oSubmit = _IEGetObjByName ($oIE, "action_upload")
_IEAction ($oSubmit, "click")
sleep(3000)

$oForm2 = _IEFormGetObjByName ($oIE, "theform")
$oQuery7 = _IEFormElementGetObjByName ($oForm2, "field_uploadfile")


_IEAction($oIE, "visible")
_IEAction($oQuery7,"focus")
send("c:\provaprova.mp4{ENTER}")

exit

I """"must"""" use this solution ( make visible the page) because if send text in $oQuery7 I receive this warning message in console..

IE.au3 V2.4-0 Error from function _IEFormElementSetValue, $_IEStatus_InvalidObjectType (Browser securuty prevents SetValue of TYPE=FILE)

solution?

Link to comment
Share on other sites

I've find the error.... ie function it's able to select the true element option, but youtube web page it's very sad and need to select by mouse the option, because using ie.au3 video_tags form it's not selected...

here 2 image that explain better than me wath i've tried to ex....

ie.au3

Posted Image

and this using mouse normally

Posted Image

What are you trying to get us to see? The only difference in your pictures was that the select element had focus in one and not in the other. You can try _IEAction with "focus" or "click" perhaps.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

It is customary for you to share your solution after others have expended effort to try to help you.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Hello, I'm trying to make an application which will do a mass software update for some devices we have on our network, I have the same problem when I'm trying to set a value to a html input with type=file. The device is an MGCP Gateway, which has an emmbeded web server, in the past we did it with PERL/SNMP, but the new firmware version has a bug on it and when the file is uploaded via TFTP/BOOTP server the device is restarted without loading the new firmware. When I do it manually via HTTP, all the things goes well.

ERROR:

--> IE.au3 V2.4-0 Error from function _IEFormElementSetValue, $_IEStatus_InvalidObjectType (Browser securuty prevents SetValue of TYPE=FILE)

Here is my function:

Func _doUpdateIp()
    $url = StringStripWS(GUICtrlRead($Input[1]),8)
    if $url = "" then 
        MsgBox(16, "EROARE", "Nu ati introdus nici o adresa IP!")
    Else
        $urlCheck = _checkUrl($url)
        If $urlCheck = 1 then
            MsgBox(16, "EROARE", "Adresa IP nu este valida!")
        Else
            $oIE = _IECreate ($url&"/FileUpdate", 0, 1, 0, 0)
            WinWaitActive("Connect to "&$url)
            Send("user{TAB}password{ENTER}")
            _IELoadWait ($oIE,0,10000)
            $oForm = _IEFormGetObjByName($oIE, "form1")
            $oQuery = _IEFormElementGetObjByName($oForm, "CMP")
            _IEFormElementSetValue ($oQuery, "C:\cmpDir\firmware.cmp")
            _IEFormSubmit ($oForm)
        EndIf
    EndIf
EndFunc

Here is the HTML code:

...
<FORM ENCTYPE="multipart/form-data" METHOD="POST" ACTION="Forms/FileUpdate1" id="form1" NAME="form1" onsubmit="return DoUpload(this.elements[0].value,this.elements[0].name)">
<DIV id="FILESEND" class="head3" style="visibility:hidden;">
Load <span id=FName>a <B>CMP</B></span> file from your computer to the device<BR><BR>
<INPUT TYPE="FILE" NAME="CMP" SIZE="32" MAXLENGTH="32"><BR><BR>
<INPUT TYPE="SUBMIT" NAME="Submit" VALUE="Send File"  onclick="return FileUpload(document.form1.elements[0].value);">
</FORM>
...

Thanks, Raul.

Link to comment
Share on other sites

Welcome to the forums Raul.

Actually you don't have an issue anything like whe was being discussed in this thread. Please don't pile new issues on existing threads. This forum is very valuable for people searching past history for answers to their questions. Piling on like this confuses the original thread and would make yours nearly impossible to find.

So, please read the remarks in the helpfile for _IEForElementSetValue for a likely workaround for your question and please open a new thread if you need more assistance.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

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