Hallo Kirsten,
eine kleine Beschreibung sollte iin jedem Script stehen. Entweder am Anfang oder
im Textfeld "Beschreibung". Im ersten Fall muss man die Zeilen "auskommentieren",
das heisst, sie wie Kommentare bezeichnen, damit sie das Scripting System beim
Überprüfen oder Ausführen des Codes ignoriert.
Zum Auskommentieren setzt man entweder je zwei Bindestriche vor jede Zeile ...
-- dies ist ein Kommentar
... oder man fasst mehrere Zeilen mit Klammer und Sternchen ein:
(* mehr als eine
Zeile Beschreibung *)
Doch was ich meinte sind Tests, welche prüfen, ob die Anwenderin den Kopf bei
der Sache hat. Oder nicht. ;-)
Wenn zum Beispiel kein Dokument geöffnet oder nichts ausgewählt ist, dann kommt
beim Starten des Scripts eine Fehlermeldung, welche nur lapidar sagt:
[nbsp]»"InDesign CS" hat einen Fehler erhalten: "contents of last insertion point of
selection of document 1" kann nicht als ""<0008>"" gesetzt werden.[nbsp]«
Und wenn der Textrahmen ausgewählt ist, welcher die Tabelle enthält, dann wird
der Zeilenspalter zwar ohne Fehlermeldung eingesetzt, aber ans Ende der Textkette.
Aus diesen Gründen sollte das Script ungefähr so aussehen:
---
(*[color=#4C4D4D] Zeilenspalter.scpt
[/color][color=#4C4D4D][nbsp] Ein Script zum Einsetzen des Zeichens "Tabulator für Einzug rechts"
[nbsp] an der Cursorposition
[/color]*)
[#0000FF]tell[/#] [#0000FF]application[/#] "InDesign CS"
[nbsp] [nbsp] [nbsp] [#0000FF]if[/#] ([#0000FF]count[/#] [#0000FF]documents[/#]) [#0000FF]is[/#] 0 [#0000FF]then[/#]
[nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [#0000FF]display dialog[/#] "Bitte ein Dokument öffnen." [#0000FF]buttons[/#] "OK" [#0000FF]default button[/#] 1 [#0000FF]with icon[/#] 2
[nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [#0000FF]error[/#] [#0000FF]number[/#] -128
[nbsp] [nbsp] [nbsp] [#0000FF]end[/#] [#0000FF]if[/#]
[nbsp] [nbsp] [nbsp] [#0000FF]tell[/#] [#0000FF]document[/#] 1
[nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [#0000FF]set[/#] curSel [#0000FF]to[/#] [#0000FF]selection[/#]
[nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [#0000FF]if[/#] curSel [#0000FF]is[/#] {} [#0000FF]then[/#]
[nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [#0000FF]display dialog[/#] "Es ist nichts ausgewählt." [#0000FF]buttons[/#] "OK" [#0000FF]default button[/#] 1 [#0000FF]with icon[/#] 2
[nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [#0000FF]error[/#] [#0000FF]number[/#] -128
[nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [#0000FF]end[/#] [#0000FF]if[/#]
[nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [#0000FF]if[/#] [#0000FF]class[/#] [#0000FF]of[/#] [#0000FF]item[/#] 1 [#0000FF]of[/#] curSel [#0000FF]is[/#] [#0000FF]not[/#] [#0000FF]insertion point[/#] [#0000FF]then[/#]
[nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [#0000FF]display dialog[/#] "Bitte die Einfügemarke in den Text einfügen." [#0000FF]buttons[/#] "OK" [#0000FF]default button[/#] 1 [#0000FF]with icon[/#] 0
[nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [#0000FF]error[/#] [#0000FF]number[/#] -128
[nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [#0000FF]end[/#] [#0000FF]if[/#]
[nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [#0000FF]tell[/#] [#0000FF]selection[/#]
[nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [#0000FF]set[/#] [#0000FF]contents[/#] [#0000FF]of[/#] [#0000FF]insertion point[/#] -1 [#0000FF]to[/#] "<0008>"
[nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [#0000FF]end[/#] [#0000FF]tell[/#]
[nbsp] [nbsp] [nbsp] [#0000FF]end[/#] [#0000FF]tell[/#]
[#0000FF]end[/#] [#0000FF]tell[/#]
---
Die Befehle 'error number -128' brechen die Ausführung des Scripts ab, falls einer der
davorstehenden Dialoge gezeigt werden musste.
Gruss, Hans