Computersight > Programming > Visual Basic

Things that Visual Basic Script can do

How to download the Pictures from a Digital Camera to use this script, copy the text below and delete the lines that are tabbed for more about Visual Basic Script, please write a comment and ask about what you want to know, if I can I will write a new Text about that

set fs = CreateObject("Scripting.FileSystemObject")
this is needed to do some things with Files and Folders

set dateihandle = fs.GetFile("Backup Digicam.vbs")
with this we can get the path from the scriptfile to get the path where the Pictures should be taken

Set WshShell = CreateObject("WScript.Shell")
this is needed to execute dos commands and to end the scrip

b = Date & "_" & Time
this variable is the foldername for the pictures

b = replace(b,":",".")
because : isn't allowed in a path but behind a driveletter we need to get rid of the : from the time

c = dateihandle.Path
with this the scriptpath is copied to the variable c

c = left(c,len(c) - len("Backup Digicam.vbs") -1)
now we need to remove the filename from the variable

d = c & "" & b
now we merge the scriptpath with the new date and time based foldername

for x = 0 to 25
now we start checking every drive for the most used Digicam-Foldername: DCIM

y = chr(asc("A") + x) & „:“
to get from letter to letter we take the ASCII Code from A and add 0 up to 25 to get to Z, chr() makes a letter from the ASCII Code

If (fs.FolderExists(y & "DCIM")) Then
check for the foldername

select case msgbox("Autodetected Digicam = " & Y,3)
ask the user if the driveletter is the one from the digicam

case 6:
in case of 'Yes' proceed

a = y
exit for
exit the for-next loop

case 7:
in case of 'No' try longer

case 2: a = "":exit for
in case of 'Abort' exit

end select
end if
next
when the script lands here, it proceeds to the next number

if a = "" then msgbox "No Digicam found. Program is shutting down":WScript.Quit
if all letters where checked and no folder found, notify the user and exit

if right(a,1) <> ":" then
if a is not empty and has a letter but no : add a :

if len(a) = 1 then a = a & ":"
end if

fs.createfolder d
create the folder for the pictures

Wshshell.run "xcopy /s " & a & " """ & d & """"
start the copy progress
/s for subfolders

0
Liked It
I Like It!
Related Articles
Using VB.net for the First Time  |  3D Engine Construction and Design Workshop: Lesson 1 - Introduction and Synopsis
More Articles by Fussel Suki
Making an Icon with GIMP  |  Simple DRI Photo Guide
Latest Articles in Visual Basic
Learn Visual Basic Six: Intro  |  Is Visual Basic the Best Language?
Comments (0)
Post Your Comment:
Name:  
Copy the code into this box:  
Post comment with your Triond credentials?
Inside Computersight

Communication & Networks

 /

Computers

 /

Hardware

 /

Operating Systems

 /

Programming

 /

Software


Popular Tags
Popular Writers
Powered by
Computersight
About Us
Terms of Use
Privacy Policy
Services
Submit an Article
Advertise with Us
Contact

© 2007 Copyright Stanza Ltd. All Rights Reserved.