' -------------------------------------------8<-------------------------------------------
' Script : copy_CF.vbs
Dim MyDate, MyFolderDate, FSO, WshShellWav
Dim FileSystemObject, CopyFrom, CopyTo, DelTempFolder
Dim fsoXAlarm, wshXAlarm, XalarmPath, XEventCmd
Set fsoXAlarm = CreateObject("Scripting.FileSystemObject")
Set wshXAlarm = WScript.CreateObject("WScript.Shell")
XalarmPath = "c:\Program Files\XLobbyFr\plugins\XEvent\XAlarmClock.ini"
' ----------8<----------
' Copy from disk k: (my CompactFlash Reader, from sub folder \Dcim) to my local disk 'photo' folder i:\myCanon
' CopyFrom="K:\Dcim\"
' CopyTo="c:\myCanon\"
CopyFrom = WScript.Arguments(0)
CopyTo = WScript.Arguments(1)
' ----------8<----------
' If you have a directory to delete after copy, set its name below :
' This directory is created by my Canon Camera after a copy, I want to delete it...
DelTempFolder= "CANONMSC"
' ----------8<----------
WavExeTool = "C:\Program Files\Xlobbyfr\Applications\CopyPhotos\PlayWav.exe"
WavAudioFile = "C:\Program Files\Xlobbyfr\Applications\CopyPhotos\Sound.wav"
' -------------------------------------------8<-------------------------------------------
' ----------8<----------
Set FSO = CreateObject("Scripting.FileSystemObject")
Set WshShellWav = WScript.CreateObject("WScript.Shell")
' ----------8<----------
' Verify if "PlayWav.exe" & ".wav" files are in WavExeTool/WavAudioFile directories
If ( not FSO.FileExists(WavExeTool) ) Then
MsgBox "Le programme 'PlayWav.exe' DOIT ETRE dans le repertoire : " & WavExeTool & " !!!",48,"Script Cine_Horaires..."
Wscript.quit
End If
If ( not FSO.FileExists(WavAudioFile) ) Then
MsgBox "Le fichier de son (.wav) existe-t-il dans : " & WavAudioFile & " ???",48,"Script Cine_Horaires..."
Wscript.quit
End If
' ----------8<----------
' Verify If original folded exists :
CopyFrom = Replace(CopyFrom,"*.*","")
CopyFrom = Replace(CopyFrom,"*","")
If not FSO.FolderExists( CopyFrom ) Then
MsgBox "Je ne trouve pas le repertoire contenant les images : [ " & CopyFrom & " ]", 64,"Erreur !"
Wscript.quit
End If
CopyFrom = CopyFrom & "\*"
' ----------8<----------
' Verify If destination folded exists :
If not FSO.FolderExists( CopyTo ) Then
MsgBox "Je ne trouve pas le repertoire de destination : [ " & CopyTo & " ]", 64,"Erreur !"
Wscript.quit
End If
' ----------8<----------
' Create a folder with current day date, in the 'CopyTo' folder destination
' This section could be removed (from here)
MyDate = Date
MyfolderDate = DatePart("yyyy",MyDate)
If DatePart("m",MyDate) < 10 then
MyfolderDate = MyfolderDate & "0" & DatePart("m",MyDate)
Else
MyfolderDate = MyfolderDate & DatePart("m",MyDate)
End If
If DatePart("d",MyDate) < 10 then
MyfolderDate = MyfolderDate & "0" & DatePart("d",MyDate)
Else
MyfolderDate = MyfolderDate & DatePart("d",MyDate)
End If
CopyTo = CopyTo & MyFolderDate & "\"
' (to here)
' ----------8<----------
' ----------8<----------
' Copy method
' Create destination directory (with Date !)
If not FSO.FolderExists( CopyTo ) Then
FSO.CreateFolder( CopyTo )
End If
' Copy Start...
ReturnVal = WshShellWav.run (chr(34)&WavExeTool&chr(34)&" "&chr(34)&WavAudioFile&chr(34),0,TRUE)
' Perform the copy of all files from camera (or Compact Flash Reader) to your destination directory
FSO.CopyFolder CopyFrom, CopyTo
' Do you want to delete a specific directory (unwanted one) ?
If ( Len(DelTempFolder) <> 0 ) Then
DelTempFolder = CopyTo & "\" & DelTempFolder
If FSO.FolderExists( DelTempFolder ) Then
FSO.DeleteFolder( DelTempFolder )
End If
End If
' ----------8<----------
' Copy done !
ReturnVal = WshShellWav.run (chr(34)&WavExeTool&chr(34)&" "&chr(34)&WavAudioFile&chr(34),0,TRUE)
' Debug information popup window :
MsgBox "Vos photos sont sur le disque dans : [ " & CopyTo & " ]", 64,"Copie effectuee !"
' ----------8<----------
XEventCmd = "pictures:refresh"
WriteEvent(XEventCmd)
' ----------8<----------
Function WriteEvent(str)
Dim tf
Set tf = fsoXAlarm.OpenTextFile(XalarmPath, 8, True)
tf.WriteLine( "now|" & str )
tf.Close
End Function
' -------------------------------------------8<-------------------------------------------
This script will download your pictures then, when the download it’s done, it will execute the event “refresh” of the eventgroups “pictures” of my skin.
So the database pictures will be automatically refreshed when the import will be done.
Dge.