There is this IMacro scripting tool, if you want to automate some web page visits by using javascript.
I would like to have my javascript to read from a local .txt file (not a .cvs file and not well formatted.. I would like to search in it probably with a regular expression..) and based on that reading, the script will do some job in IMacros.. (e.g call some web site url etc..)
Do you guys have any idea how this can be done ? I am doing everything local and that is my local browser reading from my local hard drive.. it should be somehow possible.. but how ?
in Firefox you can read the file directly.
more info at https://developer.mozilla.org/en-US/Add-ons/Code_snippets/File_I_O#Line_by_line
to read file line by line use the following
Yes you can do it with imacros, but you need to call it from javascript.js file. load your content as one block, then you can use javascript indexOf method to find the string in the text and perform if statement. Text example (inside your txt file): "hello world!"
I solved it in the old fashioned way - reading line by line:
Hope it'll help future readers ^_^
You have to use xml http request as Activex object of file is not supported by any other browser than IE.
This code works perfectly fine while reading local txt or any other file too.