AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

MiniFTP [a mini FTP client made in ahk]

 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
ahklerner



Joined: 26 Jun 2006
Posts: 1381
Location: USA

PostPosted: Tue Apr 08, 2008 4:27 am    Post subject: MiniFTP [a mini FTP client made in ahk] Reply with quote

THE SOURCE CODE: http://autohotkey.net/~nkruzan/MiniFTP3.zip
License

Code:

/* This program is free software. It comes without any warranty, to
 * the extent permitted by applicable law. You can redistribute it
 * and/or modify it under the terms of the Do What The **** You Want
 * To Public License, Version 2, as published by Sam Hocevar. See
 * http://sam.zoy.org/wtfpl/COPYING for more details. */

Thanks to Olfen, Maj, Titan, Adde_P, DerRaphael, Sean and anyone else I may have used code from. I will try to put more credits in the source later.

Comments, Bugs, Suggestions welcome. Feel free to make your own changes and modify it to your hearts content.


_________________

ʞɔпɟ əɥʇ ʇɐɥʍ


Last edited by ahklerner on Wed Apr 09, 2008 7:15 pm; edited 1 time in total
Back to top
View user's profile Send private message
ahklerner



Joined: 26 Jun 2006
Posts: 1381
Location: USA

PostPosted: Tue Apr 08, 2008 6:58 pm    Post subject: Reply with quote

Added license to first post
_________________

ʞɔпɟ əɥʇ ʇɐɥʍ
Back to top
View user's profile Send private message
widow
Guest





PostPosted: Wed Apr 09, 2008 3:12 am    Post subject: Reply with quote

It works Smile
Awesome ahk work.
Back to top
Guest






PostPosted: Wed Apr 09, 2008 3:15 am    Post subject: Reply with quote

i wonder whats the difference between this and the others Laughing
Back to top
tank



Joined: 21 Dec 2007
Posts: 3700
Location: Louisville KY USA

PostPosted: Thu Jul 17, 2008 10:49 pm    Post subject: Reply with quote

you have once again earned my profound respect
_________________

We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Back to top
View user's profile Send private message
Guest






PostPosted: Fri Jul 18, 2008 4:19 am    Post subject: Re: MiniFTP [a mini FTP client made in ahk] Reply with quote

ahklerner wrote:
License

...BEST...LICENSE...EVER!...I of course normally don't read or care about licenses...but when I hovered on it & saw "wtfpl" in the url...I HAD to click!...
Back to top
n-l-i-d
Guest





PostPosted: Tue Mar 16, 2010 2:54 pm    Post subject: Reply with quote

I tried adding more info headers to the listview.

I'm having issues with getting the correct date from files (FileTimeToLocalFileTime and FileTimeToSystemTime).

Like you can see, the timestamps it returns are complete gibberish.



I tried adapting the code from the following postings:

- SKAN's ProcessCreationTime function
- FileGetTime with milliseconds
- The different attempts at DllCall: Basic FTP Functions

The minor changes I made to MiniClient.ahk to add the extra headers:

Code:
line 83:
Gui, 1:Add, ListView, x170 y%yOffset% w480 h200 gFileSelect AltSubmit vMiniFTP_ServerList hwndMiniFTP_hFileList -TabStop, Name | Size | Attrib | Path | Creation Time | Last access time | Last write time

line 356:
LV_Add("",GetItem(pFiles, ThisSelection . "_" . A_Index  . "_Name"), GetItem(pFiles, ThisSelection . "_" . A_Index . "_Size") . " " . GetItem(pFiles, ThisSelection . "_" . A_Index . "_SizeType"), GetItem(pFiles, ThisSelection . "_" . A_Index . "_Attrib"), GetItem(pFiles, ThisSelection . "_" . A_Index . "_Path"), GetItem(pFiles, ThisSelection . "_" . A_Index . "_CreationTime"), GetItem(pFiles, ThisSelection . "_" . A_Index . "_LastAccessTime"), GetItem(pFiles, ThisSelection . "_" . A_Index . "_LastWriteTime"))



Different attempts at changing/adapting the FileTimeToStr function in FTP.ahk (none of which seem to work)

Code:
/*

FileTimeToStr(FileTime) {
   VarSetCapacity(SystemTime, 16, 0)
   DllCall("FileTimeToSystemTime", "uint", &FileTime, "uint", &SystemTime)
   Return NumGet(SystemTime,2,"short")
      . "/" . NumGet(SystemTime,6,"short")
      . "/" . NumGet(SystemTime,0,"short")
      . " " . NumGet(SystemTime,8,"short")
      . ":" . NumGet(SystemTime,10,"short")
      . ":" . NumGet(SystemTime,12,"short")
      . "." . NumGet(SystemTime,14,"short")
}

*/

/*

; 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
}
*/

/*
FileTimeToStr(FileTime) {                       
 DllCall( "FileTimeToLocalFileTime", Int64P,FileTime, Int64P,Local ), AT := 1601
 AT += % Local//10000000, S
 Return AT
}
*/

;/*
; 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

;*/

 Loop 16   {       ; Extracting and concatenating 8 words from a SYSTEMTIME structure
  Word := Mod(A_Index-1,2) ? "" :  *( &SystemTime +A_Index-1 ) + ( *(&SystemTime +A_Index) << 8 )
  Time .= StrLen(Word) = 1 ? ( "0" . Word ) : Word  ; Prefixing "0" for single digits
           }

Return SubStr(Time,1,6) . SubStr(Time,9,8) ; YYYYMMDD24MISS

}

;*/


/*

FileTimeToStr( File, Mode="M" ) {    ; Topic: www.autohotkey.com/forum/viewtopic.php?t=49194
 ;If ( VarSetCapacity($,342,0)  && ( H:=DllCall( "FindFirstFile", Str,File, UInt,&$ ) ) ) {
 ;DllCall( "FindClose", UInt,H )
 VC:=&$+4, VA:=&$+12, VM:=&$+20, FT:=V%Mode%
 LFT:=&$+318 ,  DllCall( "FileTimeToLocalFileTime", UInt,FT, UInt,LFT )
 ST:=LFT+8   ,  DllCall( "FileTimeToSystemTime", UInt,LFT, UInt,ST )
 Loop 7
  T .= StrLen( N:=NumGet(ST+0,(A_Index-1)*2,"UShort") ) < 2 ? "0" N : N
Return SubStr(T,1,6) . SubStr(T,9,8) . SubStr( "00" NumGet( ST+0,14,"UShort" ), -2 )
}

*/


Anybody? Sad
Back to top
HotKeyIt



Joined: 18 Jun 2008
Posts: 4634
Location: AHK Forum

PostPosted: Wed Jul 21, 2010 8:31 pm    Post subject: Reply with quote

You will need to use InternetTimeToSystemTime
Example (requires AHK_H) and WinDlls()
Code:
_:=WinDlls("wininet.dll")
fdata:=Struct("WIN32_FIND_DATA")
time:=Struct("SYSTEMTIME")

ftp:=_.InternetConnect(int:=_.InternetOpen(A_ScriptName,1),"ftp.autohotkey.net",21,"HotKeyIt","MyPassword",1)
_.FtpFindFirstFile(ftp,"AutoHotkey.zip",fdata[""])
_.InternetTimeToSystemTime(fdata.ftCreationTime[""],time[""])
MsgBox % time.wYear . "-" time.wMonth . "-" time.wDay
         . "`n" time.wDayOfWeek
         . "`n" time.wHour . ":" time.wMinute   . ":" time.wSecond . ":" time.Milliseconds
_.InternetCloseHandle(ftp),_.InternetCloseHandle(int)


EDIT: changed WinDlls and removed StrGet in InternetTimeToSystemTime
_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun Wink
Back to top
View user's profile Send private message
bell-e



Joined: 09 May 2011
Posts: 5
Location: Palmdale

PostPosted: Fri May 13, 2011 7:34 am    Post subject: Reply with quote

I love autohotkey and made some small scripts already for working faster in windows. Can I use this script with my web host too? I'm relative new to the whole webbing thing and I don't wanna pay for a ftp program.
Back to top
View user's profile Send private message
sumon



Joined: 18 May 2010
Posts: 1011
Location: Sweden

PostPosted: Fri May 13, 2011 10:36 am    Post subject: Reply with quote

bell-e wrote:
I love autohotkey and made some small scripts already for working faster in windows. Can I use this script with my web host too? I'm relative new to the whole webbing thing and I don't wanna pay for a ftp program.


If your webhost supports FTP access (which most do, since you need a way to put files there...), you can use this program or any other FTP program to connect to your webhost space, of course Smile

As for paying, I use FileZilla which is also free. But you can probably use this script too (I haven't tried it)
Back to top
View user's profile Send private message Visit poster's website
specter333



Joined: 15 Jan 2007
Posts: 526

PostPosted: Tue May 17, 2011 5:50 pm    Post subject: Reply with quote

This is an amazing project. I was going to search the forums for FTP information the other day but when I looked at the Scripts & Functions page this was at the top.

One thing I need to be able to do that I haven't figured out is when connecting I need to start in a specific folder, not the root folder which is selected during log in. Is there a way to do that when logging in?

For example when logging into AHK.net it starts in this folder,
Code:
autohotkey.net/xfm/list/


and I need to start in this folder.
Code:
autohotkey.net/xfm/list/?d=StartFolder
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group