Hallo Stephan,
und hier ist die erste Lösung. Das Script fordert den Anwender auf, die Excel-Diagramm-Datei zu lokalisieren.
Der Pfad wird gespeichert und der Dialog wird nicht mehr erscheinen. Dasselbe gilt für den Hotfolder, welcher
die Textdateien enthält.
Dann wird das Excel-Dokument geöffnet, in einer Wiederholungsschleife werden die Textdateien der Reihe nach
geöffnet, die gewünschte Spalte wird kopiert und in das Diagramm-Dokument eingesetzt.
---
property diagrammDoc : ""
property hotFolder : ""
property txtDoc1 : "stephan1.txt"
property txtDoc2 : "stephan2.txt"
property txtDoc3 : "stephan3.txt"
if diagrammDoc = "" then
with timeout of 300 seconds
set diagrammDoc to (choose file with prompt "Das Excel-Diagramm-Dokument wählen") as string
end timeout
else
try
diagrammDoc as alias
on error
with timeout of 300 seconds
set diagrammDoc to (choose file with prompt "Das Excel-Diagramm-Dokument wählen") as string
end timeout
end try
end if
if hotFolder = "" then
with timeout of 300 seconds
set hotFolder to (choose folder with prompt "Den Textdateien-Hotfolder wählen") as string
end timeout
else
try
hotFolder as alias
on error
with timeout of 300 seconds
set hotFolder to (choose folder with prompt "Den Textdateien-Hotfolder wählen") as string
end timeout
end try
end if
set pathList to {hotFolder & txtDoc1, hotFolder & txtDoc2, hotFolder & txtDoc3}
set charList to {"C", "D", "E"}
tell application "Microsoft Excel"
activate
open (open alias diagrammDoc)
repeat with i from 1 to 3
set curRange to item i of charList & "2:" & item i of charList & "47"
set txtPath to item 1 of pathList
try
open text file filename txtPath decimal separator point with tab
tell active workbook
tell active sheet
set columnM to value of every cell of range ("M9:M54")
end tell
end tell
close active workbook saving no
tell active workbook
tell active sheet
set value of every cell of range (curRange) to columnM
end tell
end tell
end try
end repeat
display dialog "Fertig." buttons "OK" default button 1 with icon 1 giving up after 1
end tell
---
Was noch fehlt: Die Plazierung der je drei Legendenzeilen. Würdest Du mir bitte ein Dokument
zustellen, in welchem Du diese Zeilen positionert hast?
Gruss, Hans
als Antwort auf: [#419852]