Jump to content
UBot Underground

[Buy] Quick solution to a local variable issue


Recommended Posts

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.

Link to post
Share on other sites

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.

Link to post
Share on other sites

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 by ds062692
Link to post
Share on other sites

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.

Link to post
Share on other sites

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

:)
 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...