Rob JH 0 Posted August 20, 2013 Report Share Posted August 20, 2013 Hi Guys, Strange problem here, I have this code working perfectly fine in 1 bot which has no defines, I try and copy and paste the code or put it in a define and it throws up an error, even in a brand new bot. I am getting:Script Error: Input string was not in correct format.Script > set > $rand And the code which basically gets a random URL and its matching Keyword from a CSV. clear table(&Targets)create table from file("{$special folder("Application")}\\data\\targets.csv", &Targets)set(#RandomRow, $rand(0, $eval($subtract($table total rows(&Targets), 1))), "Global")set(#Keyword, $table cell(&Targets, #RandomRow, 0), "Global")set(#URL, $table cell(&Targets, #RandomRow, 1), "Global") Any ideas? Quote Link to post Share on other sites
Edward_2 85 Posted August 20, 2013 Report Share Posted August 20, 2013 Seems to work just fine for me. test()define test { clear table(&Targets) create table from file("{$special folder("Application")}\\data\\targets.csv", &Targets) set(#RandomRow, $rand(0, $eval($subtract($table total rows(&Targets), 1))), "Global") set(#Keyword, $table cell(&Targets, #RandomRow, 0), "Global") set(#URL, $table cell(&Targets, #RandomRow, 1), "Global")} I just put random letters in the csv file Quote Link to post Share on other sites
UBotDev 276 Posted August 21, 2013 Report Share Posted August 21, 2013 You are experiencing problems because of the $eval function. When you load a page that doesn't use javascript $eval will return an empty string "", which I think is the case on your side. I've simulated the conditions here and I get the same error as you: http://screencast.com/t/abFdnqAer6 However, to fix the code just remove $eval and this should solve your problem (you dont need to use $eval since $substract function will always return an integer). . Quote Link to post Share on other sites
Rob JH 0 Posted March 27, 2014 Author Report Share Posted March 27, 2014 That did the job thanks! Quote Link to post Share on other sites
vonnch 1 Posted March 29, 2014 Report Share Posted March 29, 2014 I never knew it was this easy but nice to see that this worked already. It just amazes me that removing $eval did the trick here. Quote Link to post Share on other sites
orbital 15 Posted June 9, 2014 Report Share Posted June 9, 2014 thanks for this tip. I had the same problem and removing the eval worked. 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.