Alternative Nation
Go Back   Alternative Nation

Notices

View Single Post
Old 21st February 2008, 7:46pm   #12
Zooropa
Changed Man V4
 
Join Date: May 2002
Location: Breaking into H
Posts: 32,410
Zooropa is better than HoodyZooropa is better than HoodyZooropa is better than HoodyZooropa is better than HoodyZooropa is better than HoodyZooropa is better than HoodyZooropa is better than HoodyZooropa is better than HoodyZooropa is better than HoodyZooropa is better than HoodyZooropa is better than Hoody
Send a message via MSN to Zooropa
Re: Script to print all files in folder and subfolders

strDirectory = "E:\Code\SQL"


Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(strDirectory)
Set colItems = objFolder.Items
For Each objItem in colItems
objItem.InvokeVerbEx("Edit")
Next

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objMainFolder = objFSO.GetFolder(strDirectory)
Set colSubfolders = objMainFolder.Subfolders
For Each objSubfolder in colSubfolders
strFolder = objSubfolder.Path
GetFiles strFolder
Next

sub GetFiles(byval strDirectory)
Set objWeeFolder = objShell.Namespace(strDirectory)
Set colWeeItems = objWeeFolder.Items
For Each objWeeItem in colWeeItems
objWeeItem.InvokeVerbEx("Edit")
Next
end sub

This works!

Maybe a bit clumsy, but I was able to go through to a subfolder and loop through the items in that.
It currently only goes down 1 level, but could be changed to loop through other subfolders.

I just sepnt 45 minutes on that, and enjoyed every minute of it.
Work from work, although VBS is fucking old school.
Oh, and obviously change "Edit" to "Print"
__________________
You just lost The Game

If animal trapped call 844-6286

Last edited by Zooropa; 21st February 2008 at 7:48pm. Reason: Automerged Doublepost
Zooropa is offline   Reply With Quote
 







Powered by vBadvanced CMPS v3.0.0


All times are GMT +0. The time now is 11:41am.

Forums Directory
Copyright 2000-2008, Alternative Nation
Page generated in 0.22056 seconds with 17 queries