by garry » 18 May 2021, 09:09
EDIT 20210520 : 2nd logfile Zusammenfassung nur "Neue Datei / Neuer / Neues Verz."
vielen Dank für eure Hilfe
Hier ein Beispiel mit GUI , auch ohne robocopy-Logfile-Befehl ( logfile mit CMDRET )
EDIT = dies entfernt >> unten kann man noch DOS Befehle eingeben
teadrinker's CMDRET zeigt alles richtig an , auch chinesische Characters
2nd logfile Zusammenfassung nur "Neue Datei / Neuer / Neues Verz." ( Beispiel für 2 Folder )
Code: Select all
================================
Gestartet: Donnerstag, 20. Mai 2021 11:49:48
Quelle : D:\M_YVONNE\
Ziel : F:\_BEELINK\M_YVONNE\
--------------------------
Neue Datei 7468 2021/03/07 15:13:00 D:\M_YVONNE\多线程系统代理下载tube1080p视频_20210307161303.ahk
--------------------------
Insgesamt Kopiert Skipped No match FEHLER Extras
Verzeich.: 109 0 109 0 0 39
Dateien: 1457 1 1456 0 0 117
Bytes: 4.443 g 7.2 k 4.443 g 0 0 1020.71 m
Zeiten: 0:00:00 0:00:00 0:00:00 0:00:00
Geschwindigkeit: 240903 Bytes/Sek.
Geschwindigkeit: 13.784 Megabytes/Min.
Beendet: Donnerstag, 20. Mai 2021 11:49:49
================================ ENDXX ================================
================================
Gestartet: Donnerstag, 20. Mai 2021 11:49:51
Quelle : C:\users\garry\desktop\
Ziel : F:\_BEELINK\DESKTOP\
--------------------------
Neuer 12422 2021/05/20 09:49:18 C:\users\garry\desktop\FAV_TEST\ROBOCOPY\Robocopy_TEST_09.ahk
Neue Datei 81895 2021/05/20 09:46:51 C:\users\garry\desktop\ROBOCOPY_LOG\20210520114651_Robocopy_Log_cmdret.txt
Neue Datei 1819 2021/05/20 09:46:52 C:\users\garry\desktop\ROBOCOPY_LOG\20210520114652_Robocopy_New.txt
--------------------------
Insgesamt Kopiert Skipped No match FEHLER Extras
Verzeich.: 260 0 260 0 0 52
Dateien: 3119 3 3116 0 0 336
Bytes: 996.06 m 93.8 k 995.97 m 0 0 2.128 g
Zeiten: 0:00:00 0:00:00 0:00:00 0:00:00
Geschwindigkeit: 3101161 Bytes/Sek.
Geschwindigkeit: 177.449 Megabytes/Min.
Beendet: Donnerstag, 20. Mai 2021 11:49:52
================================ ENDXX ================================
Ich habe am Kleinstcomputer 2 Laufwerke, C:\ und D:\ , beim Anschliessen eines Harddisks an USB soll es auf Laufwerk E:\ bzw. x-beliebig der nächste HD , z.B. auf Harddisk Q:\ kopieren
Hier ein Beispiel um 2 Ordner zu kopieren , es wird angezeigt was kopiert werden soll und welcher Ordner grad kopiert wird
EDIT : erstellt 2 logfiles : alles / nur Neue / geänderte
Code: Select all
;============ ROBOCOPY ==============================================
;MODIFIED = 20210520
;CREATED = 20210401
;- example robocopy for computer with 2 drives C:\ and D:\ >> copy to followed drive 'X'
;- changes =
;- logfile wird durch CMDRET ( from user teadrinker ) erstellt
;- 2nd logfile nur für "Neue Datei/Neuer/Neues Verz."
;====================================================================
;#warn
#Noenv
Setworkingdir,%a_scriptdir%
;----------------------------
gosub,drivegetshow
;----------------------------
;----------------------------
total:=2
;-------------- example copy 2 folders to next drive X ----------------
source1=%a_desktop%\TEST2 ; C:\users\garry\desktop\TEST2
dest1 =%last%_BEELINK\DESKTOP\TEST2 ; E:\_BEELINK\DESKTOP\TEST2 ( lastdrive example E:\ or another drive letter after C:\ and D:\ )
;--------
source2=%seclast%M_GARRY\GAMES ;- D:\M_GARRY\GAMES
dest2 =%last%_BEELINK\M_GARRY\GAMES ;- E:\_BEELINK\M_GARRY\GAMES
;-----------------------------------------------------------------------
alldest=%source1% >> %dest1%`n%source2% >> %dest2%`n
;========================================================================
fd1=%a_desktop%\ROBOCOPY_LOG
ifnotexist,%fd1%
filecreatedir,%fd1%
;----------------------------
;============== GUI ===========
name1:="DOS_TEST"
global name1
e:=""
cpx:="cp65001"
Gui,1:default
Gui,1: -DPIScale
Gui,1:Color,Black,Black
wa:=A_screenwidth,ha:=A_screenHeight,xx:=100
;- maybe change fontsize
;============ GUISIZEx DPIx 4Kx 3840*2160 is 100% ============
if (wa=3840)
Gui,1:Font,s12 cYellow,Lucida Console
;============ GUISIZEx DPIx FHD 1920*1080 is 100% ============
else if (wa=1920)
Gui,1:Font,s10 cYellow,Lucida Console
else
Gui,1:Font,s8 cYellow,Lucida Console
;=============================================================
;------------------------------------------------------------
x:=(wa*1)/xx,y:=(ha*1)/xx, w:=(wa*18)/xx,h:=(ha*8)/xx
Gui, Add, Edit, x%x% y%y% w%w% h%h% vE1 readonly ,%alldrives% ;- show All_Drives
;------------------------------------------------------------
x:=(wa*20)/xx,y:=(ha*1)/xx, w:=(wa*40)/xx,h:=(ha*10)/xx
Gui, Add, Edit, x%x% y%y% w%w% h%h% vE2 ,%alldest%
;------------------------------------------------------------
x:=(wa*61)/xx,y:=(ha*1)/xx, w:=(wa*7)/xx,h:=(ha*2.3)/xx
Gui, Add, Button, x%x% y%y% w%w% h%h% vRunx gRunCopy,RUN-COPY ;- RUN-ROBOCOPY
;------------------------------------------------------------
x:=(wa*61)/xx,y:=(ha*4.1)/xx,w:=(wa*7)/xx,h:=(ha*2.3)/xx
Gui, add, Edit, x%x% y%y% w%w% h%h% vED3 readonly, ;- message running /ENDED
;------------------------------------------------------------
;x:=(wa*61)/xx,y:=(ha*7)/xx,w:=(wa*5)/xx,h:=(ha*2.3)/xx
;Gui,add,button, x%x% y%y% w%w% h%h% gPrintx, PRINT ;- PRINT
;------------------------------------------------------------
;x:=(wa*67)/xx,y:=(ha*7)/xx,w:=(wa*5)/xx,h:=(ha*2.3)/xx
;Gui,add,button, x%x% y%y% w%w% h%h% gPrintNew, PRINT_NEW ;- PRINT NEW
;------------------------------------------------------------
x:=(wa*1)/xx,y:=(ha*12)/xx, w:=(wa*72)/xx,h:=(ha*10)/xx
Gui, Add, Edit, x%x% y%y% w%w% h%h% vED0 readonly ;- which folder is already copied
;------------------------------------------------------------
x:=(wa*1)/xx,y:=(ha*22.5)/xx,w:=(wa*72)/xx,h:=(ha*70)/xx
Gui, Add, Edit, x%x% y%y% w%w% h%h% vED1 readonly +0x0400 ;- here the output
;------------------------------------------------------------
Gui,add,text,x0 y0 w0 h0 vTextdummy
x:=(wa*.1)/xx,y:=(ha*.1)/xx,w:=(wa*75)/xx,h:=(ha*95)/xx
Gui, Show,x%x% y%y% w%w% h%h%,%name1%
;------------------------------------------------------------
GuiControl,1: Focus,textdummy
return
;-------------------------
Guiclose:
Exitapp
esc::exitapp
;-------------------------
;==========================================================
RUNCOPY:
;- UMLAUT and chinese characters OK
Gui,1:submit,nohide
;---------------------------
;- beelink must have at least DRIVE >D
if ((vt>2) and (type1="Removable" or type1="Fixed")) ;- if more then 2 drives & lastDrive is removable/ or fixed ( maybe USB-stick )
{
msgbox, 262436,COPY-%seclast% to %last% ,%alldrives%`n-------------`nWant you COPY =`n%alldest% ?
IfMsgBox,No
return
e:=""
enew:=""
e2:=""
Guicontrol,1:,ED0
Guicontrol,1:,ED1
Guicontrol,1:,ED3,running...
;--------- for TEST robocopy logfile : --------
logfile2 =%fd1%\%a_now%_Robocopy_Log.txt
excludex2=%logfile2%
;----------------------------------------------
;-----------
loop,%total%
{
guicontrolget,ed0
src:=% source%a_index%
dst:=% dest%a_index%
e2:=ed0 . "`n" . src . ">>>" . dst
Guicontrol,1:,ED0,%e2%
sleep,100
GuiControl,1: Focus,ED0
send,^{end}
sleep,100
;---------------------
;cmdx=chcp 65001&robocopy "%src%" "%dst%" /XO /E /TEE /NP /UNICODE /UNILOG+:%logfile2% /XD %excludex2%
cmdx=chcp 65001&robocopy "%src%" "%dst%" /XO /E /TEE /NP /UNICODE /FP /TS
;----------------------
ed2a:="cmd /c " . cmdx
xxc:=cmdret(ED2a,,CPX)
sleep,400
e .="`r`n=========================== START ===================================`r`n" . cmdx . " =`r`n-------------------------------`r`n" . xxc . "`r`n================================ ENDXX ================================`r`n"
sleep,100
Guicontrol,1:,ED1,%e%
sleep,100
GuiControl,1: Focus,ED1
send,^{end}
}
Guicontrol,1:,ED3,ENDED
gosub,printx
sleep,1000
gosub,printnew
}
return
;===================================================================
;-------------------------
printnew:
f11=%fd1%\%a_now%_Robocopy_New.txt
Gui,1:submit,nohide
i=0
z=0
if e<>
{
Loop,parse,e,`n,`r
{
x:=a_loopfield
if x=
continue
i++
;-----------------------------------------------------
if x contains Gestartet
{
enew .= "================================`r`n"
z=1
I=0
}
if (z=1)
{
enew .= x . "`r`n"
if (i=2)
{
z=0
enew .= "--------------------------`r`n"
}
}
;------------------------------------------------------
if x contains Insgesamt
{
enew .= "--------------------------`r`n"
K=1
}
if (K=1)
{
enew .= x . "`r`n"
if x contains ENDXX
K=0
}
;----------------------------------------------------
stringmid,xx,x,1,29
if (xx ~= "Neuer|Neue Datei|Neues Verz")
enew .= x . "`r`n"
}
xxa:=" Skipped"
xxb:=" No match"
stringreplace,enew,enew,Übersprungen ,%xxa%,all
stringreplace,enew,enew,Keine Übereinstimmung ,%xxb%,all
if enew<>
{
fileappend,%enew%,%f11%,utf-8
try
run,%f11%
enew:=""
}
else
msgbox, 262208,COPY-NEW ,File not created because not found text=`nNeuer|Neue Datei|Neues Verz
}
return
;---------------------------
/*
================================
Gestartet: Donnerstag, 20. Mai 2021 11:49:48
Quelle : D:\M_YVONNE\
Ziel : F:\_BEELINK\M_YVONNE\
--------------------------
Neue Datei 7468 2021/03/07 15:13:00 D:\M_YVONNE\多线程系统代理下载tube1080p视频_20210307161303.ahk
--------------------------
Insgesamt Kopiert Skipped No match FEHLER Extras
Verzeich.: 109 0 109 0 0 39
Dateien: 1457 1 1456 0 0 117
Bytes: 4.443 g 7.2 k 4.443 g 0 0 1020.71 m
Zeiten: 0:00:00 0:00:00 0:00:00 0:00:00
Geschwindigkeit: 240903 Bytes/Sek.
Geschwindigkeit: 13.784 Megabytes/Min.
Beendet: Donnerstag, 20. Mai 2021 11:49:49
================================ ENDXX ================================
================================
Gestartet: Donnerstag, 20. Mai 2021 11:49:51
Quelle : C:\users\garry\desktop\
Ziel : F:\_BEELINK\DESKTOP\
--------------------------
Neuer 12422 2021/05/20 09:49:18 C:\users\garry\desktop\FAV_TEST\ROBOCOPY\Robocopy_TEST_09.ahk
Neue Datei 81895 2021/05/20 09:46:51 C:\users\garry\desktop\ROBOCOPY_LOG\20210520114651_Robocopy_Log_cmdret.txt
Neue Datei 1819 2021/05/20 09:46:52 C:\users\garry\desktop\ROBOCOPY_LOG\20210520114652_Robocopy_New.txt
--------------------------
Insgesamt Kopiert Skipped No match FEHLER Extras
Verzeich.: 260 0 260 0 0 52
Dateien: 3119 3 3116 0 0 336
Bytes: 996.06 m 93.8 k 995.97 m 0 0 2.128 g
Zeiten: 0:00:00 0:00:00 0:00:00 0:00:00
Geschwindigkeit: 3101161 Bytes/Sek.
Geschwindigkeit: 177.449 Megabytes/Min.
Beendet: Donnerstag, 20. Mai 2021 11:49:52
================================ ENDXX ================================
*/
;--------------------------
printx:
Gui,1:submit,nohide
logfile1 =%fd1%\%a_now%_Robocopy_Log_cmdret.txt
if e<>
{
e:=Trim(RegExReplace(e, "`am)^(?!.*[[:alnum:]]).*\R+"), "`r`n")
fileappend,%e%,%logfile1%,UTF-8
try
run,%logfile1%
;e:=""
}
return
;==========================
;--------------------------------------------------------------------------------------------------------
drivegetshow:
i=0
alldrives:=""
DriveGet, A, List,
StringSplit,D, A,
loop,%d0%
{
DRV:= % d%a_index% . ":\"
i++
DriveGet , type1 , type , %DRV% ;- removable / fixed
DriveGet , cap1 , capacity , %DRV%
DrivespaceFree , free1 , %DRV%
DriveGet , fs1 , fs , %DRV% ;- FAT
DriveGet , label1 , label , %DRV% ;- volume label >\\server1
DriveGet , serial1 , serial , %DRV% ;- volume serial number
DriveGet , status1 , status , %DRV%
alldrives .= drv . " " . type1 . " FREE=" . free1 . "-MB`n"
;msgbox, 262208,Drive-Info_%i% ,%DRV% %type1% %label1% %fs1% %cap1%-MB %free1%-MB %status1%
}
stringtrimright,alldrives,alldrives,1
VT:=D0 ;- totaldrives
VL:=(D0-1) ;- totaldrives-1
last = %drv%
if (VT>2)
{
loop,%vl%
seclast := % d%a_index% . ":\"
Guicontrol,1:,ED1,%alldrives%
;msgbox, 262208,Info ,Alldrives=`n%alldrives%
}
else
{
msgbox, 262208,ERROR-SAVE ,You need more than 2 drives for robocopy (computer BEELINK)`n`nAlldrives=`n%alldrives%
exitapp
}
return
;---------------------------------------------------------------------------------------------
;================= function from user teadrinker ========================================
;- https://www.autohotkey.com/boards/viewtopic.php?p=369467#p369467
CmdRet(sCmd, callBackFuncObj := "", encoding := "CP0")
{
static HANDLE_FLAG_INHERIT := 0x00000001, flags := HANDLE_FLAG_INHERIT
, STARTF_USESTDHANDLES := 0x100, CREATE_NO_WINDOW := 0x08000000
hPipeRead:=""
hPipeWrite:=""
sOutput:=""
DllCall("CreatePipe", "PtrP", hPipeRead, "PtrP", hPipeWrite, "Ptr", 0, "UInt", 0)
DllCall("SetHandleInformation", "Ptr", hPipeWrite, "UInt", flags, "UInt", HANDLE_FLAG_INHERIT)
VarSetCapacity(STARTUPINFO , siSize := A_PtrSize*4 + 4*8 + A_PtrSize*5, 0)
NumPut(siSize , STARTUPINFO)
NumPut(STARTF_USESTDHANDLES, STARTUPINFO, A_PtrSize*4 + 4*7)
NumPut(hPipeWrite , STARTUPINFO, A_PtrSize*4 + 4*8 + A_PtrSize*3)
NumPut(hPipeWrite , STARTUPINFO, A_PtrSize*4 + 4*8 + A_PtrSize*4)
VarSetCapacity(PROCESS_INFORMATION, A_PtrSize*2 + 4*2, 0)
if !DllCall("CreateProcess", "Ptr", 0, "Str", sCmd, "Ptr", 0, "Ptr", 0, "UInt", true, "UInt", CREATE_NO_WINDOW
, "Ptr", 0, "Ptr", 0, "Ptr", &STARTUPINFO, "Ptr", &PROCESS_INFORMATION)
{
DllCall("CloseHandle", "Ptr", hPipeRead)
DllCall("CloseHandle", "Ptr", hPipeWrite)
throw Exception("CreateProcess is failed")
}
DllCall("CloseHandle", "Ptr", hPipeWrite)
VarSetCapacity(sTemp, 4096), nSize := 0
while DllCall("ReadFile", "Ptr", hPipeRead, "Ptr", &sTemp, "UInt", 4096, "UIntP", nSize, "UInt", 0) {
sOutput .= stdOut := StrGet(&sTemp, nSize, encoding)
;sOutput .= stdOut := StrGet(&sTemp, nSize)
;sOutput .= stdOut := StrGet(&sTemp, nSize, CPX)
( callBackFuncObj && callBackFuncObj.Call(stdOut) )
}
DllCall("CloseHandle", "Ptr", NumGet(PROCESS_INFORMATION))
DllCall("CloseHandle", "Ptr", NumGet(PROCESS_INFORMATION, A_PtrSize))
DllCall("CloseHandle", "Ptr", hPipeRead)
Return sOutput
}
;================= END SCRIPT ========================================================================
;===================== NOTICE ========================================================================
/*
;- https://www.autohotkey.com/boards/viewtopic.php?f=9&t=90409
;- https://www.autohotkey.com/boards/viewtopic.php?f=10&t=71336
;- https://www.wintotal.de/download/yarcgui/
;- https://www.tecchannel.de/a/robocopy-daten-schnell-und-einfach-unter-windows-sichern,2033515
*/
;=====================================================================================================
EDIT 20210520 : 2nd logfile Zusammenfassung nur "Neue Datei / Neuer / Neues Verz."
vielen Dank für eure Hilfe
Hier ein Beispiel mit GUI , auch ohne robocopy-Logfile-Befehl ( logfile mit CMDRET )
EDIT = dies entfernt >> unten kann man noch DOS Befehle eingeben
teadrinker's CMDRET zeigt alles richtig an , auch chinesische Characters
2nd logfile Zusammenfassung nur "Neue Datei / Neuer / Neues Verz." ( Beispiel für 2 Folder )
[code]
================================
Gestartet: Donnerstag, 20. Mai 2021 11:49:48
Quelle : D:\M_YVONNE\
Ziel : F:\_BEELINK\M_YVONNE\
--------------------------
Neue Datei 7468 2021/03/07 15:13:00 D:\M_YVONNE\多线程系统代理下载tube1080p视频_20210307161303.ahk
--------------------------
Insgesamt Kopiert Skipped No match FEHLER Extras
Verzeich.: 109 0 109 0 0 39
Dateien: 1457 1 1456 0 0 117
Bytes: 4.443 g 7.2 k 4.443 g 0 0 1020.71 m
Zeiten: 0:00:00 0:00:00 0:00:00 0:00:00
Geschwindigkeit: 240903 Bytes/Sek.
Geschwindigkeit: 13.784 Megabytes/Min.
Beendet: Donnerstag, 20. Mai 2021 11:49:49
================================ ENDXX ================================
================================
Gestartet: Donnerstag, 20. Mai 2021 11:49:51
Quelle : C:\users\garry\desktop\
Ziel : F:\_BEELINK\DESKTOP\
--------------------------
Neuer 12422 2021/05/20 09:49:18 C:\users\garry\desktop\FAV_TEST\ROBOCOPY\Robocopy_TEST_09.ahk
Neue Datei 81895 2021/05/20 09:46:51 C:\users\garry\desktop\ROBOCOPY_LOG\20210520114651_Robocopy_Log_cmdret.txt
Neue Datei 1819 2021/05/20 09:46:52 C:\users\garry\desktop\ROBOCOPY_LOG\20210520114652_Robocopy_New.txt
--------------------------
Insgesamt Kopiert Skipped No match FEHLER Extras
Verzeich.: 260 0 260 0 0 52
Dateien: 3119 3 3116 0 0 336
Bytes: 996.06 m 93.8 k 995.97 m 0 0 2.128 g
Zeiten: 0:00:00 0:00:00 0:00:00 0:00:00
Geschwindigkeit: 3101161 Bytes/Sek.
Geschwindigkeit: 177.449 Megabytes/Min.
Beendet: Donnerstag, 20. Mai 2021 11:49:52
================================ ENDXX ================================
[/code]
Ich habe am Kleinstcomputer 2 Laufwerke, C:\ und D:\ , beim Anschliessen eines Harddisks an USB soll es auf Laufwerk E:\ bzw. x-beliebig der nächste HD , z.B. auf Harddisk Q:\ kopieren
Hier ein Beispiel um 2 Ordner zu kopieren , es wird angezeigt was kopiert werden soll und welcher Ordner grad kopiert wird
EDIT : erstellt 2 logfiles : alles / nur Neue / geänderte
[code]
;============ ROBOCOPY ==============================================
;MODIFIED = 20210520
;CREATED = 20210401
;- example robocopy for computer with 2 drives C:\ and D:\ >> copy to followed drive 'X'
;- changes =
;- logfile wird durch CMDRET ( from user teadrinker ) erstellt
;- 2nd logfile nur für "Neue Datei/Neuer/Neues Verz."
;====================================================================
;#warn
#Noenv
Setworkingdir,%a_scriptdir%
;----------------------------
gosub,drivegetshow
;----------------------------
;----------------------------
total:=2
;-------------- example copy 2 folders to next drive X ----------------
source1=%a_desktop%\TEST2 ; C:\users\garry\desktop\TEST2
dest1 =%last%_BEELINK\DESKTOP\TEST2 ; E:\_BEELINK\DESKTOP\TEST2 ( lastdrive example E:\ or another drive letter after C:\ and D:\ )
;--------
source2=%seclast%M_GARRY\GAMES ;- D:\M_GARRY\GAMES
dest2 =%last%_BEELINK\M_GARRY\GAMES ;- E:\_BEELINK\M_GARRY\GAMES
;-----------------------------------------------------------------------
alldest=%source1% >> %dest1%`n%source2% >> %dest2%`n
;========================================================================
fd1=%a_desktop%\ROBOCOPY_LOG
ifnotexist,%fd1%
filecreatedir,%fd1%
;----------------------------
;============== GUI ===========
name1:="DOS_TEST"
global name1
e:=""
cpx:="cp65001"
Gui,1:default
Gui,1: -DPIScale
Gui,1:Color,Black,Black
wa:=A_screenwidth,ha:=A_screenHeight,xx:=100
;- maybe change fontsize
;============ GUISIZEx DPIx 4Kx 3840*2160 is 100% ============
if (wa=3840)
Gui,1:Font,s12 cYellow,Lucida Console
;============ GUISIZEx DPIx FHD 1920*1080 is 100% ============
else if (wa=1920)
Gui,1:Font,s10 cYellow,Lucida Console
else
Gui,1:Font,s8 cYellow,Lucida Console
;=============================================================
;------------------------------------------------------------
x:=(wa*1)/xx,y:=(ha*1)/xx, w:=(wa*18)/xx,h:=(ha*8)/xx
Gui, Add, Edit, x%x% y%y% w%w% h%h% vE1 readonly ,%alldrives% ;- show All_Drives
;------------------------------------------------------------
x:=(wa*20)/xx,y:=(ha*1)/xx, w:=(wa*40)/xx,h:=(ha*10)/xx
Gui, Add, Edit, x%x% y%y% w%w% h%h% vE2 ,%alldest%
;------------------------------------------------------------
x:=(wa*61)/xx,y:=(ha*1)/xx, w:=(wa*7)/xx,h:=(ha*2.3)/xx
Gui, Add, Button, x%x% y%y% w%w% h%h% vRunx gRunCopy,RUN-COPY ;- RUN-ROBOCOPY
;------------------------------------------------------------
x:=(wa*61)/xx,y:=(ha*4.1)/xx,w:=(wa*7)/xx,h:=(ha*2.3)/xx
Gui, add, Edit, x%x% y%y% w%w% h%h% vED3 readonly, ;- message running /ENDED
;------------------------------------------------------------
;x:=(wa*61)/xx,y:=(ha*7)/xx,w:=(wa*5)/xx,h:=(ha*2.3)/xx
;Gui,add,button, x%x% y%y% w%w% h%h% gPrintx, PRINT ;- PRINT
;------------------------------------------------------------
;x:=(wa*67)/xx,y:=(ha*7)/xx,w:=(wa*5)/xx,h:=(ha*2.3)/xx
;Gui,add,button, x%x% y%y% w%w% h%h% gPrintNew, PRINT_NEW ;- PRINT NEW
;------------------------------------------------------------
x:=(wa*1)/xx,y:=(ha*12)/xx, w:=(wa*72)/xx,h:=(ha*10)/xx
Gui, Add, Edit, x%x% y%y% w%w% h%h% vED0 readonly ;- which folder is already copied
;------------------------------------------------------------
x:=(wa*1)/xx,y:=(ha*22.5)/xx,w:=(wa*72)/xx,h:=(ha*70)/xx
Gui, Add, Edit, x%x% y%y% w%w% h%h% vED1 readonly +0x0400 ;- here the output
;------------------------------------------------------------
Gui,add,text,x0 y0 w0 h0 vTextdummy
x:=(wa*.1)/xx,y:=(ha*.1)/xx,w:=(wa*75)/xx,h:=(ha*95)/xx
Gui, Show,x%x% y%y% w%w% h%h%,%name1%
;------------------------------------------------------------
GuiControl,1: Focus,textdummy
return
;-------------------------
Guiclose:
Exitapp
esc::exitapp
;-------------------------
;==========================================================
RUNCOPY:
;- UMLAUT and chinese characters OK
Gui,1:submit,nohide
;---------------------------
;- beelink must have at least DRIVE >D
if ((vt>2) and (type1="Removable" or type1="Fixed")) ;- if more then 2 drives & lastDrive is removable/ or fixed ( maybe USB-stick )
{
msgbox, 262436,COPY-%seclast% to %last% ,%alldrives%`n-------------`nWant you COPY =`n%alldest% ?
IfMsgBox,No
return
e:=""
enew:=""
e2:=""
Guicontrol,1:,ED0
Guicontrol,1:,ED1
Guicontrol,1:,ED3,running...
;--------- for TEST robocopy logfile : --------
logfile2 =%fd1%\%a_now%_Robocopy_Log.txt
excludex2=%logfile2%
;----------------------------------------------
;-----------
loop,%total%
{
guicontrolget,ed0
src:=% source%a_index%
dst:=% dest%a_index%
e2:=ed0 . "`n" . src . ">>>" . dst
Guicontrol,1:,ED0,%e2%
sleep,100
GuiControl,1: Focus,ED0
send,^{end}
sleep,100
;---------------------
;cmdx=chcp 65001&robocopy "%src%" "%dst%" /XO /E /TEE /NP /UNICODE /UNILOG+:%logfile2% /XD %excludex2%
cmdx=chcp 65001&robocopy "%src%" "%dst%" /XO /E /TEE /NP /UNICODE /FP /TS
;----------------------
ed2a:="cmd /c " . cmdx
xxc:=cmdret(ED2a,,CPX)
sleep,400
e .="`r`n=========================== START ===================================`r`n" . cmdx . " =`r`n-------------------------------`r`n" . xxc . "`r`n================================ ENDXX ================================`r`n"
sleep,100
Guicontrol,1:,ED1,%e%
sleep,100
GuiControl,1: Focus,ED1
send,^{end}
}
Guicontrol,1:,ED3,ENDED
gosub,printx
sleep,1000
gosub,printnew
}
return
;===================================================================
;-------------------------
printnew:
f11=%fd1%\%a_now%_Robocopy_New.txt
Gui,1:submit,nohide
i=0
z=0
if e<>
{
Loop,parse,e,`n,`r
{
x:=a_loopfield
if x=
continue
i++
;-----------------------------------------------------
if x contains Gestartet
{
enew .= "================================`r`n"
z=1
I=0
}
if (z=1)
{
enew .= x . "`r`n"
if (i=2)
{
z=0
enew .= "--------------------------`r`n"
}
}
;------------------------------------------------------
if x contains Insgesamt
{
enew .= "--------------------------`r`n"
K=1
}
if (K=1)
{
enew .= x . "`r`n"
if x contains ENDXX
K=0
}
;----------------------------------------------------
stringmid,xx,x,1,29
if (xx ~= "Neuer|Neue Datei|Neues Verz")
enew .= x . "`r`n"
}
xxa:=" Skipped"
xxb:=" No match"
stringreplace,enew,enew,Übersprungen ,%xxa%,all
stringreplace,enew,enew,Keine Übereinstimmung ,%xxb%,all
if enew<>
{
fileappend,%enew%,%f11%,utf-8
try
run,%f11%
enew:=""
}
else
msgbox, 262208,COPY-NEW ,File not created because not found text=`nNeuer|Neue Datei|Neues Verz
}
return
;---------------------------
/*
================================
Gestartet: Donnerstag, 20. Mai 2021 11:49:48
Quelle : D:\M_YVONNE\
Ziel : F:\_BEELINK\M_YVONNE\
--------------------------
Neue Datei 7468 2021/03/07 15:13:00 D:\M_YVONNE\多线程系统代理下载tube1080p视频_20210307161303.ahk
--------------------------
Insgesamt Kopiert Skipped No match FEHLER Extras
Verzeich.: 109 0 109 0 0 39
Dateien: 1457 1 1456 0 0 117
Bytes: 4.443 g 7.2 k 4.443 g 0 0 1020.71 m
Zeiten: 0:00:00 0:00:00 0:00:00 0:00:00
Geschwindigkeit: 240903 Bytes/Sek.
Geschwindigkeit: 13.784 Megabytes/Min.
Beendet: Donnerstag, 20. Mai 2021 11:49:49
================================ ENDXX ================================
================================
Gestartet: Donnerstag, 20. Mai 2021 11:49:51
Quelle : C:\users\garry\desktop\
Ziel : F:\_BEELINK\DESKTOP\
--------------------------
Neuer 12422 2021/05/20 09:49:18 C:\users\garry\desktop\FAV_TEST\ROBOCOPY\Robocopy_TEST_09.ahk
Neue Datei 81895 2021/05/20 09:46:51 C:\users\garry\desktop\ROBOCOPY_LOG\20210520114651_Robocopy_Log_cmdret.txt
Neue Datei 1819 2021/05/20 09:46:52 C:\users\garry\desktop\ROBOCOPY_LOG\20210520114652_Robocopy_New.txt
--------------------------
Insgesamt Kopiert Skipped No match FEHLER Extras
Verzeich.: 260 0 260 0 0 52
Dateien: 3119 3 3116 0 0 336
Bytes: 996.06 m 93.8 k 995.97 m 0 0 2.128 g
Zeiten: 0:00:00 0:00:00 0:00:00 0:00:00
Geschwindigkeit: 3101161 Bytes/Sek.
Geschwindigkeit: 177.449 Megabytes/Min.
Beendet: Donnerstag, 20. Mai 2021 11:49:52
================================ ENDXX ================================
*/
;--------------------------
printx:
Gui,1:submit,nohide
logfile1 =%fd1%\%a_now%_Robocopy_Log_cmdret.txt
if e<>
{
e:=Trim(RegExReplace(e, "`am)^(?!.*[[:alnum:]]).*\R+"), "`r`n")
fileappend,%e%,%logfile1%,UTF-8
try
run,%logfile1%
;e:=""
}
return
;==========================
;--------------------------------------------------------------------------------------------------------
drivegetshow:
i=0
alldrives:=""
DriveGet, A, List,
StringSplit,D, A,
loop,%d0%
{
DRV:= % d%a_index% . ":\"
i++
DriveGet , type1 , type , %DRV% ;- removable / fixed
DriveGet , cap1 , capacity , %DRV%
DrivespaceFree , free1 , %DRV%
DriveGet , fs1 , fs , %DRV% ;- FAT
DriveGet , label1 , label , %DRV% ;- volume label >\\server1
DriveGet , serial1 , serial , %DRV% ;- volume serial number
DriveGet , status1 , status , %DRV%
alldrives .= drv . " " . type1 . " FREE=" . free1 . "-MB`n"
;msgbox, 262208,Drive-Info_%i% ,%DRV% %type1% %label1% %fs1% %cap1%-MB %free1%-MB %status1%
}
stringtrimright,alldrives,alldrives,1
VT:=D0 ;- totaldrives
VL:=(D0-1) ;- totaldrives-1
last = %drv%
if (VT>2)
{
loop,%vl%
seclast := % d%a_index% . ":\"
Guicontrol,1:,ED1,%alldrives%
;msgbox, 262208,Info ,Alldrives=`n%alldrives%
}
else
{
msgbox, 262208,ERROR-SAVE ,You need more than 2 drives for robocopy (computer BEELINK)`n`nAlldrives=`n%alldrives%
exitapp
}
return
;---------------------------------------------------------------------------------------------
;================= function from user teadrinker ========================================
;- https://www.autohotkey.com/boards/viewtopic.php?p=369467#p369467
CmdRet(sCmd, callBackFuncObj := "", encoding := "CP0")
{
static HANDLE_FLAG_INHERIT := 0x00000001, flags := HANDLE_FLAG_INHERIT
, STARTF_USESTDHANDLES := 0x100, CREATE_NO_WINDOW := 0x08000000
hPipeRead:=""
hPipeWrite:=""
sOutput:=""
DllCall("CreatePipe", "PtrP", hPipeRead, "PtrP", hPipeWrite, "Ptr", 0, "UInt", 0)
DllCall("SetHandleInformation", "Ptr", hPipeWrite, "UInt", flags, "UInt", HANDLE_FLAG_INHERIT)
VarSetCapacity(STARTUPINFO , siSize := A_PtrSize*4 + 4*8 + A_PtrSize*5, 0)
NumPut(siSize , STARTUPINFO)
NumPut(STARTF_USESTDHANDLES, STARTUPINFO, A_PtrSize*4 + 4*7)
NumPut(hPipeWrite , STARTUPINFO, A_PtrSize*4 + 4*8 + A_PtrSize*3)
NumPut(hPipeWrite , STARTUPINFO, A_PtrSize*4 + 4*8 + A_PtrSize*4)
VarSetCapacity(PROCESS_INFORMATION, A_PtrSize*2 + 4*2, 0)
if !DllCall("CreateProcess", "Ptr", 0, "Str", sCmd, "Ptr", 0, "Ptr", 0, "UInt", true, "UInt", CREATE_NO_WINDOW
, "Ptr", 0, "Ptr", 0, "Ptr", &STARTUPINFO, "Ptr", &PROCESS_INFORMATION)
{
DllCall("CloseHandle", "Ptr", hPipeRead)
DllCall("CloseHandle", "Ptr", hPipeWrite)
throw Exception("CreateProcess is failed")
}
DllCall("CloseHandle", "Ptr", hPipeWrite)
VarSetCapacity(sTemp, 4096), nSize := 0
while DllCall("ReadFile", "Ptr", hPipeRead, "Ptr", &sTemp, "UInt", 4096, "UIntP", nSize, "UInt", 0) {
sOutput .= stdOut := StrGet(&sTemp, nSize, encoding)
;sOutput .= stdOut := StrGet(&sTemp, nSize)
;sOutput .= stdOut := StrGet(&sTemp, nSize, CPX)
( callBackFuncObj && callBackFuncObj.Call(stdOut) )
}
DllCall("CloseHandle", "Ptr", NumGet(PROCESS_INFORMATION))
DllCall("CloseHandle", "Ptr", NumGet(PROCESS_INFORMATION, A_PtrSize))
DllCall("CloseHandle", "Ptr", hPipeRead)
Return sOutput
}
;================= END SCRIPT ========================================================================
;===================== NOTICE ========================================================================
/*
;- https://www.autohotkey.com/boards/viewtopic.php?f=9&t=90409
;- https://www.autohotkey.com/boards/viewtopic.php?f=10&t=71336
;- https://www.wintotal.de/download/yarcgui/
;- https://www.tecchannel.de/a/robocopy-daten-schnell-und-einfach-unter-windows-sichern,2033515
*/
;=====================================================================================================
[/code]