Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sun Nov 19, 2017 8:58 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: GetSaveFolderItem Problem?
PostPosted: Fri May 03, 2013 6:36 am 
Offline
User avatar

Joined: Sun Oct 28, 2012 4:54 am
Posts: 264
Location: Herts, UK
From the examples in the LR I am doing this on a button click. But getting error "GetSaveFolderItem - this item does not exist)

Dim f As FolderItem
Dim fileStream as TextOutputStream
f=GetSaveFolderItem(FileTypes1.Text,"My Info")
If f <> Nil then
fileStream=TextOutputStream.Create(f)
fileStream.WriteLine namefield.text
fileStream.WriteLine addressfield.text
fileStream.WriteLine phonefield.text
fileStream.Close
End if


I have added a Filetype set to the project. Either I have missed something or I am going mad :evil:

Thanks

_________________
Real Studio 2012 R2
SysInfo
BackTrack Linux/BackBox Linux/Debian Lenny/Windows 7/Windows 8/OpenWRT/OpenBSD
& Yes it's me in the Avatar


Top
 Profile  
Reply with quote  
 Post subject: Re: GetSaveFolderItem Problem?
PostPosted: Fri May 03, 2013 8:07 am 
Offline
User avatar

Joined: Fri Nov 10, 2006 4:10 pm
Posts: 1855
Location: Michigan, USA
You can't retrieve a folderitem from the user's browser. This simply can't be done.

In order to "save" something to a browser, you create the file on the server, then use a WebFile and set WebFile.ForceDownload to true. Be sure to use the WebSession.Identifier somewhere (usually a directory to create the file in), so that you don't accidentally overlap multiple sessions doing the same thing.

Hope this helps. :)

_________________
Windows 8 x64
Windows XP Pro SP3
Ubuntu 11.04 via Virtual Box
RS Enterprise 2012r1.1

Programming Tutorials & Free Projects: http://www.JasonTheAdams.com
"Christianity has not been tried and found wanting; it has been found difficult and not tried." - G.K. Chesterton


Top
 Profile  
Reply with quote  
 Post subject: Re: GetSaveFolderItem Problem?
PostPosted: Fri May 03, 2013 8:41 am 
Offline
User avatar

Joined: Sun Oct 28, 2012 4:54 am
Posts: 264
Location: Herts, UK
:wink: Thanks Jason

Basically what I trying to do is. I have a Textarea on a webpage along with a button. When the user clicks the button I somehow grab the text content from the Texarea control and prompt the user to save it as a text file on their local PC.

_________________
Real Studio 2012 R2
SysInfo
BackTrack Linux/BackBox Linux/Debian Lenny/Windows 7/Windows 8/OpenWRT/OpenBSD
& Yes it's me in the Avatar


Top
 Profile  
Reply with quote  
 Post subject: Re: GetSaveFolderItem Problem?
PostPosted: Fri May 03, 2013 9:02 am 
Offline
User avatar

Joined: Fri Nov 10, 2006 4:10 pm
Posts: 1855
Location: Michigan, USA
There's an example just like this in the LR: http://docs.realsoftware.com/index.php/WebFile.Data

Just change "Hello World!" to the contents of your text area. :)

_________________
Windows 8 x64
Windows XP Pro SP3
Ubuntu 11.04 via Virtual Box
RS Enterprise 2012r1.1

Programming Tutorials & Free Projects: http://www.JasonTheAdams.com
"Christianity has not been tried and found wanting; it has been found difficult and not tried." - G.K. Chesterton


Top
 Profile  
Reply with quote  
 Post subject: Re: GetSaveFolderItem Problem?
PostPosted: Fri May 03, 2013 9:15 am 
Offline
User avatar

Joined: Sun Oct 28, 2012 4:54 am
Posts: 264
Location: Herts, UK
:wink: Thanks Jason got it now from the example...

TextFile = New WebFile // TextFile is a property of the web page
TextFile.MimeType = "text/plain"
TextFile.ForceDownload = True // If False, the browser may try to display the file instead of download it
TextFile.FileName = "TextFile.txt"
TextFile.Data = "Hello, world!"
ShowURL(TextFile.URL) // This causes the file to be downloaded


I wish the LR would be a little more friendly at times. IE: In this case "You need to create a new Property
textfile As Webfile' :lol:

_________________
Real Studio 2012 R2
SysInfo
BackTrack Linux/BackBox Linux/Debian Lenny/Windows 7/Windows 8/OpenWRT/OpenBSD
& Yes it's me in the Avatar


Top
 Profile  
Reply with quote  
 Post subject: Re: GetSaveFolderItem Problem?
PostPosted: Fri May 03, 2013 9:31 am 
Offline
User avatar

Joined: Fri Nov 10, 2006 4:10 pm
Posts: 1855
Location: Michigan, USA
I encourage you to sift through the examples, too, as that is pretty well organized. I've learned quite a bit over the years from glancing through those. And there is a /Web/Downloading/Downloading.rbp example that goes over this. ;)

_________________
Windows 8 x64
Windows XP Pro SP3
Ubuntu 11.04 via Virtual Box
RS Enterprise 2012r1.1

Programming Tutorials & Free Projects: http://www.JasonTheAdams.com
"Christianity has not been tried and found wanting; it has been found difficult and not tried." - G.K. Chesterton


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group