Page 1 of 1

Pasting Data from Runtime Revolution to a Document

Posted: Wed Mar 13, 2013 7:16 pm
by trailboss
I want to make an application that takes data from a runrev field and pastes it into a document like word, or powerpoint, etc.

I've tried lots of the scripting I've found and it doesn't work for me.

Here's my try now. It opens the file, but doesn't paste. I need to do this another way. Many thanks! TOM IN ARIZONA

on mouseUp
put cd fld sortfield into x
set the clipboardData ["text"] to x
put "/users/tomcole/test.rtf" into tfilepath
launch document tfilepath
get the clipboardData
write the clipboardData to file tfilepath
end mouseup

Re: Pasting Data from Runtime Revolution to a Document

Posted: Wed Mar 13, 2013 11:30 pm
by Simon
Hi Tom,
You have a couple of odd things in your script I don't understand, but try this:

Code: Select all

on mouseUp
   set the defaultFolder to specialFolderPath("desktop")
   put fld "sortfield" into url "file:test.rtf"
   launch document "test.rtf"
end mouseUp
I'm not sure if that is what you wanted, if not just say.

Simon

Re: Pasting Data from Runtime Revolution to a Document

Posted: Thu Mar 14, 2013 12:20 am
by trailboss
Well, it opened the file once I think when I put it on the desktop as I guess the script says, but nothing was pasted into the file.

Also, I couldn't ever get it to launch the document again. It just says "the document 'test.rft' could not be opened." It has been corrupted somehow. Now I can't open it at all.

I keep making a new file with the same name, and it immediately becomes unusable when I click the button.

Re: Pasting Data from Runtime Revolution to a Document

Posted: Thu Mar 14, 2013 12:33 am
by bn
Hi Tom,

well your file ending signifies RTF (rich text format) but you put plain text into the document.

I tried the following code on a Mac and it works:

Code: Select all

on mouseUp
   set the defaultFolder to specialFolderPath("desktop")
   put the rtfText of fld "sortfield" into url "file:test.rtf"
   launch document "test.rtf"
end mouseUp
it opens the document in TextEdit as RTF

Kind regards
Bernd

Re: Pasting Data from Runtime Revolution to a Document

Posted: Thu Mar 14, 2013 1:15 am
by trailboss
Wow. That sure works. Thanks all around. I'm thinking of ways to input data into powerpoint and other kinds of documents and this gets me started.

Re: Pasting Data from Runtime Revolution to a Document

Posted: Thu Mar 14, 2013 10:17 am
by bn
Hi Tom,
I'm thinking of ways to input data into powerpoint and other kinds of documents and this gets me started.
mind you Powerpoint and many other programs have their unique file/data structure. It will probably not be possible to generate documents in above way for them.

You would have to explain more in detail what you are trying to achieve. Using the clipboard might be possible depending on object type.

Kind regards
Bernd

Re: Pasting Data from Runtime Revolution to a Document

Posted: Thu Mar 14, 2013 11:32 am
by jmburnod
Hi,
I never used "send to program" and nobody, even Bernd and his angels staff speaks about it. :shock:
I thought that was a way to send a message like "paste text"

Kind regards
Jean-Marc

Re: Pasting Data from Runtime Revolution to a Document

Posted: Fri Mar 15, 2013 4:13 pm
by trailboss
Well, I have another question.

Here's how I have learned to create a powerpoint document and "paste" data into it. The field MyData has five lines of text. When this script is run, it creates a PPT document with five "slides." There's a "slide" for each line. Each line of text is the TITLE of the slide. Good so far, but how can I also "paste" data into the TEXT area below the PP slide title? Can I create perhaps some two-tiered hierarchy within Runtime Rev and then create a PP doc with slides containing BOTH a title AND the text below it -- or even add a graphic?

Thanks in advance for your help

on mouseUp
open file specialFolderPath("desktop") & "/Data in a PowerPoint Document.ppt" for write
put cd fld "MyData" into localvariable
put localvariable into myText
write myText to file specialFolderPath("desktop") & "/Data in a PowerPoint Document.ppt"
close file specialFolderPath("desktop") & "/Data in a PowerPoint Document.ppt"
launch document specialFolderPath("desktop") & "/Data in a PowerPoint Document.ppt"
end mouseUp

Re: Pasting Data from Runtime Revolution to a Document

Posted: Fri Mar 15, 2013 11:00 pm
by Simon

Re: Pasting Data from Runtime Revolution to a Document

Posted: Fri Mar 15, 2013 11:15 pm
by trailboss
Nice! It does just what I wanted it to do.

Just tabs for the hierarchy. What could be simpler? I should have thought I would have hit upon that myself!
Thanks very much indeed.

Any ideas on writing something in the file that will put a graphic on the slide? Or should I make a new Topic for that?

Tom in Arizona