Chris M 55 Posted September 4, 2015 Report Share Posted September 4, 2015 Guys, I have a very small script that used to work using the http post plugin and string management that no longer works on mymachine. The only thing that has changed as far as I can tell is that I upgraded to Windows 10 and now the bot no longer works right. The bot is simple. It asks the user for an amazon url, then it uses regex to pull out the ASIN and then fetches some details from Google beforesaving data to a file for the end user. Everything works on my machine EXCEPT getting the ASIN from the string. Now, TJ confirms it works on his end and he put up a video showing it works fully on his end so it's something on my machine. The only thing I can think of right now is it must be a Windows 10 issue. Is there any way to diagnose this to know for sure what the root cause is? Quote Link to post Share on other sites
Chris M 55 Posted September 4, 2015 Author Report Share Posted September 4, 2015 I think I figured it out guys. Looks like it's a problem with an if then statement. Seems something is up with the statement. Quote Link to post Share on other sites
Chris M 55 Posted September 4, 2015 Author Report Share Posted September 4, 2015 Can anyone tell me why this statement isn't working? ui text box("Enter Your Amazon Product URL",#AmaProductURL) Get ASIN() define Get ASIN { set(#newasin,$find regular expression(#AmaProductURL,"(?<=\\/dp\\/).+?(?=\\/)"),"Global") if($comparison(#newasin,"=","")) { then { set(#newasin,$find regular expression(#AmaProductURL,"(?<=\\/gp\\/product\\/).+?(?=\\/)"),"Global") } else if($comparison(#newasin,"=","")) { set(#newasin,$find regular expression(#AmaProductURL,"(?<=\\/gp\\/).+?(?=\\/)"),"Global") } else { set(#newasin,$find regular expression(#AmaProductURL,"(?<=\\/dp\\/product\\/).+?(?=\\/)"),"Global") } } } Quote Link to post Share on other sites
LoWrIdErTJ - BotGuru 904 Posted September 4, 2015 Report Share Posted September 4, 2015 Give this a try ui text box("Enter Your Amazon Product URL", #AmaProductURL) Get ASIN() define Get ASIN { comment("Clean all spaces and trim to return just the url to start") set(#AmaProductURL, $trim($replace(#AmaProductURL, " ", "")), "Global") set(#newasin, $find regular expression(#AmaProductURL, "(?<=\\/dp\\/).+?(?=\\/)"), "Global") if($comparison(#newasin, "=", "")) { then { set(#newasin, $find regular expression(#AmaProductURL, "(?<=\\/gp\\/product\\/).+?(?=\\/)"), "Global") } else if($comparison(#newasin, "=", "")) { set(#newasin, $find regular expression(#AmaProductURL, "(?<=\\/gp\\/).+?(?=\\/)"), "Global") } else if($comparison(#newasin, "=", "")) { set(#newasin, $find regular expression(#AmaProductURL, "(?<=\\/dp\\/product\\/).+?(?=\\/)"), "Global") } else { set(#newasin, "", "Global") } } } Quote Link to post Share on other sites
pash 504 Posted September 4, 2015 Report Share Posted September 4, 2015 Check your REGEX ui text box("Enter Your Amazon Product URL",#AmaProductURL) Get ASIN() define Get ASIN { set(#newasin,$find regular expression(#AmaProductURL,"(?<=dp\\/).*?(?=\\W)"),"Global") if($comparison(#newasin,"=","")) { then { set(#newasin,$find regular expression(#AmaProductURL,"(?<=product\\/).*?(?=\\W)"),"Global") } else { } } } Quote Link to post Share on other sites
LoWrIdErTJ - BotGuru 904 Posted September 4, 2015 Report Share Posted September 4, 2015 even shorter (well pash is shorter code ui text box("Enter Your Amazon Product URL", #AmaProductURL) Get ASIN() define Get ASIN { comment("Clean all spaces and trim to return just the url to start") set(#AmaProductURL, $trim($replace(#AmaProductURL, " ", "")), "Global") set(#newasin, $replace($replace($find regular expression(#AmaProductURL, "(?<=dp\\/|dp\\/product\\/|gp\\/|gp\\/product\\/).*(\\/)"), "product", ""), "/", ""), "Global") } 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.