Page 1 of 1

relative filePath to XML file

Posted: Thu Aug 13, 2009 7:03 pm
by AlexAdams
I don't really know where to post this subject. I hope here is okay.

I am using this command:
put revCreateXMLTreeFromFile(lvFileName, false, true, false) into lvDocID

Rather than using the answer file command that is used in the XMLDemo stack I want to use a programmed relative path to a known file. How do I phrase that?

I have tried several things, none of which are working.
I've tried putting the file in the same directory as the main stack:
Contacts.xml
I've tried relative phrasing of several sorts:
./HVResources/HawkXMLFiles/Contacts.xml
//HVResources/HawkXMLFiles/Contacts.xml
/HVResources/HawkXMLFiles/Contacts.xml

HVResources is a directory located in the same directory as the main stack.

My greeness must be showing.

I look forward to enlightenment.

Thanks,

Posted: Thu Aug 13, 2009 7:55 pm
by bn
Alex,
try this script:

Code: Select all

on mouseUp
    -- assuming that "HVResources" etc is a directory in the directory where your main stack lives
    -- and that this script is called from your main stack
    put the filename of this stack into tPathToMainStack
    set the itemdelimiter to "/"
    put item 1 to -2 of tPathToMainStack into tMainStackDirectory
    put "/" after tMainStackDirectory
    put tMainStackDirectory & "HVResources/HawkXMLFiles/Contacts.xml" into tFullpathToXMLFile
    put tFullpathToXMLFile
end mouseUp
it should give you the path to the xml file in the message box
regards
Bernd

That works very well.

Posted: Thu Aug 13, 2009 9:57 pm
by AlexAdams
Bernd,

That works well. I needed to name the main stack to get the path, but that's fine with me.

Thanks again,