[GastForen Programmierung/Entwicklung AppleScript OPI Kommentare auslesen

  • Suche
  • Hilfe
  • Lesezeichen
  • Benutzerliste
Themen
Beiträge
Moderatoren
Letzter Beitrag

OPI Kommentare auslesen

swish
Beiträge gesamt: 75

12. Mai 2005, 10:13
Beitrag # 1 von 3
Bewertung:
(1013 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
Hallo mal wieder,

kann ich OPI-Kommentare aus Layoutbildern (Helios) auslesen ?

Wenn das nicht gehen sollte, wie kann ich dann die Kommentare von OS 9 im OS X einlesen ????

Gruß,

Stephan
X

OPI Kommentare auslesen

Hans Haesler
  
Beiträge gesamt: 5822

12. Mai 2005, 12:59
Beitrag # 2 von 3
Beitrag ID: #419647
Bewertung:
(1012 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
Hallo Stephan,

wenn man unter Mac OS 9 die Layout-Datei auswählt und mit Befehl-I das Informationsfenster öffnet, dann sieht
man in der Öffnung "Kommentar" eine Kurzfassung davon. Diesen Text kann man mit folgendem Script auslesen:
---
set imgPath to (choose file) as string
tell application "Finder" to set opiComment to comment of information window of file imgPath

---

Unter Mac OS X funktioniert dies hier aber nicht, obwohl die Layout-Datei nicht etwa kopiert, sondern direkt
auf dem Server adressiert wird. Im Finder-Verzeichnis sind 'comment' und 'information window' aber immer noch
aufgeführt.

Mit diesem Script, hingegen, kann ich unter Mac OS X die Kommentare ausziehen, welche mit unserem System ans
Ende der Datei geschrieben werden:
---
set imgPath to (choose file) as string
set opiComment to read file imgPath from -334 to eof

---
Das Ergebnis sind die letzten 334 Zeichen der Datei. Je nach Länge des Dateinamens und des übrigen Pfades muss
dieser Wert aber angepasst werden. Kann man eventuell abhängig von der Länge des aktuellen Pfades dynamisch
definieren. Sonst muss ein fixer, grösserer Wert festgelegt werden und dann schmeisst man weg, was nicht zum
Kommentar gehört.

Gruss, Hans


als Antwort auf: [#419646]

OPI Kommentare auslesen

swish
Beiträge gesamt: 75

14. Jun 2005, 10:17
Beitrag # 3 von 3
Beitrag ID: #419648
Bewertung:
(1012 mal gelesen)
URL zum Beitrag
Beitrag als Lesezeichen
So voilá, hier ist mein Ergebnis ...

Man darf sich per "choose file" ein Layoutbild und einen Ausgabeordner auswählen und schon bekommt man das dazugehörige HighResbild kopiert. Scheint mit Helios OPI von Version 2.1 bis 3.1 zu funktionieren.

Das ganze zu einem Batch umzubauen sollte dann nicht der größte Umstand sein.

Als Ergebnis bekommt man zusätzlich eine Textdatei, die einem sagt, welches Feinbild zu welchem Layoutbild gehört ...

Wenn man ein Feinbild auswählt, erscheint in der Textdatei natürlich nichts sinnvolles und es wird auch kein Bild kopiert ...

Falls jemand das Skript anwenden kann, bin ich natürlich für jegliches Feedback dankbar ...

Beste Grüße,

Stephan


------------------------------

set imgPath to choose file with prompt "Bitte Bild wählen!"
set imgPath to imgPath as string

--set Schreibtisch to
set LogDatei to (path to desktop as string) & "OPI_Finder.log"
global LogDatei

on open DroppedItems
 set Ziel to choose folder with prompt "Bitte den Ausgabeordner wählen !"
 repeat with imgPath in DroppedItems
  set imgPath to imgPath as string
  set newImg to my GetNewImagePath(imgPath)
  -- writeLog(imgPath)
  try
   tell application "Finder" to copy file newImg to folder Ziel
  end try
 
  writeLog(("Laybild: " & imgPath))
  writeLog(("Feinbild: " & newImg))
 
 end repeat
end open


on GetNewImagePath(imgPath)
 set opiCommentAktuell to read file imgPath from -600 to eof
 set opiComment25 to read file imgPath from 1 to 900
 set AltesHelios to "HELIOS ImageServer"
 set NochAelteresHelios to "Helios OPI Version 2.1"
 
 if opiComment25 contains AltesHelios or opiComment25 contains NochAelteresHelios then
  -- tell application "Finder" to say "Old O P I"
  -- Altes Helios Layout hat den OPI Kommentar am Anfang
  set oldDelims to AppleScript's text item delimiters
  set AppleScript's text item delimiters to "%%MainImage"
  set Temp to text item 2 of opiComment25
  set AppleScript's text item delimiters to oldDelims
 
 
 
  set oldDelims to AppleScript's text item delimiters
  set AppleScript's text item delimiters to "%HELRefID"
  set Temp2 to text item 1 of Temp
  set AppleScript's text item delimiters to oldDelims
 
  set oldDelims to AppleScript's text item delimiters
  set AppleScript's text item delimiters to "}/"
  set Temp3 to text item 2 of Temp2
  set AppleScript's text item delimiters to oldDelims
 
  set AppleScript's text item delimiters to ""
  set Temp4 to (text items 1 thru -3 of Temp3) as string
 
  set oldDelims to AppleScript's text item delimiters
  set AppleScript's text item delimiters to "/"
  set Temp5 to text items 3 thru -1 of Temp4
  set AppleScript's text item delimiters to oldDelims
 
  set Pfad to ""
 
  repeat with i from 1 to the count of Temp5
   set Pfad to Pfad & text item i of Temp5 & ":"
  end repeat
 
  set Feindatei to (text items 1 thru -2 of Pfad) as string
 
 
 else
  -- Aktuelles Bild hat den OPI Kommentar am Ende
  try
   set oldDelims to AppleScript's text item delimiters
   set AppleScript's text item delimiters to "/"
   set Pfad to every text item of opiCommentAktuell
   set AppleScript's text item delimiters to oldDelims
  end try
  try
   set Abgehackt to last item of Pfad as string
  end try
  try
   set AppleScript's text item delimiters to "OriginColor"
   set Bildname to text item 1 of Abgehackt
   set AppleScript's text item delimiters to oldDelims
  end try
 
  try
   set DerPfad to items -2 thru -9 of Pfad
  end try
 
  set DerRichtigePfad to "" as string
 
  repeat with i from 3 to 8
   try
    set DerRichtigePfad to (DerRichtigePfad & item i of DerPfad & ":") as string
   end try
  end repeat
  try
   set Feindatei to (DerRichtigePfad & Bildname) as string
  end try
 end if
 
end GetNewImagePath


on writeLog(NeuesBild)
 
 set returnChar to (ASCII character 13)
 
 tell application "Finder"
 
 
  if not (exists file LogDatei) then
   open for access file LogDatei with write permission
   set eof of file LogDatei to 0
  end if
 
  write NeuesBild & returnChar to file LogDatei starting at eof
 end tell
 
end writeLog


als Antwort auf: [#419646]
(Dieser Beitrag wurde von swish am 31. Mai 2010, 09:34 geändert)