Click here to Skip to main content
15,887,812 members

S Douglas - Professional Profile



Summary

    Blog RSS
2
Author
3,549
Authority
5,057
Debator
12
Enquirer
661
Organiser
3,011
Participant
0
Editor
Just another hack, who manages to take care of issues that would otherwise go unsolved. Smile | :)

 

Reputation

Weekly Data. Recent events may not appear immediately. For information on Reputation please see the FAQ.

Privileges

Members need to achieve at least one of the given member levels in the given reputation categories in order to perform a given action. For example, to store personal files in your account area you will need to achieve Platinum level in either the Author or Authority category. The "If Owner" column means that owners of an item automatically have the privilege. The member types column lists member types who gain the privilege regardless of their reputation level.

ActionAuthorAuthorityDebatorEditorEnquirerOrganiserParticipantIf OwnerMember Types
Have no restrictions on voting frequencysilversilversilversilver
Bypass spam checks when posting contentsilversilversilversilversilversilvergoldSubEditor, Mentor, Protector, Editor
Store personal files in your account areaplatinumplatinumSubEditor, Editor
Have live hyperlinks in your profilebronzebronzebronzebronzebronzebronzesilverSubEditor, Protector, Editor
Have the ability to include a biography in your profilebronzebronzebronzebronzebronzebronzesilverSubEditor, Protector, Editor
Edit a Question in Q&AsilversilversilversilverYesSubEditor, Protector, Editor
Edit an Answer in Q&AsilversilversilversilverYesSubEditor, Protector, Editor
Delete a Question in Q&AYesSubEditor, Protector, Editor
Delete an Answer in Q&AYesSubEditor, Protector, Editor
Report an ArticlesilversilversilversilverSubEditor, Mentor, Protector, Editor
Approve/Disapprove a pending ArticlegoldgoldgoldgoldSubEditor, Mentor, Protector, Editor
Edit other members' articlesSubEditor, Protector, Editor
Create an article without requiring moderationplatinumSubEditor, Mentor, Protector, Editor
Approve/Disapprove a pending QuestionProtector
Approve/Disapprove a pending AnswerProtector
Report a forum messagesilversilverbronzeProtector, Editor
Approve/Disapprove a pending Forum MessageProtector
Have the ability to send direct emails to members in the forumsProtector
Create a new tagsilversilversilversilver
Modify a tagsilversilversilversilver

Actions with a green tick can be performed by this member.


 
GeneralKnowledge Base Pin
S Douglas22-Jan-06 21:28
professionalS Douglas22-Jan-06 21:28 
GeneralRe: Knowledge Base Pin
code-frog25-Jan-06 21:13
professionalcode-frog25-Jan-06 21:13 
GeneralRe: Knowledge Base Pin
S Douglas25-Jan-06 21:34
professionalS Douglas25-Jan-06 21:34 
GeneralRe: Knowledge Base Pin
Neville Franks30-Jan-06 9:08
Neville Franks30-Jan-06 9:08 
GeneralRe: Knowledge Base Pin
Neville Franks30-Jan-06 9:17
Neville Franks30-Jan-06 9:17 
GeneralRe: Knowledge Base Pin
S Douglas30-Jan-06 19:45
professionalS Douglas30-Jan-06 19:45 
GeneralWhats the big deal? Pin
S Douglas28-Dec-05 15:37
professionalS Douglas28-Dec-05 15:37 
GeneralBack Up Script Pin
S Douglas19-Dec-05 20:58
professionalS Douglas19-Dec-05 20:58 
Well a friend of mine came to me last week looking for a small script that would backup a directory for him. I hammered this out in a few hours (most of that time was spent looking for how to invoke the built in XP zipping interface). Rather than just forget about it I thought I would post it here in case anyone else could use something similar.

To use it, copy the text below into a text file rename it to .vbs, fill in the variables strDirToBack and strDirNewloc and choose whether or not you want the folder to be zipped or not. An incrementing number will be added to the end of the resulting file / folder. There isn’t much in the way of error handling, if you have trouble let me know and I will try and help.

Option Explicit

'***************************************************************************'
'*** Quick Back Up by Stephan 
'*** 
'*** No warranties express or implied use at your own risk
'***************************************************************************'

'********************************************************************************'
'*** if bZip is set to true then Quick Zip will try and use built in windows  ***'
'*** Zipping functionality (Windows XP and Newer Only), other wise Quick zip  ***'
'*** will try and find WinZip to add the folders to a zip archive. If neither ***'
'*** of these are available then Quick zip will copy the folders directly     ***'
'*** appending a numeric integer to end of the folder                        ***'
'*** The last folder name of the destination directory will be used as the zip ***'
'*** File name or folder name if zipping is not used                          ***'
'*** Exp, the directory to back up "C:\Test" backed up to "C:\Temp\Test will  ***'
'*** become "C:\Temp\Test1.zip                                                ***'
'********************************************************************************'


'*** The directory to back up *** 'SFD
const strDirToBack = "C:\eia"

'**** The new location ***'
const strDirNewloc = "C:\TEMP\eia"

'*** Zip the files Using Windows Zip ***'
const bZip = true

'***************************************************************************'
'*** App Variables, Do No modifiy ***'
Dim objFSO
'*** End App Vars ***'
'***************************************************************************'

Call main

'***************************************************************************'
'*** Start the work *** SFD 12/17/2005
'***************************************************************************'
sub main()
dim strNum
dim strLoc
dim objShell

	Set objFSO = CreateObject("Scripting.FileSystemObject")
	strNum = GetFileNumber()

	strLoc = GetWinZipLoc()
	
	if(bZip) then
		if(CreateZip(strDirNewLoc  & strNum & ".zip ")) Then
			AddFilesZip strDirNewLoc  & strNum & ".zip ", strDirToBack
		end if
	elseif(Len(strLoc) > 0) then
	'*** Winzip is installed ***'
		set objShell = CreateObject("Shell.Application")
		strLoc = strLoc & " -a " & strDirNewLoc  & strNum & ".zip " & strDirToBack
		objshell.Open strLoc
		set objShell = Nothing
	else
	'*** WinZip is not installed Just copy the folder ***'
		objFSO.CopyFolder strDirToBack, strDirNewloc & strNum
	end if
	
	set objFSO = nothing

end sub

'***************************************************************************'
'*** Get File Number *** SFD 12/17/2005
'***************************************************************************'
function GetFileNumber()
dim objTextFile
dim strValue

	if(GetExists("foldernumber.dat") = false) then
		Set objTextFile = objFSO.CreateTextFile("foldernumber.dat")
		objTextFile.WriteLine("0")
		objTextFile.Close()
		Set objTextFile = NOthing
	end if

	Set objTextFile = objFSO.OpenTextFile("foldernumber.dat")
	
	strValue = objTextFile.ReadLine()

	objTextFile.Close
	
	set objTextFile = nothing

	if(len(strValue) < 1) or (IsNumeric(strValue) = False) then
		'**** Error ***'
		strValue = 0
	end if
	
	strValue = strValue + 1
	call SetFileNumber(strValue)
	
	GetFileNumber = strValue
end function

'***************************************************************************'
'*** Get File Number *** SFD 12/17/2005
'***************************************************************************'
sub SetFileNumber(strNewNumber)
dim objTextFile
	Set objTextFile = objFSO.OpenTextFile("foldernumber.dat", 2, False )
	
	objTextFile.WriteLine(strNewNumber)
	objTextFile.Close()

	set objTextFile = nothing
	
end sub

'***************************************************************************'
'*** Does the file exists *** SFD 12/17/2005
'***************************************************************************'
function GetExists(str)
		
	GetExists = objFSO.fileexists(str)
end function

'***************************************************************************'
'*** Get Location of Winzip from Registry *** SFD 12/17/2005
'***************************************************************************'
function GetWinZipLoc()
On Error Resume Next
dim strWinZip
dim objRegEdit
	strWinZip = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\winzip32.exe"
	
	Set objRegEdit = CreateObject("WScript.Shell")
	strWinZip = vbNullString
	strWinZip = objRegEdit.RegRead(strWinZip)
	
	Set ObjRegEdit = Nothing
	
	GetWinZipLoc = strWinZip

end function

'***************************************************************************'
'*** Create The Zip File *** SFD 12/17/2005
'***************************************************************************'
function CreateZip(strLoc)
On Error Resume Next
dim strHex
dim i
dim objTextFile

CreateZip = true

	'Create the basis of a zip file. 
	Set objTextFile = objFSO.CreateTextFile(strLoc, True) 

	strHex = Array(80, 75, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) 

	strLoc = vbNullstring

	For i = 0 To UBound(strHex) 
		strLoc = strLoc & Chr(strHex(i)) 
	Next 

	objTextFile.Write strLoc 
	objTextFile.Close 

	Set objTextFile = Nothing 

if err.number <> 0 then
	CreateZip = False
end if
end function


'***************************************************************************'
'*** Add Files to Zip *** SFD 12/17/2005
'***************************************************************************'
function AddFilesZip(strLoc, strback)
On Error Resume Next 

dim objApp
dim objZip

Set objApp = CreateObject("Shell.Application") 

Set objZip = objApp.NameSpace(strback) 
	If Not objZip Is Nothing Then 
		objApp.NameSpace(strLoc).CopyHere objZip.Items 
	End If 
 
wScript.Sleep(5000) 

Set objZip = Nothing 
do while(objZip is Nothing)
	wscript.sleep 3000
loop

Set objZip = Nothing 
Set objApp = Nothing

If Err.number <> 0 then 
	msgbox err.description
	err.clear
End If 

end function




ZeePain! wrote:
This seems like one of those programs that started small, grew incrementally, building internal pressure, and finally barfed all over its source code sneakers. Or something.

thedailywtf.com[^]
GeneralRe: Back Up Script Pin
code-frog25-Jan-06 21:08
professionalcode-frog25-Jan-06 21:08 
GeneralRe: Back Up Script Pin
S Douglas25-Jan-06 21:25
professionalS Douglas25-Jan-06 21:25 
GeneralVS2005 Launch Pin
S Douglas19-Dec-05 19:24
professionalS Douglas19-Dec-05 19:24 
GeneralBlogs Pin
S Douglas21-Nov-05 20:06
professionalS Douglas21-Nov-05 20:06 
GeneralNew Sig Pin
S Douglas17-Nov-05 22:59
professionalS Douglas17-Nov-05 22:59 
GeneralMessage Boards Pin
S Douglas16-Nov-05 3:33
professionalS Douglas16-Nov-05 3:33 
GeneralSVN Subversion, update. Pin
S Douglas9-Nov-05 23:55
professionalS Douglas9-Nov-05 23:55 
GeneralAh Normalcy, well for me anyway Pin
S Douglas9-Nov-05 23:35
professionalS Douglas9-Nov-05 23:35 
General... Pin
S Douglas1-Nov-05 19:21
professionalS Douglas1-Nov-05 19:21 
GeneralLife Pin
S Douglas24-Oct-05 21:04
professionalS Douglas24-Oct-05 21:04 
GeneralSource Code Repositories (Part Two) Pin
S Douglas19-Oct-05 23:32
professionalS Douglas19-Oct-05 23:32 
GeneralSource Code Repository (Just my experience) Pin
S Douglas18-Oct-05 22:12
professionalS Douglas18-Oct-05 22:12 
QuestionRe: Source Code Repository (Just my experience) Pin
Stlan18-Oct-05 23:12
Stlan18-Oct-05 23:12 
AnswerRe: Source Code Repository (Just my experience) Pin
S Douglas18-Oct-05 23:27
professionalS Douglas18-Oct-05 23:27 
General[Thanks] Pin
Stlan18-Oct-05 23:30
Stlan18-Oct-05 23:30 
GeneralRe: [Thanks] Pin
S Douglas18-Oct-05 23:41
professionalS Douglas18-Oct-05 23:41 
GeneralRe: Source Code Repository (Just my experience) Pin
Jeremy Falcon12-Jan-07 9:13
professionalJeremy Falcon12-Jan-07 9:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.