![]() If you have a text document open in Word, and then you run this script, it should print the plain text of it in the Result pane below the script code. Set content of text object of d to "new text" In the same way you can alter the text in the Word document: tell application "Microsoft Word" ![]() That's the basics to read and write text in Word via Applescript. Set content of text object of d to newContent Now, to use this with REALbasic, create this script: on run Do learn how to add text to existing text or to change fonts etc, you need to read the "Dictionary" of Word, which you can open in the AppleScript Editor, see the File menu. Save it as a script file (file extension. SetContentInActiveWordDocument("the new text") // replaces the text in the opened word file You can now call this SetContentInActiveWordDocument like a function, passing a String to it.Į.g, write: eFile.Launch() // this should open an existing word file if it exists in "eFile" Then drag this script file into your REALbasic project, it'll appear as an item named "SetContentInActiveWordDocument" in italics. To create a table in a word document, things get more complicated, though. You can pass only strings and numbers to a script from RB this way, so if you have an array of values you want to place into a table, you'll have to convert the array values into a string with unique separators, pass this string to the script, in which the string then gets split into the individual fields again.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |