Solved

Upload Button Automation

Posted on 2000-02-25
5
518 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
ID: 2558796
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
ID: 2558870
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
ID: 2558975
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
ID: 2564358
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
ID: 2565724
Thanx ColmaN, I did it, and working great. :))
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Prevent site to open without the www. 9 61
currencylayer API intergrate to ASP 25 66
replace quotes with UTF-8 character 38 86
INNER JOIN ? 8 43
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

863 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

22 Experts available now in Live!

Get 1:1 Help Now