Mehrere markierte Dateien über Tastenkombination drucken?

German support forum

Moderators: Hacker, Stefan2, white

Post Reply
sigmahr
Junior Member
Junior Member
Posts: 18
Joined: 2004-07-30, 11:35 UTC

Mehrere markierte Dateien über Tastenkombination drucken?

Post by *sigmahr »

Hallo,

der Druck einer Datei über das mit der Dateiendung verknüpfte Programm funktioniert mit CRTL+F9 gut. Markiere ich mehrere Dateien, wird bei dieser Tastenkombination immer nur die letzte markierte Datei gedruckt.

Gibt es einen Weg, über eine Tastenkombination alle markierten Dateien zu drucken? Danke.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50561
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Leider nicht bei allen - wenn bei Umsch+F10 der Eintrag "Drucken" erscheint, dann können Sie diesen benutzen.
Author of Total Commander
https://www.ghisler.com
sigmahr
Junior Member
Junior Member
Posts: 18
Joined: 2004-07-30, 11:35 UTC

Post by *sigmahr »

Danke für die Rückmeldung. Bei *.doc[x] und *.xls[x] geht es, wenn man die Dateien (doc/xls) nicht mischt; bei *.pdf (was bei mir der Fall ist, Acrobat pro X) nicht. Schade.
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

VBScript: _ForEachSelFileDo_PRINT.vbs

Post by *Stefan2 »

Über ein Skript geht alles....

- Mit dem TC-Parameter "%L" eine Liste der selektierten Dateien erstellen lassen
- Ein Skript arbeitet diese Liste Zeile für Zeile ab, und entscheidet anhand der Erweiterung (doc,xlsx,pdf,...) über die Aktion
- Als Aktion wird für das jeweilige Dokument die Print-Funktion aufgerufen.

Dieses Skript kann man als UserCmd eintragen,
[em_PrintAll]
cmd=myScript.vbs
param="%L"

und dem UserCmd eine Tastenkombination zuweisen.
Shift+Control+F9=em_PrintAll


Problem: das Skript muss noch geschrieben werden (bzw. gefunden. Eigentlich wurde doch bereits alles Mögliche bereits im Forum behandelt, oder? :D )


- - - EDIT

DUMMY SKRIPT

_ForEachSelFileDo_PRINT.vbs

Code: Select all

'Total Commander VBScript
' -----------------------------------
'TC Button:
'	cmd= "D:\rive\path\to\this.vbs"
'	param= "%L"
' -----------------------------------

'On Error Resume Next

MsgBox "Script is not ready yet"
WScript.Quit


Set FSO  = CreateObject("Scripting.FileSystemObject")
Set WSO  = Wscript.CreateObject("WScript.Shell")
Const FORREADING = 1
sTCtempList = Wscript.arguments.Item(0) ' The TC temp file due to the "%L" parameter
If  FSO.FileExists(sTCtempList) Then
  Set      oTextStream = FSO.OpenTextFile(sTCtempList,FORREADING)
  Do Until oTextStream.AtEndOfStream
         vFullName = oTextStream.ReadLine
         Set oFile = FSO.GetFile(vFullName)
            vName = FSO.GetFileName(oFile)
            vBase = FSO.GetBaseName(oFile)
            vExte = FSO.GetExtensionName(oFile)
            vPath     = oFile.ParentFolder


         '//POSSIBLE ACTIONS:


		'IF(LCase(vExte)="pdf") Then WSO.Run "sumatrapdf.exe -print-to-default """ & vFullName & """", 0, True


		'//From www DOT experts-exchange DOT com/questions
		' 	/27645053/Printing-an-Office-document-using-VBS-on-a-specified-printer.html
		  ' Print XLS document
		  If (Right(strFile, 3) = "xls") Then
		    Set objOffice = CreateObject("Excel.Application")
		    objOffice.Visible = False
		    Set oWkbk = objOffice.Workbooks.Open(vFullName)
		    oWkbk.PrintOut
		    oWkbk.Close xlDoNotSaveChanges
		    objOffice.Quit
		  End If
		  ' Print WORD document
		  If (Right(strFile, 4) = "docx") Then
		    Set objOffice = WScript.CreateObject("Word.Application")
		    objOffice.Documents.Open vFullName
		    objOffice.ActiveDocument.PrintOut
		    Wscript.Sleep(1000)
		    objOffice.ActiveDocument.Close
		    objOffice.Quit
		  End If

  Loop
  oTextStream.Close
Else
  WScript.Echo "Input file sTCtempList not found."
End If 


- - -

Hab' noch das hier gefunden:


Automation and Document Files

The GetObject function may be used to obtain an object that represents some already existing document file,
through a process called Automation. GetObject uses the name of the document file to find the appropriate object class server,
through the Windows standard file type association mechanism (the list of file types and applications
you see in Windows Explorer when you click Tools, Folder Options, File Types).

For example, you can create a Word document object representing an existing file and print it:

set obj = GetObject("C:\docs\userlist.doc") ' get object for existing document
obj.Printout ' print the document
set obj = Nothing ' release the object
http://www DOT quepublishing DOT com/articles/article.aspx?p=29570&seqNum=3




 
Post Reply