Download file from a secured link

Hi
I am just looking for a script from which i can download the file from a secured website by putting user name password and then select the link.

Thanks

surah79Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sungenwangCommented:
Here's a sample code.
sew

strURL = "www.gmail.com"
strUserID = "user_id"
strUserPassword = "user_password"


Set objIE = Createobject("InternetExplorer.Application")

objIE.Visible = True
objIE.Navigate2(strURL)

Call WaitWhileBusy(objIE, 3000, 100)
Call WaitForDocState(objIE, 4, 3000, 100)

objIE.document.getElementsByName("Email")(0).Value = strUserID
objIE.document.getElementsByName("Passwd")(0).Value = strUserPassword

' click on submit button
objIE.document.getElementsByName("signIn")(0).Click




Function WaitWhileBusy(objIE, intTimeout, intWaitInterval) 
	Dim boolResult : boolResult = True
	Dim intSecElapsed : intSecElapsed = 0

	Do
		If intWaitInterval > 0 Then
			WScript.Sleep intWaitInterval

			If intTimeout > 0 Then
				If intSecElapsed > intTimeout Then
					boolResult = False
					Exit Do
				Else
					intSecElapsed = intSecElapsed + intWaitInterval
				End If
			End If
		End If
	Loop While objIE.busy

	WaitWhileBusy = boolResult
End Function

Function WaitForDocState(obj, intState, uSecTimeOut, intWaitInterval)
	Dim boolResult : boolResult = True
	Dim intSecElapsed : intSecElapsed = 0

	Do
		If intWaitInterval > 0 Then
			WScript.Sleep intWaitInterval

			If uSecTimeOut > 0 Then
				If intSecElapsed > uSecTimeOut Then
					boolResult = False
					Exit Do
				Else
					intSecElapsed = intSecElapsed + intWaitInterval
				End If
			End If
		End If
	Loop Until intState <= GetDocState(obj)

	WaitForDocState = boolResult
End Function

Function GetDocState(obj)
	On Error Resume Next

	Select Case obj.Document.readyState
		Case "uninitialized"	GetDocState = 0
		Case "loading"		GetDocState = 1
		Case "loaded"		GetDocState = 2
		Case "interactive"	GetDocState = 3
		Case "complete"		GetDocState = 4
		Case Else		GetDocState = -1
	End Select

	On Error Goto 0
End Function

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
surah79Author Commented:
thanks a lot for your help
sungenwangCommented:
you're welcome!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.