Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Tcl/tk

Empfohlene Antworten

Veröffentlicht

So servus,

hab folgendes Problem :

Ich will mit TCL auf ein Word File zugreifen, es öffnen, was reinschreiben und es wieder schließen... Öffnen.. kein Problem, Speichern und schließen... Kein Problem... aber ich hab keinen Plan wie ich in das File reinschreiben kann...

Arbeite mit Hilfe von tcom!

Hier mal n Stück Quellcode :

#tcom packet wird benötigt

load tcom.dll

proc worddrucken {} {

set wordapplication [::tcom::ref createobject "Word.Application"]

$wordapplication Visible 0

set docs [$wordapplication Documents]

set doc [$docs Open "c:/StammNummernSuche.doc" [::tcom::na] [expr 0]]

#hier muss Text rein : D

#

#

$docs Save

#doc PrintOut [expr 1] [::tcom::na]

$wordapplication Quit

}

Hoffe mir kann jmd. helfen.

Vielen Dank im Voraus.

Ten13

Suchst du sowas?

puts [-nonewline] [fileId] string

Schreibt einen String in den Standardausgabekanal oder bei Angabe der fileId in die entsprechende Datei.

Beispiel:

# Writing

set filename test.txt

set fh [open $filename "w"]

puts $fh "Holger Schmidt"

puts $fh "Astrid Meier"

puts $fh "Karl Mueller"

close $fh

Hier ist noch ein ganz nettes Tutorial, vielleicht hilft dir das auch weiter:

http://www.ti.uni-bielefeld.de/downloads/WS0405/tcltk/TclTkKurs2.pdf

Danke erstmal für die Antwort, ist aber leider nicht das was ich suche.

So in eine Txt- File zu schreiben wär kein Problem aber ich muss direkt aber diese tcom Schnittstelle in Word schreiben.

mit Excel geht das so :

#tcom packet wird benötigt

load tcom.dll

set application [::tcom::ref createobject Excel.Application]

$application Visible 0

set workbooks [$application Workbooks]

set workbook [$workbooks Open "c:/StammNummernSuche.xls" [::tcom::na] [expr 0]]

set worksheets [$workbook Worksheets]

set worksheet [$worksheets Item [expr 1]]

set cells [$worksheet Cells]

$cells Item 4 B "VERTRAULICH"

$cells Item 5 B "$anrede"

$cells Item 6 B "$vorname $nachname"

$cells Item 7 B "$abteilung"

$cells Item 8 B ""

$workbook Save

$application Quit

Nur mit Word bekomme ich es nicht hin...

@grueni: er will das ja über die automatisierungsschnittstelle (sprich, COM) machen und nicht in ein plaintext file schreiben.

@ten13: versuchs mal mit "$doc text", gefolgt vom gewünschten inhalt.

Insert text with formatting

$word -with selection.font : name "Courier New"

$word -with selection.font : size 10.0

$doc -with content : text "Text in Courier 10 point \r" ;# \r Return ???

ist zwar die implementierung mit optcl und nicht tcom, sollte aber abgesehen von ähnlicher syntax auf die gleiche COM-hierarchie zugreifen können.

s'Amstel

Hi danke auch Dir,

hab diese Seite auch schon im Netz gefunden, hab so ziehmlich alle seiten die google ausgespuckt hat gelsen aber keine konnte mir helfen...

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.