Solved

Upload Button Automation

Posted on 2000-02-25
5
525 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How can i convert a Generic list to DataTable in c# 3 1,038
replace quotes with UTF-8 character 38 96
SP to delete duplicates 15 70
One field not displaying content (ASP Classic) 8 25
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 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 a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

773 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