Solved

Upload Button Automation

Posted on 2000-02-25
5
513 Views
Last Modified: 2012-06-27
Hi all, i need your expert advice here.

I am using an upload component from www.aspupload.com. Using this component, i have a pre-select files to uplaod, i want to automate UPLOAD button. I wrote code for that, at onLoad event of <body>. It's not working. Pls take a look, and help me in fidning out the problem.

thanx in advance!
-FirAlian

<script language="VBScript">
Sub Select_OnClick
      UploadCtl.Select
End Sub
Sub Remove_OnClick
      UploadCtl.RemoveHighlighted
End Sub
Sub RemoveAll_OnClick
      UploadCtl.RemoveAll
End Sub
Sub Upload_OnClick
      UploadCtl.Upload
End Sub
</script>

<html>

<head>
<meta HTTP-EQUIV="REFRESH" CONTENT="20;t.asp">
<title></title>
</head>

<body onload="JavaScript:setTimeout('MyForm.submit()',5000)">
<p>
<object WIDTH="500" HEIGHT="200" ID="UploadCtl"
CLASSID="CLSID:E87F6C8E-16C0-11D3-BEF7-009027438003" CODEBASE="XUpload.ocx">
  <param name="EnablePopupMenu" value="False">
  <param name="ViewServerReply" value="False">
  <param name="frmUpload" value="MyForm">
  <param name="Server" value="rntv">
  <param name="Script" value="/v2/xupload/samples/uploadscript.asp">
  <param name="FILE1" value="d:\nemos_pure">
</object>
</p>

<form name="MyForm" method="POST">
  <p><input TYPE="BUTTON" NAME="SELECT" VALUE="Select"> <input TYPE="BUTTON" NAME="REMOVE"
  VALUE="Remove"> <input TYPE="BUTTON" NAME="REMOVEALL" VALUE="Remove All"> <input
  TYPE="button" NAME="UPLOAD" VALUE="Upload"> </p>
</form>
</body>
</html>
0
Comment
Question by:FirAlian
  • 3
  • 2
5 Comments
 

Expert Comment

by:ColmaN
Comment Utility
try with
<script>
<!--
function execute()
{
    MyForm.submit()
    // or
    // Document.Myform.submit()
    // or
    // Document.forms[0].submit()
}
//-->
</script>
<body onload="a=setTimeout('execute()',5000)">

an onload option is javascript defect you dont need put it, and maybe you need to assign to a variable the timeout.

i don´t undestand the problem.. i read the source and i think that you want to wait 5 seconds before you force a submit , if is this you dont need to put the timeout in the onload.. you could put it at buttom with

<script>
<!--
function execute()
{
    document.myform.submit()
     //or
     //document.forms[0].submit()
}
a=setTimeot('execute()',5000);
//-->
</script>

normaly work better if you call a function that an inline..
0
 

Author Comment

by:FirAlian
Comment Utility
Thanx for your suggestion.
Actually, i want this page to keep executing at 5 minutes interval, when a user logs in, and will run untill user clicks LOGOUT (i will add this button later).

I tried your sugesstion # 2, IE error window pop up, with msg "Wrong number of arguments or invalid property assignment: 'execute'".

Any more suggestions...???

I really apprecite your help, and concern. I hope you gonna make this code run for me.

Do you think I need to refresh the page. using <meta...> as well, or delay time in setTimeout will be enough?

-FirAlian
0
 

Author Comment

by:FirAlian
Comment Utility
I think following code is better to consider as Upload Button is just used as type 'BUTTON' and an onClick event is written in VBScript. We need to automate that Onclick VBScript event.

Can we do it? as i tried this code and it works if i click upload button by my self.

<script language="VBScript">
Sub Select_OnClick
      UploadCtl.Select
End Sub
Sub Remove_OnClick
      UploadCtl.RemoveHighlighted
End Sub
Sub RemoveAll_OnClick
      UploadCtl.RemoveAll
End Sub
Sub Upload_OnClick
      UploadCtl.Upload
End Sub
</script>

<html>

<head>
<title></title>
</head>

<body>

<p>
<object WIDTH="500" HEIGHT="200" ID="UploadCtl"
CLASSID="CLSID:E87F6C8E-16C0-11D3-BEF7-009027438003" CODEBASE="XUpload.ocx">
  <param name="EnablePopupMenu" value="False">
  <param name="ViewServerReply" value="False">
  <param name="Server" value="rntv">
  <param name="Script" value="/v2/xupload/samples/uploadscript.asp">
  <param name="FILE1" value="d:\nemos_pure">
</object>
</p>
 <p><input TYPE="BUTTON" NAME="SELECT" VALUE="Select"> <input TYPE="BUTTON" NAME="REMOVE"
  VALUE="Remove"> <input TYPE="BUTTON" NAME="REMOVEALL" VALUE="Remove All"> <input
  TYPE="button" NAME="UPLOAD" VALUE="Upload"> </p>
</body>
</html>
0
 

Accepted Solution

by:
ColmaN earned 10 total points
Comment Utility
sorry, is

a=setTimeot('execute',5000);

not

a=setTimeot('execute()',5000);


and yes use your code, just put more. .append the code i write.

the set timeout is enought

regards
0
 

Author Comment

by:FirAlian
Comment Utility
Thanx ColmaN, I did it, and working great. :))
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now