[Gambas-user] Output to Libre Office Writer ??

rocko sunblaster5 at ...626...
Tue Apr 2 19:02:31 CEST 2013


Thanks for the input :)
But I'm getting an error now:
'_/Type mismatch expected file got string instead/_'

/newFile is AS String /so I don't know why I would get this error.

Full Code:
' Gambas module file

Public nFile As File
Public fName As String
Public xName As String

Public Sub Main()
Dim mName As String
Dim newFile As File

mName = "Rocko"
fName = "/home/rocko/Documents/Proposal.odt"
xName = "/home/rocko/Zip/content.xml"

If Exist(fName) Then /'test if file exists using th testFile function/
   testFile()
   Print "File found"
   Shell "unzip " & fname & " -d /home/rocko/Zip" Wait /'open a shell 
window and unzip the file/

   newFile = Replace(File.Load(xName), "$(Name)", mName)
   File.Save(xName, newFile)
   Shell "cd /home/rocko/Zip;zip -r  Proposal.odt ." Wait /'re-zip the file/

  Else
     Print "File not found"
     Print nFile
     Print fName
     Shell "ls"


Endif
End

Sub testFile() /' function for opening file for read and write/
nFile = Open fName For Read Write
End





On 04/02/2013 03:34 AM, Fabien Bodard wrote:
> Le 2 avr. 2013 01:37, "rocko" <sunblaster5 at ...626...> a écrit :
>> Not sure I'm using /Replace$/ correctly.
>> I want to replace instance of $(Name) in the XML file
>> with the value of the /mName/ variable
>>
>> Code:
>> /xName = "home/rocko/Zip/content.xml"//
>> // newFile = Replace$(xName, "$(Name)", mName)/
> Newfile=replace (file. Load(xname), "$(Name )",mname )
> File. Save(xname, newfile)
>> Of course this doesn't work, But I don't know why
>>
>> On 03/31/2013 05:21 PM, Benoît Minisini wrote:
>>> Le 01/04/2013 01:32, rocko a écrit :
>>>> I actually tried that after sending my response.
>>>> lo and behold! XML file woo hoo!
>>>>
>>>> So I assume I can just do a search thru th XML file and change things
>>>> then re-save
>>>> the file and re-zip it like you said.
>>>>
>>>>
>>>>
>>>> So how do I unzip and re-zip a file in Gambas?, sorry  this is kinda
> new
>>>> to me.
>>> SHELL "zip ..." WAIT
>>>
>>> SHELL "unzip ..." WAIT
>>>
>>> That run the shell commands as if you typed them in a terminal.
>>>
>>> There is a compression component that allows you to do the same thing
>>> without running external process, but it is a more complex to explain.
>>>
>>>> Which kind of search functions does gambas have?? regex I assume, any
>>>> others??
>>>>
>>> I use Replace$(). No need for regexp. If your search pattern are like
>>> "$(field name)", you won't mix up with any OpenOffice XML syntax.
>>>
>>> Don't forget to look at XML format for correctly quoting characters that
>>> must be quoted.
>>>
>>> Regards,
>>>
>>
> ------------------------------------------------------------------------------
>> Own the Future-Intel® Level Up Game Demo Contest 2013
>> Rise to greatness in Intel's independent game demo contest.
>> Compete for recognition, cash, and the chance to get your game
>> on Steam. $5K grand prize plus 10 genre and skill prizes.
>> Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
> ------------------------------------------------------------------------------
> Own the Future-Intel(R) Level Up Game Demo Contest 2013
> Rise to greatness in Intel's independent game demo contest. Compete
> for recognition, cash, and the chance to get your game on Steam.
> $5K grand prize plus 10 genre and skill prizes. Submit your demo
> by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
> .
>




More information about the User mailing list