Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 28th, 2003, 05:15 PM
brianwhiting brianwhiting is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 1 brianwhiting User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
print to file

I am trying to be able to use files that I have generated by using the print to file feature and get a printout of that file. I have been able to view the output and when I put the string in a cmd prompt, it prints just fine, but when I drag a file to the script, it does nothing.

Here is the code I have so far in my vbs file. Any help on getting it to work and maybe compacting it a little more would be greatly appreciated.

Option Explicit
Dim strArg, objFSO, objFile, strTxt, WSHShell

Set objFSO=CreateObject("Scripting.FileSystemObject")
Set WSHShell=CreateObject("WScript.Shell")

strArg=GetArgs()
Filename
Set objFSO=Nothing
WScript.Quit

Function GetArgs()
If WScript.Arguments.Count < 1 Then WScript.Quit
GetArgs=objFSO.GetAbsolutePathName (WScript.Arguments(0))
End Function

Sub Filename()
Set objFile=objFSO.GetFile(strArg)
strTxt="copy /b " & objFile.ShortPath & " lpt1:"
End Sub

WSHShell.Run strTxt

Last edited by brianwhiting : December 28th, 2003 at 05:17 PM.

Reply With Quote
  #2  
Old December 29th, 2003, 01:53 AM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
VBS is a little set of vb..It can't be used for drag & drop operation to input the parameter!!It only can run by itself or get the parameter from command line!!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > print to file


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway