Results 1 to 7 of 7

Thread: open file possible

  1. #1
    Join Date
    Aug 2005
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default open file possible

    is it even possible to open a file using javascript on something other than web related targets .... in other words open something where the target is on my machines.... C:\Documents and Settings\hayseed\Desktop\ post\600 part1.doc ..... or C:\Documents and Settings\hayseed\Desktop\ post\600 part.jpg

    have no trouble using scripts till i target them to my local files.... have spent unbelievable amount of time google searching and have yet to get it right....... thanks for your thoughts....h

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Locally or remotely? Are you going to be uploading this script to a server?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Aug 2005
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks twey.... locally... if its even possible in the first place , the script might be part of a web page that you could download .... so many could use it....

    of course you would have to have the same named targets for it to work....

    i'm just trying to step through a folders contents, placed in an array in a timed manner.... javascript does that easy with web based items.... if it can open targets in a new browser, a program, it would seem possible to open a jpg, doc, pdf, or such here locally in the proper associated program....

    i have a simple javascript timer and the array is easy enough, its the open part that hanging me up.....

    and i have spent many hours google searching javascript for any clue that it can be done..... i can explain it further if need be...... thanks for your time......h

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    You can just window.open('file://C/Documents%20and%20Settings/hayseed/file.odt').
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Aug 2005
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default thanks

    thanks for the suggestion twey.... it gets me a lot closer.....h

  6. #6
    Join Date
    Aug 2005
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    its possible i'm makin matters worse... this simple timer script works perfect on web based objects.... does anybody see an obvious error when using my local files... any pointers appreciated, not asking for anyone to complete it .....thanks.....h

    <script language="JavaScript">
    // counter and name funtion

    var i = 0;
    function flipbook()
    {


    // set up list of files
    //.mws is just my file ext used here


    chart = new Array()

    chart[0]="C:\desktop\Data\30\MSS\c1.mws"

    chart[1]="C:\desktop\Data\30\MSS\c10.mws"

    // load files
    document.chart[0].mws=chart[i]

    // increment counter
    i=i+1;

    // when at the end, start again
    if(i==101) { i=0; }

    // i believe part of my problem lies in the <img src="chart1.mws" name="chart"> part below
    // twey's suggestion window.open('file://C/Documents%20and%20Settings/hayseed/file.odt').
    }
    </script>
    </head>


    <body onLoad="javascript:setInterval('flipbook()', 1000)">

    <img src="chart1.mws" name="chart">


    </body>

  7. #7
    Join Date
    Aug 2005
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    as a comparrison , this stripped down version works everytime.... but ony with web based targets.... surely there must be a way to subsitute my local files....h

    ==================
    <script language="JavaScript">
    // simple timer
    var i = 0;
    function hayseed()
    {
    // add more if need be
    slidesArray = new Array()

    slidesArray[0]="http://sprott.physics.wisc.edu/fractals/collect/1995/002.JPG"
    slidesArray[1]="http://sprott.physics.wisc.edu/fractals/collect/1995/003.JPG"
    slidesArray[2]="http://sprott.physics.wisc.edu/fractals/collect/1995/010.JPG"





    // load image
    document.images[0].src=slidesArray[i]

    // increment counter
    i=i+1;

    // when at the end, start again
    if(i==101) { i=0; }
    }
    </script>
    </head>
    <body onLoad="javascript:setInterval('hayseed()',5000);">
    <img src="http://sprott.physics.wisc.edu/fractals/collect/1995/1.GIF" name="image">

Bookmarks

Posting Permissions

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