Guest User

Applescript Ragtime XML Import

a guest
Apr 22nd, 2012
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. tell application "RagTime 6"
  2.     activate
  3.    
  4.     set theSelection to (choose file {} with multiple selections allowed)
  5.     set i to 1
  6.     set theAnzahl to number of items in theSelection
  7.    
  8.     open layout 1 of document 1
  9.    
  10.     repeat with i from i to theAnzahl
  11.         set theFile to item i of theSelection as text
  12.         tell application "System Events"
  13.             tell XML element 1 of contents of XML file theFile
  14.                 set vorname to (value of (XML elements whose name is "vorname")) as string
  15.                 set nachname to (value of (XML elements whose name is "name")) as string
  16.                 set geburtstag to (value of (XML elements whose name is "geb")) as string
  17.                 set kommentare to (value of (XML elements whose name is "kommentare")) as string
  18.                 set spitznamen to (value of (XML elements whose name is "stbr1")) as string
  19.                 set leistungsk to (value of (XML elements whose name is "stbr2")) as string
  20.                 set lebensmotto to (value of (XML elements whose name is "stbr3")) as string
  21.                 set hobbies to (value of (XML elements whose name is "stbr4")) as string
  22.                 set ichmag to (value of (XML elements whose name is "stbr5")) as string
  23.                 set ichmagnicht to (value of (XML elements whose name is "stbr6")) as string
  24.                 set unvergesslich to (value of (XML elements whose name is "stbr7")) as string
  25.                 set nachdemabi to (value of (XML elements whose name is "stbr8")) as string
  26.                 set jahreschule to (value of (XML elements whose name is "stbr9")) as string
  27.             end tell
  28.         end tell
  29.        
  30.         if i > 1 then
  31.             make new page at after page (i - 1) of layout 1 of document 1
  32.         end if
  33.         set contents of rectangle 1 of page i of layout 1 of document 1 to "Leistungskurse: " & leistungsk
  34.         set contents of rectangle 2 of page i of layout 1 of document 1 to "Kommentare der Stufe: " & kommentare
  35.         set contents of rectangle 3 of page i of layout 1 of document 1 to "Spitznamen: " & spitznamen
  36.         set contents of rectangle 4 of page i of layout 1 of document 1 to "Spitznamen: " & spitznamen
  37.         set contents of rectangle 5 of page i of layout 1 of document 1 to "Hobbies: " & hobbies & "
  38.         Ich mag: " & ichmag & "
  39.         Ich mag nicht: " & ichmagnicht & "
  40.         Unvergessliche Momente: " & unvergesslich & "
  41.         Nach dem Abi: " & nachdemabi & "
  42.         12 Jahre Schule waren: " & jahreschule
  43.         set contents of rectangle 6 of page i of layout 1 of document 1 to "Spitznamen: " & spitznamen & "
  44.         Geburtstag: " & geburtstag & "
  45.         Leistungskurse: " & leistungsk
  46.         set contents of rectangle 7 of page i of layout 1 of document 1 to vorname & " " & nachname
  47.         set contents of rectangle 8 of page i of layout 1 of document 1 to file ":Users:User_01:Desktop:dummypicture.jpeg"
  48.        
  49.     end repeat
  50. end tell
Advertisement
Add Comment
Please, Sign In to add comment