Jump to content

Uploader


Recommended Posts

Hey, whant to do a simple file uploader

I search at forum, read help file, and stil can't fix it.

#include <IE.au3>
$oIE = _IECreate("http://www.multiupload.com/", 1, 1)
_IELoadWait ($oIE)
;***********************************************************************
$oSubmit = _IEGetObjByName ($oIE, "file_0")
_IEAction ($oSubmit, "Click")
$oSubmit = _IEGetObjByName ($oIE, "description_0")
_IEFormElementSetValue ($oSubmit, "nothing")

In this step i have a problem.How script can click on Upload button ( java script )

post-50766-12514323949696_thumb.jpg

This is button code:

<INPUT style="BORDER-BOTTOM: #b0b8bb 1px solid; BORDER-LEFT: #b0b8bb 1px solid; WIDTH: 81px; HEIGHT: 21px; MARGIN-LEFT: 2px; BORDER-TOP: #b0b8bb 1px solid; BORDER-RIGHT: #b0b8bb 1px solid" onclick=startupload(); value=Upload type=button>

And this is java script:

function startupload()
{
  if (document.getElementById('file_0').value == '')
  {
    alert('Please select a file to upload.');
  }
  else if ((document.getElementById('fromemail').value !== '') && (checkMail(document.getElementById('fromemail').value)))
  {
    document.getElementById('fromemail').focus();
    alert('Please enter a valid sender e-mail address.');
  }
  else if ((document.getElementById('toemail').value !== '') && (checkMail(document.getElementById('toemail').value)))
  {
    document.getElementById('toemail').focus();
    alert('Please enter a valid recipient e-mail address.');
  }
  else
  {
    document.getElementById('uploadfrm').submit();
    document.getElementById('uploadwindow').style.display='none';
    document.getElementById('deliveryemail').style.display='none';
    document.getElementById('uploadprogress').style.display='';
    document.uploading=true;
    document.getElementById('midgrad').style.backgroundImage = "url('images/mid_bg_no_grad.gif')"; 
    document.getElementById('midgrad').height = '47';
    document.getElementById('deliveryemail').style.display='none';
    document.maxheight=552;
    resizemulti();
    setTimeout("startprogress()",2000);
  }

Thank you for your replys.

Edited by SLIpros
Link to comment
Share on other sites

I presume your frustration is that the button has no name or ID. Take a look at _IETagnameGetCollection for _IEFormElementGetCollection and use an index parameter to get the element you want.

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 presume your frustration is that the button has no name or ID. Take a look at _IETagnameGetCollection for _IEFormElementGetCollection and use an index parameter to get the element you want.

Dale

Thank you! it's really helps +)

Edited by SLIpros
Link to comment
Share on other sites

Not sure... try raw?

ControlSend ( "", "", "", "D:\music.zip", 1)

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