okuma31 0 Posted July 30, 2013 Report Share Posted July 30, 2013 (edited) I cannot for the life of me figure out a solution to this, I've actually tried several dozen solutions over the last couple of hours and to no availe =/ I have an overall define command used in my program that contains a variable that I need to get to the define function, but it's just not working. Anyone care to offer a solution to this seeing as how a page scrape refuses to work in a define function. define container { set(#variable one, $page scrape("<body>", "</body>"), "Local") define $return function { return(#variable one) } } Edited July 30, 2013 by okuma31 Quote Link to post Share on other sites
Pete 121 Posted July 30, 2013 Report Share Posted July 30, 2013 Make the define a function not a command Quote Link to post Share on other sites
okuma31 0 Posted July 30, 2013 Author Report Share Posted July 30, 2013 (edited) Make the define a function not a command That's really not an option, my entire program is organized into commands for upkeep. Here's a typical example of what I'm running into... 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") change attribute(<name="q">, "value", $test()) } Edited July 30, 2013 by okuma31 Quote Link to post Share on other sites
Pete 121 Posted July 30, 2013 Report Share Posted July 30, 2013 define $container { set(#variable one, $page scrape("<body>", "</body>"), "Local") return(#variable one) } navigate("http://ubotsandbox.com/radio-buttons.php", "Wait") set(#returnedcontainer, $container(), "Global") Quote Link to post Share on other sites
okuma31 0 Posted July 30, 2013 Author Report Share Posted July 30, 2013 (edited) Thanks man that worked, but after testing here's the issue I'm running into. It appears that when I navigate to a new web page it drops the returns value, is there a workaround for this? I'd like to keep the scraping command as is if possible, it's quite a bit of code to copy and paste in every location it's neccessary. 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) } Edited July 30, 2013 by okuma31 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.