T04 G03 Beispiel 1 /* Program to manipulate a text file */ fileName = "example.txt" /* Write some text to the file */ streamOut = .stream~new(fileName) streamOut~open("write") streamOut~lineOut("Hello, World!") streamOut~lineOut("This is an example file.") streamOut~close /* Read the contents of the file */ streamIn = .stream~new(fileName) streamIn~open("read") do while streamIn~isReady() line = streamIn~lineIn() say line end streamIn~close /* Append some more text to the file */ streamOut = .stream~new(fileName) streamOut~open("append") streamOut~lineOut("This text is appended to the file.") streamOut~close Beispiel 2 /* Program to automate Microsoft Word */ wordApp = .OLEObject~New("Word.Application") wordApp~Visible = .True /* Create a new document */ wordDoc = wordApp~Documents~Add /* Add some text to the document */ wordRange = wordDoc~Content wordRange~Text = "Hello, World!" /* Save the document */ wordDoc~SaveAs("C:\Users\Username\Documents\MyWordDocument.docx") /* Close the document and quit Word */ wordDoc~Close(.True) wordApp~Quit