RagTime and AppleScript

Good morning.

Sorry this has to be in English.

This is an AppleScript problem. We have a 10 page document that has a two columns with a text flow in each column.

Language A is on the left and Language B on the right.

We have an AppleScript which we use to switch the content of the containers as required. For example Language B on the left and Language A on the right.

We wish to redesign our document so the chapters (each language) are 'stacked'. We then have one column (text flow) on the page Language A and Language B is a new set of pages that follows with is own container.

I can do this with our existing AppleScript providing that the document is only one page long. It does not work when we have more than one page for each language unless the AppleScript is modified.

The script has to be told on what page (number) the container of second langauge starts. This is ok if the document is static and the number of pages always remains the same. However languages have different lengths. A text translated out of German into English has more text and the numer of pages is increased. It is then necessary to manually change the Applescript each time.

So, the question. Is it possible to make RagTime look for the relevant container and ignore the page numbers. The small bit of script below is how the the text is put in the relevant container. The aim is to replace the 'page 1' with a search for the start of the container irrelevant of which page it is on.

set contents of rectangle "deutscher Text" of page 1 of layout "•Layout zweisprachig" of document 1 to text flow "• deutsch" of document 1

Sorry, but I don't know how to show the script in colour in this window. Finally, I am preparing a sample document that I can send but it will not be ready until next week.

Thank you

Re: RagTime and AppleScript

#11639 On 28 März, 2014 19:17 Thomas Kaegi said,

Hello Stephen

I hope I got your problem correctly. Here is my solution (I will send you the respective document by PM):

It is all done in a single document. I'm starting with Layout 1 which has 2 containers side by side, each with a vertical pipeline running over the pages. The pipeline in the containers on the left is the German text "Text D", the containers on the right contain "Text E". Important details:
1: The English text ends with a "new paragraph"
2: In the German text the "next container" format option is specified for the first paragraph

The document has a second layout with only one container on the page. It contains the text flow "Text C" which, at the outset, is empty. The following script will combine the two texts "Text E" and "Text D" in this order in "Text C". Because of the paragraph format option of the first paragraph of the German text, this part of the combined text will automatically begin on a new page.

Here is the script:
tell application "RagTime 6.5"
select text flow "Text E" of document 1
copy
select text flow "Text C" of document 1
paste
select text flow "Text D" of document 1
copy
select end of text flow "Text C" of document 1
paste
end tell

I hope this helps!
Regards, Tom

Re: RagTime and AppleScript

#11640 On 28 März, 2014 21:33 Stephen Motzkeit said,

Hi Tom
Thanks for the reply, especially in English. German is also ok, I just don't write it. You didn't quite understand the problem. You got it right with D on the left and E on the right. We want to replace his layout completly as part of a redesign of the documentation, with D on top as chapter 1 and E behind it as a chapter 2. To avoid getting too complex here I will send you an example of the existing system and and example of what we want to do by pm as soon as I am back in the office. You will then be able to see the scripts.

Regards
Stephen

Re: RagTime and AppleScript

#11641 On 28 März, 2014 21:59 Listenteilnehmer said,

Moin, Stephen,

ich hatte noch nicht verstanden, von wo Deine zwei Textabsätze in zwei
Sprachen überhaupt kommen. Und ich dachte, man könnte doch Sprache 1
und Sprache 2 jeweils in 1 Textabschnitt zusammenkopieren und davon
dann mehrere aneinanderreihen.

Wenn ich nun Thomas’ Antwort lese, hat Thomas genau das beschrieben,
was ich auch dachte, nur daß er eben näher an RagTime argumentiert.

Bin gespannt, wie die Lösung zum Schluß aussieht. Wenn Deine Texte aus
einem Rechenblatt mit mehrzeiligem Text kommen, käme auch der Suchlauf
in Frage. AppleScript würde dann nicht gebraucht.

Norbert Lindenthal, Bad Ems
the mailing list .
To unsubscribe, E-mail to:
To switch to the DIGEST mode, E-mail to
To switch to the INDEX mode, E-mail to
Send administrative queries to

Re: RagTime and AppleScript

#11642 On 31 März, 2014 14:09 Stephen Motzkeit said,

Good afternoon

I have prepared two documents. The as is situation and (still under development) a second document with the direction we want to go. I will send them to you both as pm. Sorry folks.

I have managed to get it to work with three pages. As soon as the second half of the document increases by a page the script has to be changed so that it nows where the first page of the second language starts, otherwise it does not work. This is very time consuming. I want the script to be told automatically where the first page of the second document is.

I have reduced the documents to three languages (Lorum ipsum) as I can't send you a current file.

To change language. Select the languages in the buttons and then click on 'DrÜck mich'. The 'Mehrsprachenlayout' is just a copy of the language text and has no relevance for the script.

Thanks Stephen

Re: RagTime and AppleScript

#11644 On 8 April, 2014 14:47 Thomas Kaegi said,

Hello Stephen

I have now had a chance to look at the two documents you sent me by PM. The problem is far more complicated than you have described. You are working with master layouts (Stammlayout) and try to assign these dynamically. Every time I have tried to do this I ran into problems.

The solution I have already provided in the RagTime Forum is a general approach, but cannot be used straight away in your document. Your case is too specific to be of interest for the forum. I will contact you via PM.

Regards, Tom

Re: RagTime and AppleScript

#11643 On 1 April, 2014 09:08 jacques villars said,

Hello Stephen,

it would be greatly interesting that you post your file in the download field of RagtimeExperts: Download-Bereich/Mac-Ecke/Applescript:

http://experts.ragtime.de/experts/taxonomy_menu/1/3/30

Best regards

jacques