Saving datas with RapaGUI

Find quick help here to get you started with Hollywood

Saving datas with RapaGUI

Postby Pierre55 » Mon May 01, 2017 11:46 pm

Hi,

I'm looking the way to save datas like in the demo "dialogs" in Rapagui plugin.

Hope this is possible.

Thank you.

Pierre.
Pierre55
 
Posts: 17
Joined: Sat Apr 01, 2017 4:25 pm

Re: Saving datas with RapaGUI

Postby airsoftsoftwair » Tue May 02, 2017 9:40 pm

Please describe in more detail what you want to do. The question is currently too general...
User avatar
airsoftsoftwair
 
Posts: 2238
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany

Re: Saving datas with RapaGUI

Postby Pierre55 » Tue May 02, 2017 11:44 pm

Hi,

I want to add the LOADING and SAVING function into the DIALOGS demo program wich came with RapaGUI plugin.

I add the OPEN, SAVE and SAVE_AS in the pulldown menu but can't figure what I shoud do to open or save the data I enter.

I tryed different version of: StringToFile(What should I wrote here?), projectname$)

Thank you.
Pierre55
 
Posts: 17
Joined: Sat Apr 01, 2017 4:25 pm

Re: Saving datas with RapaGUI

Postby airsoftsoftwair » Tue May 02, 2017 11:54 pm

Pierre55 wrote:StringToFile(What should I wrote here?), projectname$)


Depends on what you want to write to the file. If you want to write "Hello" to the file, you use:

Code: Select all
StringToFile("Hello", "test.txt")


This will create a new file named "test.txt" in the current directory and write "Hello" into it. File size will be 5 bytes.
User avatar
airsoftsoftwair
 
Posts: 2238
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany

Re: Saving datas with RapaGUI

Postby Pierre55 » Wed May 03, 2017 1:26 am

Hi,

You need to RUN the DIALOGS demo in RapaGui to understand that I want to save all the datas you input.

Thanks
Pierre55
 
Posts: 17
Joined: Sat Apr 01, 2017 4:25 pm

Re: Saving datas with RapaGUI

Postby Pierre55 » Wed May 03, 2017 1:48 pm

Hi,

Here it's the line that "editor" saved the text;

StringToFile(moai.Get("editor", "text"), projectname$)

Is there something like this I can use to save the datas in Dialogs ?

Thank you.
Pierre55
 
Posts: 17
Joined: Sat Apr 01, 2017 4:25 pm

Re: Saving datas with RapaGUI

Postby airsoftsoftwair » Sun May 07, 2017 5:40 pm

Sure, you need to use Listview.GetEntry to iterate over all items in the listview and then save them to a text file, e.g. something like this (not tested, from the top of my head):

Code: Select all
OpenFile(1, "output.txt", #MODE_WRITE)
For Local k = 0 To moai.Get("lv", "entries")-1
    Local t$ = moai.DoMethod("lv", "getentry", k)
    WriteLine(1, t$)
Next
CloseFile(1)
User avatar
airsoftsoftwair
 
Posts: 2238
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany

Re: Saving datas with RapaGUI

Postby Pierre55 » Sun May 07, 2017 11:10 pm

Thank you for the info but I have two problems, there is an error when I run the program "Unexpected symbol!" current line 187.

The second problem it's Hollywood that give the error at the wrong line because there is nothing at line 187.
It seems that the line reported is always +1.

So the error is on the line that said:
WriteLine(1, t$)

Bye!
Pierre55
 
Posts: 17
Joined: Sat Apr 01, 2017 4:25 pm

Re: Saving datas with RapaGUI

Postby airsoftsoftwair » Mon May 08, 2017 9:03 pm

Well, it's hard to tell without seeing the complete script. So please post the script here and I'll check...
User avatar
airsoftsoftwair
 
Posts: 2238
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany

Re: Saving datas with RapaGUI

Postby Pierre55 » Wed May 10, 2017 2:46 am

Hi,

First I would like to tell you that I really appreciate your help!

I finally found (with a lot of your help) the way to save the file in CSV format:

Function p_Save()
OpenFile(1, projectname$, #MODE_WRITE)
For Local k = 0 To moai.Get("lv", "entries") -1
Local state, item$, Nom$, Tjrs1$, Prix$, Exp$ = moai.DoMethod("lv", "getentry", k)
Local t$ = item$ .. "," .. Nom$ .. "," .. Prix$ .. "," .. Exp$
WriteLine(1, t$)
Next
CloseFile(1)
EndFunction

Now my next question: How can I do to LOAD the file in dialog window?

Thanks.
Pierre55
 
Posts: 17
Joined: Sat Apr 01, 2017 4:25 pm

Next

Return to Newbie questions

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests