📜 ⬆️ ⬇️

Mac Maniac. DropCopy for Windows

Do you remember the post about the extraction of devices and carriers in Mac ? So, that cute Eject has a friend - DropCopy:

Introduction


When I worked on Macs, I simply enjoyed the ease of transferring files between computers on a network using DropCopy. You throw files into a black hole, choose from the drop-down list where to send, and these same files appear on the recipient's desktop. Great! But it has been 2 years since my dismissal, and there has been a bit of a break-down on poppies (especially in Final Cut Pro * I shed a tear *). In the room next door the brother is sitting at his computer, I am at my own, there is still a laptop that everyone uses in turn and there is always a problem when you need to transfer a file from one computer to another. What we did not get up:

It is worth noting an important point - General Microsoft Network Documents might have helped in this situation, but they have been turned off for a long time and so thoroughly that I don’t know how to turn them back on, I don’t want to remember, so I started to dig the other way and the result was (in my opinion) much better. So for those who have this thing functioning, I think it makes no sense to read further.

Products for cooking


To perform we need:

Machine preparation



Iis


Further work is dull and monotonous: On all machines it is necessary to put an FTP server. Considering that I don’t like to install many additional programs, I decided to rummage through Windows and found IIS. It has holes (I don’t know how new versions are, but the old ones did), but since my mini network is protected by a router, I sleep well, and I don’t have any paranoia “someone wants to hack me”, who do you need me? Therefore, first go through this path:
Control Panel \ Add or Remove Programs \ Windows Components

Put a tick in front of IIS and click Details

It is logical that we need FTP from this list. Next will be the installation and the first problem - perhaps it will require that you insert the disk from where you installed your Windows. Since I put my Windows 2 years ago - I already forgot where it lies, but I still found the disk, But I think if I search the Internet, I can find a link to download this component without these adventures. Mentally transfer to the future, where you still managed to put it. We go further
Start \ Administration \ Internet Information Services (what? You don’t have the Administration item? Uzhos! Forgive me the IT gurus that I do the work of Captain Obvious: Right-click on the Start \ Properties \ Start Menu \ Configure \ Advanced \ Administration - Display in the menu "All programs" and "start" )
I got distracted. Next, select:

and right-click on our default FTP site \ Properties.

This is the most insecure part, because it is not recommended to use
anonymous connections, but I have nothing to fear, as I said. Of course, you can create a user with a password instead of an anonymus, but I haven’t mastered it and I don’t need it, because I have only one user on my computer - an admin without a password, and IIS swears without a password.

Here the main point is the path of the home directory. You must specify the desktop. I do not know whether it will work with the ticked ticked Reading, so I left it just in case.

The main problem is that the Desktop is protected by root, and the user IUSR_USRERNAME does not have privileges on this folder, so you need to rotate the thing for which the severe bearded admins will crucify me - you need to move the user IUSR_USRERNAME to the Administrators group. Therefore: Start \ Administration \ Computer Management \


This should work, at your own peril and risk) But this is the path of an extremal, then an easy and safe path

Quick`n`Easy FTP Server


I have this program on my main computer. Of course, it may not be very functional, but I have enough of what it offers. I have it for a long time and I do not even remember where I found it. Link Here I just created a new user Tr with a plain password and indicated his Home Directory as the Desktop. Ticks put to taste, but so that everything works)

And this principle is all that needs to be done in this program. It makes sense to throw its shortcut into autoload (it loads quickly and silently). Now the main part is:
')

Implementation


First, check your firewalls and let this stream flow without obstructions. Well now we are writing the code in the AutoHotKey language (I hope that with my explanations you can write it in any other language better, and if without my explanations, it's even better :-) At first the program was very simple, small and could only send a few pieces of files with names that do not contain spaces (one input path that contains two spaces, turned it into 3 input parameters that have no meaning). But then the program began to overgrow with functionality, learned how to flip folders, nothing at all, and now it even has a progress bar.

Like the previous post, on the desktop is a shortcut to this program, and when we transfer files to it, it wakes up, reads the list of computers from config.ini and shows the menu:

Our program will not delve into the subtleties of sockets and other problems. she will still trust FTP.exe. The logic with FTP.exe in our case is simple. we write a script file based on the transferred files and at the end simply call ftp.exe with the following parameters:
ftp.exe -s: "C: \ Script File.txt"> "C: \ Log File"
The script file looks like this:
open 172.31.0.3
anonymous
slau.andre@gmail.com
binary
mkdir "ftp"
cd "ftp"
put "C:\DOCUME~1\Kefir\0016~1\ftp\1.png"
put "C:\DOCUME~1\Kefir\0016~1\ftp\2.png"
put "C:\DOCUME~1\Kefir\0016~1\ftp\9.jpg"
put "C:\DOCUME~1\Kefir\0016~1\ftp\PrScr.jpg"
mkdir ""
cd ""
put "C:\DOCUME~1\Kefir\0016~1\ftp\\config.ini"
put "C:\DOCUME~1\Kefir\0016~1\ftp\\DropFile.ahk"
put "C:\DOCUME~1\Kefir\0016~1\ftp\\DropFile.exe"
put "C:\DOCUME~1\Kefir\0016~1\ftp\\Quick'n Easy FTP Server v2.7.1 setup.exe"
cd ..
cd ..
quit


Config.ini is as follows:
(.ini is just that the order was in the program folder, although the file itself has nothing to do with .ini)
Borw|172.31.0.3|Username|MyPassword
Nout|172.31.0.4|anonymous|slau.andre@gmail.com

It is worth noting that passwords with | doomed to failure ;-)

Well, let's get started:

 ;       - .   \   #NoTrayIcon #NoEnv SendMode Input SetWorkingDir %A_ScriptDir% curr=%1% ; ,    if curr= ExitApp FTPCommandFile = %A_ScriptDir%\FTPCommands.txt ;   FTPLogFile = %A_ScriptDir%\FTPLog.txt ;  countf:=0 TSize:=0 FileDelete %FTPCommandFile% ;   FileDelete %FTPLogFile% ;   FileRead, conf, %A_ScriptDir%\config.ini ;    conf n:=0 Loop, parse, conf,`n ;     conf { i:=0 Loop, Parse, A_LoopField, | ;   | { ;      con%n%%i% = %A_LoopField% ;   i++ } name:=con%n%0 ;    . Menu, PopUp, Add, %name%, Who ;Who -    n++ ; } i:=0 n:=0 Menu, PopUp, Show ;    . ;      ;  ,    ;      return Who: { item:=A_THISMENUITEMPOS-1 addr:=con%item%1 login:=con%item%2 pass:=con%item%3 FileAppend, open %addr%`n, %FTPCommandFile% ;     ;    FileAppend, %login%`n, %FTPCommandFile% ; FileAppend, %pass%`n, %FTPCommandFile% GoSub, Go ;    return } go: ;    { ;     FileAppend, binary`n, %FTPCommandFile% ;   prev= ToolTip  ... Loop ;    { ;   ;   ;    ;  ,  ;   curr:=%A_Index% if not prev { prev=%curr% continue } if(!InStr(curr, ":\") and (curr!="")) { ;    ":\"? prev=%prev%%A_Space%%curr% ; continue } FileGetAttrib, Attributes, %prev% IfInString, Attributes, D ;  ,    ;  GenFold(prev,FTPCommandFile,countf,TSize) else { ; ,    ;  FileAppend, put "%prev%"`n, %FTPCommandFile% FileGetSize, dsize, %prev% TSize += %dsize% ;     ;   countf++ ;   } if curr = break prev=%curr% } FileAppend, quit, %FTPCommandFile% ;     SetFormat, float, 6.1 TSize:=TSize/(1024*1024) ToolTIp  ftp.exe... ; ftp.exe Run %comspec% /c ftp.exe -s:"%FTPCommandFile%" >"%FTPLogFile%", ,Hide ToolTip ;   ftp     ,      ;========================================================;  CustomColor = 666666 Gui, -Resize +LastFound +ToolWindow -Caption +AlwaysOnTop Gui, Color, %CustomColor% ;cFF9966 -      Gui, Add, Progress, x0 y0 w132 h15 cFF9966 Background666666 vMyProgLoadi GuiControl, , MyProgLoadi, 0 Gui, Font, S7 c111111, Tahoma Gui, Add, Text, vMyMemLoadi BackGroundTrans x2 y2 w100 h15, 0/%Tsize% Gui, Show, h15 w132, MyProgLoadi ;=========================================================================== countf2:=0 TSize2:=0 maybeexit:=0 Loop ;   ftp.exe,       { Process, Exist, ftp.exe if(ErrorLevel = 0) { maybeexit++ if(maybeexit>10) ;   5  { MsgBox - ftp.exe   `n  . ExitApp } Sleep 500 continue } break } Loop ;      250    { ;    Process, Exist, ftp.exe if((ErrorLevel = 0) or (countf2 >= countf)) ;    { ;   ftp.exe  Gui, Destroy FileRead, mfile, %FTPLogFile% IfNotInString,mfile,logged in ;ftp.exe   - { ;,     MsgBox, 36, ,   .`n ? IfMsgBox, Yes Run, "%FTPLogFile%" break } SetFormat, float, 6.1 ToolTIp : %countf%`n: %TSize%  ;ToolTip   ;  ,  Tooltip ; MsgBox Sleep 2000 ToolTip break } countf2:=0 TSize2:=0 FileRead, mfile, %FTPLogFile% Loop, Parse, mfile,`n ;     { ;   If(InStr(A_LoopField, "ftp: ")) { countf2++ dsize2:=SubStr(A_LoopField, 6, InStr(A_LoopField," ", 0, 6)-1) TSize2 += %dsize2% } } GuiControl, 1: , MyProgLoadi, % (countf2*100)/countf ;  SetFormat, float, 6.1 TSize2:=TSize2/(1024*1024) GuiControl,Text , MyMemLoadi, %TSize2%/%TSize%  Sleep 250 } ExitApp return } GenFold(path,FTPCommandFile,ByRef countf,ByRef TSize) { ;     fold:=SubStr(path,InStr(path,"\",0,0)+1) ;      ;       ;       ; -   ( ) FileAppend, mkdir "%fold%"`n, %FTPCommandFile% FileAppend, cd "%fold%"`n, %FTPCommandFile% Loop, %path%\*, 1, 0 { FileGetAttrib, Attributes, %A_LOOPFILEFULLPATH% IfInString, Attributes, D ;,   GenFold(A_LOOPFILEFULLPATH,FTPCommandFile,countf,TSize) else { FileAppend, put "%A_LOOPFILEFULLPATH%"`n, %FTPCommandFile% TSize += %A_LoopFileSize% countf++ } } FileAppend, cd ..`n, %FTPCommandFile% return } 
; - . \ #NoTrayIcon #NoEnv SendMode Input SetWorkingDir %A_ScriptDir% curr=%1% ; , if curr= ExitApp FTPCommandFile = %A_ScriptDir%\FTPCommands.txt ; FTPLogFile = %A_ScriptDir%\FTPLog.txt ; countf:=0 TSize:=0 FileDelete %FTPCommandFile% ; FileDelete %FTPLogFile% ; FileRead, conf, %A_ScriptDir%\config.ini ; conf n:=0 Loop, parse, conf,`n ; conf { i:=0 Loop, Parse, A_LoopField, | ; | { ; con%n%%i% = %A_LoopField% ; i++ } name:=con%n%0 ; . Menu, PopUp, Add, %name%, Who ;Who - n++ ; } i:=0 n:=0 Menu, PopUp, Show ; . ; ; , ; return Who: { item:=A_THISMENUITEMPOS-1 addr:=con%item%1 login:=con%item%2 pass:=con%item%3 FileAppend, open %addr%`n, %FTPCommandFile% ; ; FileAppend, %login%`n, %FTPCommandFile% ; FileAppend, %pass%`n, %FTPCommandFile% GoSub, Go ; return } go: ; { ; FileAppend, binary`n, %FTPCommandFile% ; prev= ToolTip ... Loop ; { ; ; ; ; , ; curr:=%A_Index% if not prev { prev=%curr% continue } if(!InStr(curr, ":\") and (curr!="")) { ; ":\"? prev=%prev%%A_Space%%curr% ; continue } FileGetAttrib, Attributes, %prev% IfInString, Attributes, D ; , ; GenFold(prev,FTPCommandFile,countf,TSize) else { ; , ; FileAppend, put "%prev%"`n, %FTPCommandFile% FileGetSize, dsize, %prev% TSize += %dsize% ; ; countf++ ; } if curr = break prev=%curr% } FileAppend, quit, %FTPCommandFile% ; SetFormat, float, 6.1 TSize:=TSize/(1024*1024) ToolTIp ftp.exe... ; ftp.exe Run %comspec% /c ftp.exe -s:"%FTPCommandFile%" >"%FTPLogFile%", ,Hide ToolTip ; ftp , ;========================================================; CustomColor = 666666 Gui, -Resize +LastFound +ToolWindow -Caption +AlwaysOnTop Gui, Color, %CustomColor% ;cFF9966 - Gui, Add, Progress, x0 y0 w132 h15 cFF9966 Background666666 vMyProgLoadi GuiControl, , MyProgLoadi, 0 Gui, Font, S7 c111111, Tahoma Gui, Add, Text, vMyMemLoadi BackGroundTrans x2 y2 w100 h15, 0/%Tsize% Gui, Show, h15 w132, MyProgLoadi ;=========================================================================== countf2:=0 TSize2:=0 maybeexit:=0 Loop ; ftp.exe, { Process, Exist, ftp.exe if(ErrorLevel = 0) { maybeexit++ if(maybeexit>10) ; 5 { MsgBox - ftp.exe `n . ExitApp } Sleep 500 continue } break } Loop ; 250 { ; Process, Exist, ftp.exe if((ErrorLevel = 0) or (countf2 >= countf)) ; { ; ftp.exe Gui, Destroy FileRead, mfile, %FTPLogFile% IfNotInString,mfile,logged in ;ftp.exe - { ;, MsgBox, 36, , .`n ? IfMsgBox, Yes Run, "%FTPLogFile%" break } SetFormat, float, 6.1 ToolTIp : %countf%`n: %TSize% ;ToolTip ; , Tooltip ; MsgBox Sleep 2000 ToolTip break } countf2:=0 TSize2:=0 FileRead, mfile, %FTPLogFile% Loop, Parse, mfile,`n ; { ; If(InStr(A_LoopField, "ftp: ")) { countf2++ dsize2:=SubStr(A_LoopField, 6, InStr(A_LoopField," ", 0, 6)-1) TSize2 += %dsize2% } } GuiControl, 1: , MyProgLoadi, % (countf2*100)/countf ; SetFormat, float, 6.1 TSize2:=TSize2/(1024*1024) GuiControl,Text , MyMemLoadi, %TSize2%/%TSize% Sleep 250 } ExitApp return } GenFold(path,FTPCommandFile,ByRef countf,ByRef TSize) { ; fold:=SubStr(path,InStr(path,"\",0,0)+1) ; ; ; ; - ( ) FileAppend, mkdir "%fold%"`n, %FTPCommandFile% FileAppend, cd "%fold%"`n, %FTPCommandFile% Loop, %path%\*, 1, 0 { FileGetAttrib, Attributes, %A_LOOPFILEFULLPATH% IfInString, Attributes, D ;, GenFold(A_LOOPFILEFULLPATH,FTPCommandFile,countf,TSize) else { FileAppend, put "%A_LOOPFILEFULLPATH%"`n, %FTPCommandFile% TSize += %A_LoopFileSize% countf++ } } FileAppend, cd ..`n, %FTPCommandFile% return }

It should be noted that if there are two spaces in the file path one by one, then the program is powerless.

Code, exe, icon here

Conclusion


Well, it turned out even more than necessary, because, you can transfer files between computers not only in one local network but also between remote computers with a direct IP address.
ps: if someone liked the wallpaper, then here I laid them out ;-)
pps: for dictations in the Russian language I have always had a stable 2, so do not scold too much for errors

Source: https://habr.com/ru/post/57139/


All Articles