+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12

Thread: Reading local file using Dekiscript

  1. #1

    Default Reading local file using Dekiscript

    Hi all

    I want to create a dynamic wiki page by writing a script which creates a table according to a file which can be located like openning it in a web browser, like: file://path/filename.txt.

    So i want to parse the file and then write a dynamic html according to it.
    My quation is, how to access this file? How do I open a file in Dekiscript? How do I read its contents in Dekiscript?

    Any help is appreciated.

    Thanks,
    Moshiko

  2. #2
    Join Date
    Jul 2006
    Location
    San Diego, CA
    Posts
    5,450

    Default

    DekiScript cannot access files from disk. You would have to make the file accessible via http:// and then you can use web.text() or web.xml() to load the contents and display on a page.
    Steve G. Bjorg - Chief Architect
    Did you check the MindTouch FAQ?
    Found a bug? Report it.
    Follow me on Twitter
    Find us on IRC: irc.freenode.net #mindtouch

  3. #3

    Default What does this error means?

    I tried:

    {{ web.text("file:///c:/test.txt") }}

    And got:

    (unable to fetch text document from uri [status: 1 (NoEndpointFound)])

    What am I doing wrong?

    Thanks,
    moshiko

  4. #4
    Join Date
    Jul 2006
    Location
    San Diego, CA
    Posts
    5,450

    Default

    web.text tries to read the file and display it. You cannot have the server read a file that is local on your machine and display it.
    Steve G. Bjorg - Chief Architect
    Did you check the MindTouch FAQ?
    Found a bug? Report it.
    Follow me on Twitter
    Find us on IRC: irc.freenode.net #mindtouch

  5. #5

    Default is there a way around?

    Hi Steve

    Thanks for the quick reply.
    Is there a way to overcome this so thatweb.text will "think" my file is not a local one?
    The file is not really on a local machine. It is on a network, \\server\file

    My idea is to have the wiki build a dynamic html page based on that file which can be modified.

    I am looking for a way to acomplish this.
    The idea is that each time someone will open the wiki value I contributed to the wiki, he will get different html page. Think of this page as a growing table of released versions.

    I want to do it all by a script so that the wiki page would be modified automatically by a script.

    Thanks for all the help,
    Moshiko

  6. #6
    Join Date
    Jul 2006
    Location
    San Diego, CA
    Posts
    5,450

    Default

    If you place the test.txt into a web-accessible folder, it will work fine (e.g. http://server/some_web_folder/test.txt). You could also attach the file to the page dynamically using the API and curl.
    Steve G. Bjorg - Chief Architect
    Did you check the MindTouch FAQ?
    Found a bug? Report it.
    Follow me on Twitter
    Find us on IRC: irc.freenode.net #mindtouch

  7. #7

    Default

    Hi Steve

    What does it mean API and curl?

    thanks,
    Moshiko

  8. #8
    Join Date
    Jul 2006
    Location
    San Diego, CA
    Posts
    5,450

    Default

    If these don't mean anything to you, they are likely not be the right tool for you.
    Steve G. Bjorg - Chief Architect
    Did you check the MindTouch FAQ?
    Found a bug? Report it.
    Follow me on Twitter
    Find us on IRC: irc.freenode.net #mindtouch

  9. #9

    Default

    Steve

    What do you mean this is not the tool for me? Why not explain what is it and how to to do it? this is important to me...

    Moshiko

  10. #10
    Join Date
    Jul 2006
    Location
    San Diego, CA
    Posts
    5,450

    Default

    I'm trying to point you in the right direction. The best direction is the one that relies on tools you're already familiar with. I recommend you look at putting your file into a web-accessible folder. It's pretty straightforward and requires no programming.
    Steve G. Bjorg - Chief Architect
    Did you check the MindTouch FAQ?
    Found a bug? Report it.
    Follow me on Twitter
    Find us on IRC: irc.freenode.net #mindtouch

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts