I can't really test this.all I can suggest you do at the moment is comment out all of the On Error Resume Next statements and see if you get any errors. It also might be an idea to try it on a machine with IE6 on it. IE7 or IE8 might have extra security features that prevent it from working. Also, are you.sure. you can't fill in the field on the web page? You should be able to do something like the following.
File Upload Php
Regards, Rob. Set objIE = CreateObject('InternetExplorer.Application') objIE.Visible = True objIE.Navigate 'While objIE.Busy = True WScript.Sleep 100 Wend While objIE.ReadyState 4 WScript.Sleep 100 Wend objIE.Document.All.Item('Email').Value = 'myuser' objIE.Document.All.Item('Passwd').Value = 'mypassword' Select all. Hmmm, I don't really know how to help you with this script, but I'm suspecting that since the POST seems to launch another instance of IE, you're losing the credentials from the first visible session, and therefore not authenticating. To avoid VBScript altogether, have you tried cURL? Have a look at section 4.3 File Upload POST on this page: You might just get away with running the following, changing the URL to the one where the upload page is actually displayed curl -user name:password -form upload=@localfilename -form press=OK The executable appears to be downloadable from here: Regards, Rob.
I have done it using: objIE.Document.getElementByID('versionFile').focus objShell.SendKeys FileItem.Path Select all But there are few extra Do While/Do Until loops. I am not able to figureout which one to remove hence I keep both. I did several tests and the code was failing sometimes since the script was not waiting for SendKeys method to complete the task.
SFTP server and client Last week's demonstrated how easy it is to. Today's piece shows how to automate a well-known Windows open source SFTP client using script files. WinSCP installation and settings For this short tutorial I am using the. I installed WinSCP using the Custom Installation option, and at the Select Additional Tasks step, I made sure that Add installation directory to search path box was checked.
Checking this option helps to simplify WinSCP scripts and batch files - this is because the full path of the WinSCP executable won't be needed in order to run the SFTP client from the command line. Also, if possible, connect to the remote SFTP server first with the GUI application before connecting via the command line. Doing this allows you to easily add the remote server's host key to WinSCP's key cache. Script creation I kick off SFTP scripts from the command line using a traditional batch file. For example, this is a listing of a batch file named deploy.bat - used to start the SFTP client with script file. Notice the commented lines in the file, these lines are not needed if the option to add the WinSCP's folder to%PATH% was selected during installation.
@echo off REM Next line NOT needed if WinSCP folder was added to PATH REM CD 'C: Program Files (x86) WinSCP' Winscp.com /script=C: temp uploadscript.txt Notice too, the script file is named uploadscript.txt, specified by the /script parameter. Finally, we examine the script file itself. In this example, I am opening a connection to an SFTP server (192.168.1.17) on my local network, specifying username (glasskeys) with password (somepassword). I then change the local directory to C: temp, and instruct the SFTP client to copy a subfolder named 'asubfolder', lastly, I instruct the client to copy a single document named atestdoc.txt to the remote server before exit: option echo off option batch on option confirm off open sftp://glasskeys:[email protected] #Change LOCAL directory lcd 'C: temp ' #copy an entire folder put -nopermissions -nopreservetime 'asubfolder' #copy an individual file put -nopermissions -nopreservetime 'atestdoc.txt' atestdoc.txt exit You may be curious about the nopermissions and nopreservetime switches. WinSCP's tells us that nopermissions keeps default file permissions, and nopreservetime instructs the remote server to replace timestamp information.
Based on past experience, I've found that using both of these switches helps to mitigate problems - especially when overwriting files on remote SFTP servers. This is a screenshot of the deploy batch file executing in a command window: For more information, consult WinSCP's extensive scripting documentation. This article is published as part of the IDG Contributor Network.
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |