Reputation: 5
Firefox - 52.0.1 iMacros - 8.9.7 Windows 10
I would like to know how can I check whether the value is already present in a particular CSV or not.
Suppose I am extracting posts from facebook, I want to make sure that I extract new posts only. Example code - TAG POS={{!LOOP}} TYPE=A ATTR=CLASS:POST EXTRACT=TXT
Upvotes: 0
Views: 351
Reputation: 5299
Let's assume that your CSV file has the 'fbposts.csv.txt' name and is located in the 'D:\iMacros\Downloads' folder. You can try the following workaround as a certain solution:
SET filePosts "fbposts.csv.txt"
SET folderPosts "D:/iMacros/Downloads"
SET urlFbPage https://www.facebook.com/...
SET filePosts EVAL("{{!LOOP}} == 1 ? 'file:///{{folderPosts}}/{{filePosts}}' : 'javascript:undefined;';")
URL GOTO={{filePosts}}
SET extPos EVAL("{{!LOOP}} == 1 ? 1 : 0;")
SET !ERRORIGNORE YES
TAG POS={{extPos}} TYPE=* ATTR=* EXTRACT=TXT
SET !ERRORIGNORE NO
SET text EVAL("{{!LOOP}} == 1 ? '{{!EXTRACT}}' : '{{text}}';")
SET !EXTRACT NULL
SET urlFbPage EVAL("{{!LOOP}} == 1 ? '{{urlFbPage}}' : 'javascript:undefined;';")
URL GOTO={{urlFbPage}}
TAG POS={{!LOOP}} TYPE=A ATTR=CLASS:POST EXTRACT=TXT
SET folderPosts EVAL("var reg = new RegExp('/', 'g'); '{{text}}'.indexOf('{{!EXTRACT}}') > -1 ? '' : '{{folderPosts}}'.replace(reg, '\\\\');")
SET !ERRORIGNORE YES
SAVEAS TYPE=EXTRACT FOLDER={{folderPosts}} FILE={{filePosts}}
SET !ERRORIGNORE NO
Upvotes: 1