--- In [email protected], "nickodemos2002" <nickodemos2...@...> wrote:
>
> Kept getting an error message. Is there anyway you could make the
> script complete?
To diagnose a problem, it helps to know the exact error you are getting. You
can actually copy an error message by pressing ctrl+c when the message is
showing. That would have helped me get the problem quicker, which seems to be
that I missed that ":" is also not a valid filename character. You can probably
fix your version now, or use my rewrite if you prefer.
local sURL, sTitle, sFolder, sFileName, sFooter, sContent, sError
sTitle = win.caption("active")
sURL = BrowserURL
sFolder = ?"D:\ILC\RS"
if (not file.isfolder(sFolder)) do
messagebox("OK", ;;+
"Error: sFolder doesn't exist:\n" ++ sFolder, ;;+
"Powerpro Script: "++scriptname)
quit
endif
sTitle = regex.pcrereplace ;;+
(?"^(?:(?:Amazon|Blockbuster)\.com:?|Buyhere -)"++ ;;
?" *| - Mozilla Firefox$", ;;+
sTitle, "")
sFileName = regex.pcrereplace ;;+
(?"[\:\?\\/*\x22<>|]", sTitle, "")++".txt"
sFooter= "\r\n["++sURL++"]\r\n===================\r\n"
clip.clear
wait.for(50)
win.keys("{sinp}^c")
wait.for(50)
sContent=clip.get
file.writeall ;;+
(sFolder++"\\"++sFileName, sContent++sFooter, "a")
if (sContent=="")
sError="Empty Clipboard "
messagebox("OK", "Saved "++sError++"from \n<"++sURL++ ;;+
">\n\nto \n\n"++ ;;+
sFolder++?"\"++sFileName)
quit
>
> A question about the sTitle with the regex. If in the future I
> wanted to add more to the front?
Well, since two of them have ".com" at the end, I combined them in the rewrite
above. It needs actually to be \.com (otherwise a dot is a wildcard for any
character). I also combined all the "^" (i.e., start-with) items. You can add
more start-with items inside the closed paren after Buyhere -.
After that closed paren it grabs any spaces that follow. IOW, its not going to
leave any spaces after any of the starts-with sequences, so the title will not
start with a space.
Regards,
Sheri