I'm using iMacros on Firefox to download my Wells Fargo PDF bank statements automatically, and give the files the name of the link, like "Statement 04/22/12 (597K)"
However, I can't have slashes in the file name (Windows restriction...). So I'm trying to replace the forward slashes by a dash.
Here is my iMacro below. I get an error code on the following line:
SET !VAR1 EVAL("var s=\"{{!EXTRACT}}\"; s.replace(/\//g, "-");")
My javascript or my Regex doesn't work, and I don't know why. I'm not strong in either language - I've tried to copy from other examples as best as I could, but with no success. If you can help, that'd be great. Thanks.
VERSION BUILD=5010424 RECORDER=CR
' SET !ERRORIGNORE YES
TAB OPEN
TAB T=2
URL GOTO=https://online.wellsfargo.com/login
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:Signon ATTR=ID:username CONTENT=XXX
SET !ENCRYPTION TMPKEY
TAG POS=1 TYPE=INPUT:PASSWORD FORM=ID:Signon ATTR=ID:password CONTENT=XXX
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:Signon ATTR=NAME:continue&&VALUE:Sign<SP>On
TAG POS=1 TYPE=A ATTR=TXT:View<SP>online<SP>statements
SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=A ATTR=TXT:Statement<SP>* EXTRACT=TXT
SET !VAR1 EVAL("var s=\"{{!EXTRACT}}\"; s.replace(/\//g, "-");") <---- THIS IS THE PROBLEMATIC LINE!!!!!!!!!!!!!!
ONDOWNLOAD FOLDER=D:\Wells<SP>Fargo\CREDIT<SP>CARD\ FILE={{!VAR1}}.pdf
TAG POS=1 TYPE=A ATTR=TXT:Statement<SP>* CONTENT=EVENT:SAVETARGETAS
TAB CLOSE
As an extra, if you know how to remove the "(597K)" with Regex in the javascript, that'd be the icing on the cake. (obviously, the value of this text string will be different for each different file, so it has to be dynamic)