check to see if text file exists?


    Jul 28 2008 | 11:04 pm
    hello,
    how would i check to see if a text file exists?
    i found a post in the javascript forum, but didnt seem like they had much success: https://cycling74.com/forums/index.php?t=msg&goto=137889&rid=0&S=b7cbea944e03f640251c16cc459299e1
    ideally, i'd like to stay in max, rather than javascript... but i cant seem to find an object that will do this. either way any solution would be much appreciated!
    thanks, j

    • Jul 29 2008 | 12:40 am
      much hackier and stoopider then some simple javascript, but...
    • Jul 29 2008 | 3:08 am
      On Jul 28, 2008, at 4:04 PM, justin wrote: > how would i check to see if a text file exists?
      Where do you want to check?
      In the same folder as your patcher?
      Any arbitrary location?
      -C
      Chris Muir cbm@well.com http://www.xfade.com
    • Jul 29 2008 | 5:31 am
      On Jul 28, 2008, at 4:04 PM, justin wrote:
      > i cant seem to find an object that will do this. either way any > solution would be much appreciated!
      I threw together an example of how to query the existence of a file. It's called FileExists, and it's on my examples page: http://www.xfade.com/max/examples/
      Chris Muir cbm@well.com http://www.xfade.com
    • Jul 29 2008 | 6:25 am
      this is a classic "no output is the answer" kind of problem. the workaround for this is to provide a default result that gets overwritten by an actual result. when the process is done, query the state and you'll always get an answer.
      stoopid but effective
      /*j
    • Jul 29 2008 | 6:36 am
      and here's a version that actually works:
      /*j
    • Jul 29 2008 | 8:40 am
      thanks all, the filein solution seems best for my needs.
      its funny that i was staring at filein for a while last night. i thought it would be a contender for this kind of work. but, by that time, i think my brain was fried after too much patching.
      justin
    • Jul 29 2008 | 9:27 am
      weird, under max 4 the filein object responds differently - for a start it only outputs a bang from right outlet...
      anyway i sorta hacked something that seems to work in v4 (based on the examples above):
      justin
    • Oct 28 2015 | 8:50 pm
      if you don't want to have to actually load the file with an object like filein, it can be done more quickly by auto populating a umenu with a prefix message and seeing If your file is on the list.
    • Oct 29 2015 | 9:47 am