Pasting Data from Runtime Revolution to a Document
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Pasting Data from Runtime Revolution to a Document
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
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
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Pasting Data from Runtime Revolution to a Document
Hi Tom,
You have a couple of odd things in your script I don't understand, but try this:
I'm not sure if that is what you wanted, if not just say.
Simon
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
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Pasting Data from Runtime Revolution to a Document
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.
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.
-
- VIP Livecode Opensource Backer
- Posts: 3990
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Pasting Data from Runtime Revolution to a Document
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:
it opens the document in TextEdit as RTF
Kind regards
Bernd
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
Kind regards
Bernd
Re: Pasting Data from Runtime Revolution to a Document
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.
-
- VIP Livecode Opensource Backer
- Posts: 3990
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Pasting Data from Runtime Revolution to a Document
Hi Tom,
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
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.I'm thinking of ways to input data into powerpoint and other kinds of documents and this gets me started.
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
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: Pasting Data from Runtime Revolution to a Document
Hi,
I never used "send to program" and nobody, even Bernd and his angels staff speaks about it.
I thought that was a way to send a message like "paste text"
Kind regards
Jean-Marc
I never used "send to program" and nobody, even Bernd and his angels staff speaks about it.
I thought that was a way to send a message like "paste text"
Kind regards
Jean-Marc
https://alternatic.ch
Re: Pasting Data from Runtime Revolution to a Document
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
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
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Pasting Data from Runtime Revolution to a Document
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Pasting Data from Runtime Revolution to a Document
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
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