ethnarch Posted February 1, 2007 Share Posted February 1, 2007 (edited) i am using a program called wput(well i actually started with the built in command line ftp in windows but i got the same problem)I am basically trying to pass a file name to it via a dos prompt and upload the file however it keeps skipping the file. The bizarre part is that if i type the exact same thing i am passing by hand it uploads the file no problems only when i use the Send() command in auto does it skip the file. my autoit code:CODEFunc uploadFileWput($fileName) Dim $ftpSettings = readFTPSettings() sleep(2000) If FileExists($fileName) Then Else MsgBox(4096,"", "does not exist.") Sleep(5000) EndIf ;Runwait(@ComSpec & " /c " & "wput.exe ftp://" & $ftpSettings[1] &":"& $ftpSettings[2]&"@"&$ftpSettings[0]& " " & $fileName & " ", "") ;Runwait("wput.exe ftp://" & $ftpSettings[1] &":"& $ftpSettings[2]&"@"&$ftpSettings[0]& " " & $fileName & " ", "") Run("cmd", "") Send(" wput.exe --verbose ftp://" & $ftpSettings[1] &":"& $ftpSettings[2]&"@"&$ftpSettings[0]& " " & $fileName & @LF & @CR) ;Send("{Enter}") Dim $i = 0 Dim $cnt = 0 Do AutoItSetOption("WinTitleMatchMode", 2) if(WinExists("wput")=1)Then $i = 1 EndIf if($cnt > 5) Then Break EndIf $cnt += 1 Until $i > 0 if($i = 0) then msgbox(0, "FTP Error", "Upload Timed Out",10) writeToLogFile("FTP Error Upload Timed Out") return 0 EndIf return 1EndFuncoutput of wputCODEC:\KSXReader>wput.exe --verbose ftp://user:pass@www.somesite.com mailbox\out\1_Midvale_0702011302.xml--13:03:05-- `mailbox/out\1_Midvale_0702011302.xml' => ftp://user:xxxxx@somesite:21/mailbox/out/..._0702011302.xmlConnecting to somesite:21... connected# --------- Welcome to Pure-FTPd [privsep] [TLS] ----------# You are user number 6 of 50 allowed.# Local time is now 11:03. Server port: 21.# This is a private system - No anonymous login!==> AUTH TLS ... failed (This security scheme is not implemented).Logging in as user ... # User user has group access to: 12106Logged in!==> CWD mailbox/out==> SIZE 1_Midvale_0702011302.xml ... failed.Skipping this file due to resume/upload/skip rules.-- Skipping file: mailbox/out\1_Midvale_0702011302.xml# Goodbye. You uploaded 0 and downloaded 0 kbytes.FINISHED --13:03:08--Skipped 1 file.now if i just type this physically in the command prompt it works fine:wput.exe --verbose ftp://user:pass@www.somesite.com mailbox\out\1_Midvale_0702011302.xmleverything works fine and it uploads. I thought maybe it had something to do with the file maybe not existing but as you can see i am checking to see if the file exists now and that is not a problem eitherthanks for the help Edited February 1, 2007 by ethnarch Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 1, 2007 Moderators Share Posted February 1, 2007 Do you have spaces in the parameter you want to send... might wrap that parameter in Double Quotes to see if it rectifies the issue. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
ethnarch Posted February 2, 2007 Author Share Posted February 2, 2007 i tried this like you said and no luck wput didn't even recognize the parameters this time.C:\KSXReader>wput.exe --verbose 'ftp://username:password@www.something.com' 'mailbox\out\1_Midvale_0702020705.xml'Nothing done. Try `wput --help'.then i tried this:C:\KSXReader>wput.exe --verbose 'ftp://username:password@www.something.com mailbox\out\1_Midvale_0702020700.xml'Nothing done. Try `wput --help'.I think it has something to do with the way that autoit terminates lines because if i type thiswput.exe --verbose ftp://user:pass@www.somesite.com mailbox\out\1_Midvale_0702011302.xml it works fine and the file gets uploaded, it only fails when i use run() or send() through autoit(with the same exact text i even double checked to make sure by copying and pasteing the auto it text that was outputted and it worked). Link to comment Share on other sites More sharing options...
BrettF Posted February 2, 2007 Share Posted February 2, 2007 Shell Execute?? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
ethnarch Posted February 2, 2007 Author Share Posted February 2, 2007 Shell Execute??No luck with shell execute either, or i can't really tell because i can't see the error messages that may or may not appear is there a way to catch the output of the console when using shellexecute? Another thing which i payed little attention to is this line in the original output: ==> SIZE 1_Midvale_0702011302.xml ... failed. Skipping this file due to resume/upload/skip rules. i tried putting another command in the line --reupload like this wput.exe --verbose --reupload 'ftp://username:password@www.something.com mailbox\out\1_Midvale_0702 020700.xml' and it has some more output: ==> SIZE 1_Midvale_0702020847.xml ... failed. Remote file size is equal to local size. Restarting at 0 ==> TYPE I ... done. ==> PASV ... done. ==> STOR 1_Midvale_0702020847.xml ... done. This file however does not exist as everytime i run the app i am using the time to generate a unique file, in addition to the fact i looked on the ftp server and nothing is there i deleted all the files. I also tried putting a longer Sleep of about 20 seconds thinking maybe the file wasn't finished being written or something but that didn't help either Link to comment Share on other sites More sharing options...
ethnarch Posted February 2, 2007 Author Share Posted February 2, 2007 oh yeah this is where i got that commmand from−u−−reuploadIf this flag is specified, a remote file having the same size as the local one is to be uploaded. Skipping is default. −−skip−largerIf this flag is specified, a remote file being larger than the local one will be skipped. Default is reuploading it. −−skip−existingIf this flag is specified, the upload of a file will be skipped if the remote file already exists.and if anyone wants to give my code a try here is the site for wputWput SourceForge Link to comment Share on other sites More sharing options...
Shevilie Posted February 2, 2007 Share Posted February 2, 2007 Well I'm using it already and it works fine for me Run("C:\Help\wput.exe -q -s --basename=C:\Help\ ftp://user:pass@xxxx.net/test/ C:\Help\" & $file) Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
ethnarch Posted February 2, 2007 Author Share Posted February 2, 2007 (edited) ugh i feel really stupid now, i should have showed you guys where i was calling the function from, i was missing fileClose() I stupidly never even tried to open the files there was nothing in them hehe which is why it wasn't uploading anything. The file was 0 kbytes. so i changed this ;create file to put string created above in Dim $file = FileOpen ( "C:\Reader\mailbox\out\"&$locationSettings[1]&"_"&$locationSettings[0]&"_"&$fileNameDate&".xml", 2 ) If $file = -1 Then writeToLogFile("could not open file for writing") Else ;write file to disk $file, $genValArr ) EndIf to this: ;create file to put string created above in Dim $file = FileOpen ( "C:\Reader\mailbox\out\"&$locationSettings[1]&"_"&$locationSettings[0]&"_"&$fileNameDate&".xml", 2 ) If $file = -1 Then writeToLogFile("could not open file for writing") Else ;write file to disk if(FileWrite ( $file, $genValArr )=0)Then writeToLogFile("could not write file") Else FileClose($file) EndIf EndIf now everything is happy hehe, thanks for the help everyone Edited February 2, 2007 by ethnarch Link to comment Share on other sites More sharing options...
Shevilie Posted February 4, 2007 Share Posted February 4, 2007 Thats why I have this picture to remember me of my own mistakes Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now