Re: quick xml write question
Move the printing of the Photo and Image tags into the While loop.
VB Code:
Private Sub Command2_Click()
Dim f1 As Integer, jpgurl As String, MyPath As String, Artist As String, xmlpath As String, songpath As String, slidenode As String, songname As String, mp3path As String, f2 As Integer, i As Integer
mp3path = "C:\Program Files\mgamerz\my_images\"
f2 = FreeFile
Open mp3path & "mp3.txt" For Output As #f2 ' if you don't need mp3.txt take out
f1 = FreeFile
Open mp3path & "slides.xml" For Output As #f1
Print #f1, "<?xml version=""1.0""?>"
Print #f1, "<images>"
songname = Dir(mp3path & "\*.jpg") ' get first track
i = 1
While Not Len(songname) = 0
Print #f1, "<photo>"
Print #f1, "<image>"
Print #f1, mp3path & songname
Sleep 100 ' slight pause, needed
songname = Dir ' get next track
Print #f1, "</image>"
Print #f1, "</photo>"
Wend
Print #f1, "</images>"
Close
End Sub
Re: quick xml write question
Re: quick xml write question
just another quick question is there any way I can get the xml to display the image path like this
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<images>
<pic>
<image>my_images\116941_4039.jpg</image>
</pic>
</images>
instead of the full path like this -
<song path>"C:\Program Files\mgamerz\my_images\368041_2353.jpg" title="368041_2353.jpg"/>
I had this problem whe I was dealing with mp3s but I have read the posts about it but I cannot work out how I can acheive it for this
hope someone can help
thanks in advance
R
Re: quick xml write question
Try this...
VB Code:
Private Sub Command2_Click()
Dim f1 As Integer, jpgurl As String, MyPath As String, Artist As String, xmlpath As String, songpath As String, slidenode As String, songname As String, mp3path As String, f2 As Integer, i As Integer
Dim myFolder as string
myFolder = "my_images\"
mp3path = "C:\Program Files\mgamerz\" & myFolder
f2 = FreeFile
Open mp3path & "mp3.txt" For Output As #f2 ' if you don't need mp3.txt take out
f1 = FreeFile
Open mp3path & "slides.xml" For Output As #f1
Print #f1, "<?xml version=""1.0""?>"
Print #f1, "<images>"
songname = Dir(mp3path & "\*.jpg") ' get first track
i = 1
While Not Len(songname) = 0
Print #f1, "<photo>"
Print #f1, "<image>";myfolder;songname;"</image>"
Sleep 100 ' slight pause, needed
songname = Dir ' get next track
Print #f1, "</photo>"
Wend
Print #f1, "</images>"
Close
End Sub
Re: quick xml write question
brilliant - thanks.
Just one other thing, for some of the properties required - I need to include this in the xml file but when I try and add it to my code to write it in the xml file my code messes up - it adds allsorts of qoutation marks and semi colons,
I was thinking of bieng able to add text boxes so the user could input these values but I think that may be too advanced for me
any ideas on this?
<gallery timer="5" order="sequential" fadetime="2" looping="yes" xpos="0" ypos="0">
thanks in advance
R
Re: quick xml write question
To include quotes within a string, simply double them up.
VB Code:
Print #1, "<gallery timer=""5"" order=""sequential"" fadetime=""2"" looping=""yes"" xpos=""0"" ypos=""0"">"
Re: quick xml write question
thats great again thanks, would it be difficult to record values from text or check boxes into that info ie if looping is checked it will set it to yes or the timer on a text box?
thanks again
R