okuma31 0 Posted July 31, 2013 Report Share Posted July 31, 2013 Long story short, here's an example of what I currently have. ui save file("save location", #save) command() define command { navigate("http://www.google.com/", "Wait") change attribute(<name="q">, "value", $rand(2132132, 1321231231321321)) wait(1) define $test { set(#var, $scrape attribute(<name="q">, "value"), "Local") return(#var) } navigate("http://google.com", "Wait") scraping() } define scraping { add item to list(%list, $test(), "Delete", "Local") save to file(#save, %list) } The primary issue I'm running into is when navigating to a new webpage, Google in this example, the code seems to drop the value of the define command when attempting to save it in another define command. I need a solution that can work with my current code stored in another define command (scraping). I'm offering $10, please send me a PM if you can help out. Quote Link to post Share on other sites
UBotDev 276 Posted July 31, 2013 Report Share Posted July 31, 2013 I think the problem you have is that you are adding values to a Local list, and this one gets cleared as soon "scraping" ends (if not please explain) To avoid that use Global list which will also be available after "scraping" ends. Quote Link to post Share on other sites
ds062692 19 Posted July 31, 2013 Report Share Posted July 31, 2013 (edited) Actually the code above is correct, it is not dropping anything, there is nothing to add. It won't add any value to the list because when you call the scraping function, its after the navigate command to google where the value of q is nothing. The only thing you need to do is move scraping() above navigate("http://google.com", "Wait"). Edited July 31, 2013 by ds062692 Quote Link to post Share on other sites
LoWrIdErTJ - BotGuru 904 Posted July 31, 2013 Report Share Posted July 31, 2013 ui save file("save location", #save)command()define command {navigate("http://www.google.com/", "Wait")change attribute(<name="q">, "value", $rand(2132132, 1321231231321321))wait(1)navigate("http://google.com", "Wait")scraping()}define $test {return($scrape attribute(<name="q">, "value"))} define scraping {add item to list(%list, $test(), "Delete", "Local")save to file(#save, %list)}the return is a function, no need to use a local variable on that anyways.. a function is used by the command, and discarded afterward on each run. less your setting global variables, tables or lists in that function. try the above should work fine. However the local list will clear as before mentioned on each run, and you wont see it populate in the debugger, and it will over write the save to file on each run as well. Defines should always be defined on their own, never inside another define. makes for cleaner coding as well. Quote Link to post Share on other sites
blumi40 222 Posted July 31, 2013 Report Share Posted July 31, 2013 ui save file("save location", #save)command()define command {define $test { set(#var, $scrape attribute(<name="q">, "value"), "Local") return(#var) } navigate("http://www.google.com/", "Wait") change attribute(<name="q">, "value", $rand(2132132, 1321231231321321)) wait(1) scraping() navigate("http://google.com", "Wait")}define scraping { add item to list(%list, $test(), "Delete", "Local") save to file(#save, %list)} works here !by the way paypal: flowerstone(at)gmx.de 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.