AutoHotkey Community

It is currently May 27th, 2012, 1:49 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 98 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7  Next
Author Message
 Post subject:
PostPosted: July 1st, 2009, 9:38 am 
Noone? :(


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 1st, 2009, 9:02 pm 
Offline

Joined: December 4th, 2006, 10:35 am
Posts: 561
Location: Galil, Israel
Jim_Karvo wrote:
Noone? :(


here is MS nice helpful site,

<http://msdn.microsoft.com/en-us/library/aa385096(VS.85).aspx>


if helpful.

_________________
Joyce Jamce


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 4th, 2010, 6:29 pm 
Offline

Joined: March 19th, 2007, 12:43 am
Posts: 532
Jim_Karvo, If you still haven't figured it out 1 = True, your script worked...


NVM i fixed it my issue. Don't knwo why, but i had to specify full path to the errorlist file.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 4th, 2010, 10:33 pm 
Can this great O.P. script be modified to connect to Windows built-in IPV6 FTP socket?? thank you


Report this post
Top
  
Reply with quote  
 Post subject: Does this work now?
PostPosted: January 22nd, 2010, 5:01 pm 
Andreone wrote:
AAARRRRRGGGGGG!
After a lot and a lot of tests, a lot of research, I'm still unable to get correct time values. There is clearly something wrong in the code because a C++/MFC application that use wininet.dll is able to provide times. I've look into the c++ code but cannot find hints. This is a nightmare.

Here's a new version of FileTimeToStr(ByRef @FileTime) that works fine (I tested it using Skan's post http://www.autohotkey.com/forum/topic8728-60.html ProcessCreationTime() (This is how I realize that binaries values MUST be passed as ByRef arguments).
The returned date/time is also compatible with ahk function FormatTime.

Code:
; FileTimeToSystemTime: http://msdn2.microsoft.com/en-us/library/ms724280.aspx
;~ typedef struct _SYSTEMTIME {
;~   WORD wYear;
;~   WORD wMonth;
;~   WORD wDayOfWeek;
;~   WORD wDay;
;~   WORD wHour;
;~   WORD wMinute;
;~   WORD wSecond;
;~   WORD wMilliseconds;
;~ } SYSTEMTIME;
FileTimeToStr(ByRef @FileTime)
{
   VarSetCapacity(SystemTime, 16, 0)
   DllCall("FileTimeToLocalFileTime", "uint", &@FileTime, "uint", &@FileTime)
   DllCall("FileTimeToSystemTime", "uint", &@FileTime, "uint", &SystemTime)

   str .= NumGet(SystemTime, 0, "ushort")
   str .= StrLen(Word := NumGet(SystemTime,  2,"ushort")) == 1 ? ("0" . Word) : Word
   str .= StrLen(Word := NumGet(SystemTime,  6,"ushort")) == 1 ? ("0" . Word) : Word
   str .= StrLen(Word := NumGet(SystemTime,  8,"ushort")) == 1 ? ("0" . Word) : Word
   str .= StrLen(Word := NumGet(SystemTime, 10,"ushort")) == 1 ? ("0" . Word) : Word
   str .= StrLen(Word := NumGet(SystemTime, 12,"ushort")) == 1 ? ("0" . Word) : Word
   return str
}


I am getting garbage with this code for the creation time. Does this have anything to do with NET 2.0 or higher?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2010, 12:43 am 
Offline

Joined: November 7th, 2006, 9:47 pm
Posts: 1934
Location: Germany
I am not able to get this to work. Does these ftp functions work under Vista? The example by Ace_NoOne http://www.autohotkey.com/forum/viewtopic.php?p=124490#124490 does not work here. Off course I changed the username and password to real. It allways says Error connecting to FTP server.

_________________
{1:"ahkstdlib", 2:"my libs", 3:"my apps", 4:"my license"}
--> Don't feed the troll! <--


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2010, 1:39 am 
Offline

Joined: February 5th, 2007, 12:19 pm
Posts: 192
Location: Osnabrück, Germany
I tried AHKLernersversion. Works with win7 (only FTP_putfile tested).

Code:
LocalFile=puttest.txt
NewRemoteFile= puttest.txt
server= www.ftptestserver.de
port:=21
username= testuser
password:="123"
 

FTP_Init()
hConnect:=FTP_Open(Server, Port, Username, Password)
FTP_PutFile(hConnect,LocalFile, NewRemoteFile)
FTP_CloseSocket(hConnect)
FTP_Close()

return
;======
;ftpfunctions
;======
...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2010, 2:53 am 
Offline

Joined: November 7th, 2006, 9:47 pm
Posts: 1934
Location: Germany
I will try that, thx. Why do you FTP_Init()?? It does nothing!?
Quote:
Code:
FTP_Init() {
}


And no, i dont get it! Script hangs with FTP_Open(). May be it is not usable with Vista? Do have anyone other any experience with these functions?

_________________
{1:"ahkstdlib", 2:"my libs", 3:"my apps", 4:"my license"}
--> Don't feed the troll! <--


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2010, 3:03 am 
Offline

Joined: November 7th, 2006, 9:47 pm
Posts: 1934
Location: Germany
It works now!

But what is happening? The example http://www.autohotkey.com/forum/viewtopic.php?p=124490#124490 show us any value not 1 is an error.
Quote:
Code:
; establish connection to FTP server
connect:
   FtpConnection := Ftp_Open(FtpHost, FtpPort, FtpUsername, FtpPassword)
   If (FtpConnection != 1)
   {
      MsgBox, Error connecting to FTP server.
      GoSub, quit
   }
Return


But your example worked with the autohotkey.net. The return value of Ftp_Open() is something high about 1.

_________________
{1:"ahkstdlib", 2:"my libs", 3:"my apps", 4:"my license"}
--> Don't feed the troll! <--


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2010, 3:42 am 
That example is not relevant to ahklerner's version, which returns 0 on failure or the ic_hInternet handle (potentially any non-zero value) on success.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2010, 4:23 am 
Offline

Joined: November 7th, 2006, 9:47 pm
Posts: 1934
Location: Germany
I did not realize they working in another way. Thx, now I see what the difference is.

_________________
{1:"ahkstdlib", 2:"my libs", 3:"my apps", 4:"my license"}
--> Don't feed the troll! <--


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 16th, 2010, 12:23 am 
Offline

Joined: February 27th, 2009, 9:11 am
Posts: 693
Location: Burbank, California
FTP_PutFile and FTP_GetFile are about 2 to 3 times faster than the NCFTP (see http://www.ncftp.com/) which I have used in the past. Thank you for adding these functions! :D
I have 2 questions: I do not seem to get FTP_SetCurrentDirectory and FTP_GetCurrentDirectory to work. My test is as follows:
Code:
dirnam = /lrfiles

hConnect:=FTP_Open(Server, Port, Username, Password)
FTP_SetCurrentDirectory(hConnect,dirnam)
FTP_CloseSocket(hConnect)
FTP_Close()

hConnect:=FTP_Open(Server, Port, Username, Password)
FTP_GetCurrentDirectory(hConnect, getdirnam)
FTP_CloseSocket(hConnect)
FTP_Close()
MsgBox %getdirnam%

lrfiles is an existing subfolder and MsgBox %getdirnam% shows "/"
What I am I doing wrong?
2nd, I had hoped to find a function that would retrieve a remote directory listing. I now use
Code:
Runwait %comspec% /c %a_temp%\ncftpls.exe -1 -u %id% -p %pw% ftp://%id%@%host% >%a_temp%\rmtdir.txt,,hide

which works fine, but such a function in the library would be much cleaner and presumably faster.
Any help would be much appreciated!

_________________
"Data is not information, information is not knowledge, knowledge is not understanding, understanding is not wisdom" but let's start to get the data...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 17th, 2010, 7:48 pm 
Offline

Joined: April 10th, 2009, 1:46 am
Posts: 139
Location: Wichita,Kansas
ok, well, i have tried to do this, using what was given. and i cant upload anything. here is my code. what happens is in red.
Code:

FtpHost = 127.0.0.1
FtpPort = 21
FtpUsername = test1
FtpPassword = testpass1
localFile = C:\FtpTest.txt
remoteFile = test\FtpTest.txt

uploadFile()

 ^!h::
 exitapp
 return

uploadFile()
{
    ; establish connection to FTP server
   GoSub, connect
   ; backup existing file -- DEBUG: to do
   ; N.B.: existing files are being overwritten automatically
   ; store file on FTP server
   fileTransfer := FtpPutFile(localFile, remoteFile)
   If (fileTransfer != 1)
   {
      MsgBox, Error uploading file.
      GoSub, quit
   }
   ; close connection
   FtpClose()
   ; confirmation message
   MsgBox, Upload complete.
   ; terminate script
   GoSub, quit
   }
Return

FtpPutFile(localFile, NewRemoteFile="", Flags=0) {
;Flags:
;FTP_TRANSFER_TYPE_UNKNOWN = 0 (Defaults to FTP_TRANSFER_TYPE_BINARY)
;FTP_TRANSFER_TYPE_ASCII = 1
;FTP_TRANSFER_TYPE_BINARY = 2
If NewRemoteFile=
NewRemoteFile := LocalFile
global ic_hInternet
r := DllCall("wininet\FtpPutFileA"
, "uint", ic_hInternet
, "str", LocalFile
, "str", NewRemoteFile
, "uint", Flags
, "uint", 0) ;dwContext
If (ErrorLevel != 0 or r = 0)
return 0
else
return 1
}

connect:
   FtpConnection := FtpOpen(FtpHost, FtpPort, FtpUsername, FtpPassword)
   If (FtpConnection != 1)
   {
      MsgBox, Error connecting to FTP server.
      GoSub, quit
   }
Return

FtpOpen(Server, Port=21, Username=0, Password=0 ,Proxy="", ProxyBypass="") {
IfEqual, Username, 0, SetEnv, Username, anonymous
IfEqual, Password, 0, SetEnv, Password, anonymous
If (Proxy != "")
AccessType=3
Else
AccessType=1
;#define INTERNET_OPEN_TYPE_PRECONFIG                    0   // use registry configuration
;#define INTERNET_OPEN_TYPE_DIRECT                       1   // direct to net
;#define INTERNET_OPEN_TYPE_PROXY                        3   // via named proxy
;#define INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY  4   // prevent using java/script/INS
global ic_hInternet, io_hInternet
hModule := DllCall("LoadLibrary", "str", "wininet.dll")
io_hInternet := DllCall("wininet\InternetOpenA"
, "str", A_ScriptName ;lpszAgent
, "UInt", AccessType
, "str", Proxy
, "str", ProxyBypass
, "UInt", 0) ;dwFlags
If (ErrorLevel != 0 or io_hInternet = 0) {
FtpClose()
return 0
}
ic_hInternet := DllCall("wininet\InternetConnectA"
, "uint", io_hInternet
, "str", Server
, "uint", Port
, "str", Username
, "str", Password
, "uint" , 1 ;dwService (INTERNET_SERVICE_FTP = 1)
, "uint", 0 ;dwFlags
, "uint", 0) ;dwContext

If (ErrorLevel != 0 or ic_hInternet = 0)
return 0
else
return 1
}

FtpClose() {
global ic_hInternet, io_hInternet
DllCall("wininet\InternetCloseHandle",  "UInt", ic_hInternet)
DllCall("wininet\InternetCloseHandle",  "UInt", io_hInternet)
DllCall("FreeLibrary", "UInt", hModule)
}

quit:
   FtpClose()
   ExitApp
Return

I just cant find whats wrong with it.
It connects correctly, but cant upload anything.

_________________
Drainx1
Your favorite.

What says that we aren't a visualization of someones dream?
And that person could change the laws of physics without thinking a thing about it.
They could recreate the world, and not know what happened.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 17th, 2010, 8:21 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
Before anyone answers the above question, please read this http://www.autohotkey.com/forum/viewtopic.php?t=55815 by the same person and draw your own conclusion

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 17th, 2010, 8:25 pm 
Offline

Joined: April 10th, 2009, 1:46 am
Posts: 139
Location: Wichita,Kansas
do you think im using it for a keylogger?
im using it for a bussiness site, copy a document that i wrote and send it via ftp to a business site.

_________________
Drainx1
Your favorite.

What says that we aren't a visualization of someones dream?
And that person could change the laws of physics without thinking a thing about it.
They could recreate the world, and not know what happened.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 98 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 12 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group