charles 0 Posted January 12, 2012 Report Share Posted January 12, 2012 I have a bot that loops through some steps including opening a local file and doing stuff with the data.The problem that comes up is the bot will stop with an error if the file it tries to open doesnt exist. So, is there an easy way to check to see if the file exists before opening it? I have ideas for a complicated way using the get files, but I figured there might/should be an easier way. And bring up the get files... I tried using that with the path off and it still brings in the path. Thanks -Charles Quote Link to post Share on other sites
Saxon 1 Posted January 12, 2012 Report Share Posted January 12, 2012 a BIG plus one for this please! Quote Link to post Share on other sites
LoWrIdErTJ - BotGuru 904 Posted January 12, 2012 Report Share Posted January 12, 2012 only way is to add list to list (get files) for content Then use a if command to regex the entire list if it exists then do something else do something else 1 Quote Link to post Share on other sites
JohnB 255 Posted January 12, 2012 Report Share Posted January 12, 2012 You can also write the get files results to a new browser and use if--->exists John 1 Quote Link to post Share on other sites
Saxon 1 Posted January 16, 2012 Report Share Posted January 16, 2012 You can also write the get files results to a new browser and use if--->exists John Thanks John, is it possible to get some code for this? I can't even find the write to browser function that used to be in 3.5. Quote Link to post Share on other sites
JohnB 255 Posted January 16, 2012 Report Share Posted January 16, 2012 It's called Load HTML now under browser commands. John 1 Quote Link to post Share on other sites
ron3000 2 Posted January 16, 2012 Report Share Posted January 16, 2012 this is how i'm doing it: define $file_exists(#if_exists_filename) { clear list(%fileslist) add item to list(%fileslist, $get files($special folder("Application"), "No"), "Delete", "Local") if($contains(%fileslist, #if_exists_filename)) { then { set(#file_exist_found, $true, "Global") } else { set(#file_exist_found, $false, "Global") } } return(#file_exist_found) } 2 Quote Link to post Share on other sites
Saxon 1 Posted January 16, 2012 Report Share Posted January 16, 2012 this is how i'm doing it: define $file_exists(#if_exists_filename) { clear list(%fileslist) add item to list(%fileslist, $get files($special folder("Application"), "No"), "Delete", "Local") if($contains(%fileslist, #if_exists_filename)) { then { set(#file_exist_found, $true, "Global") } else { set(#file_exist_found, $false, "Global") } } return(#file_exist_found) } Thanks mate, that's a great solution! Quote Link to post Share on other sites
charles 0 Posted January 17, 2012 Author Report Share Posted January 17, 2012 this is how i'm doing it: define $file_exists(#if_exists_filename) { clear list(%fileslist) add item to list(%fileslist, $get files($special folder("Application"), "No"), "Delete", "Local") if($contains(%fileslist, #if_exists_filename)) { then { set(#file_exist_found, $true, "Global") } else { set(#file_exist_found, $false, "Global") } } return(#file_exist_found) } This worked great for me.Thanks Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.