I thought this would be a simple project. I saw Jubixion's (forgive me if I typed your name wrong) greasemonkey script maker and I thought I'd make some minor improvements to it (random refresh rate, @author meta media) Well, here's the code: Code (Text): Private Sub Label9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdStart.Click Timer1.Interval = (Integer.Parse(msablist.Items.Count()) + Integer.Parse(notouch.Text)) Timer2.Enabled = True gm.Items.Add("// ==UserScript==") gm.Items.Add("// @name " & nameprog.Text) gm.Items.Add("// @description " & derip.Text) gm.Items.Add("// @author " & author.Text) gm.Items.Add("// @namespace http://www.userscripts.org/") gm.Items.Add("// @include http://www.neopets.com/objects.phtml?type=shop&obj_type=" & shopid.Text) gm.Items.Add("// @include http://www.neopets.com/objects.phtml?obj_type=" & shopid.Text & "&type=shop") gm.Items.Add("// ==/UserScript==") gm.Items.Add("var minRefresh = " & minref.Text & ";") gm.Items.Add("var maxRefresh = " & maxref.Text & ";") gm.Items.Add("var x = (maxRefresh - minRefresh)*Math.random() + minRefresh;") gm.Items.Add("") gm.Items.Add("if(document.body.innerHTML.indexOf('" & msablist.SelectedItem & "') > -1) {") gm.Items.Add("var item= document.evaluate('//b[. = " & msablist.SelectedItem & "]',document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);if (item.snapshotlength > 0){item = item.snapshotItem(0);selectedlink=item.previousSibling.previousSibling;window.location = selectedlink}return;}") If Timer1.Enabled = True Then If Timer1.Interval > (gm.Items.Count() + 11) * 2 Then msablist.SelectedItem = msablist.SelectedIndex + 1 gm.Items.Add("else if(document.body.innerHTML.indexOf('" & msablist.SelectedItem & "') > -1) {") gm.Items.Add("var item= document.evaluate('//b[. = " & msablist.SelectedItem & "]',document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);if (item.snapshotlength > 0){item = item.snapshotItem(0);selectedlink=item.previousSibling.previousSibling;window.location = selectedlink}return;}") gm.Items.Add("") Else gm.Items.Add("else { window.setTimeout(function(){window.location.reload() ;},x) ;}return;") Timer1.Enabled = False End If End If End Sub unfortunately, this doesn't work. I am in quite the tussle for this one. I made a second timer, hoping it would properly trigger the first timer. Unfortunately, however, the output doesn't properly work. It doesn't "loop". It just runs once through the whole code and stops. Anyways, using "test" text input and using a pharmacy list (7 items) I got this as output: (I deleted the meta data) Code (Text): var minRefresh = testmin; var maxRefresh = testmax; var x = (maxRefresh - minRefresh)*Math.random() + minRefresh; if(document.body.innerHTML.indexOf('Tasty Pie') > -1) { var item= document.evaluate('//b[. = Tasty Pie]',document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);if (item.snapshotlength > 0){item = item.snapshotItem(0);selectedlink=item.previousSibling.previousSibling;window.location = selectedlink}return;} else { window.setTimeout(function(){window.location.reload() ;},x) ;}return; See what I mean? It doesn't loop the second part of the script... Oh, and to explain my coding: I figured the metadata takes 11 lines total. So I could have it so that the timer stops (thus the process) if the gm.listbox item count was smaller than 11 + the # of items in the list * 2 (because it takes up two lines in the listbox) so... Yep. If theres a better way (which there probably is :arf: ) then please do share. -Fexxel PS: Ricky/Tharoux/Billy to teh rescue? :arf:
i have no clue what you are trying to do #1 why would you have a vb.net program to write a gm script for you? #2 i dont think you understand timers at all
1. I am trying to improve this: downloads.php?d=226 2. Faster, easier, simple. 3. I edited back out the re-trigger timer. Anyways, it still doesn't work. I'm trying to make it so that it LOOPS. But it won't loop. It runs through then stops.
Why would you use timers to loop when there are just enough constructs to loop without many workarounds? Look into the Do... While and For... Next loops (2nd one mostly as this will be the one you'll probably end up using)
Ok, after reading ricky's post and a long MSN chat with Billy (YOU ROX BILLEH!)... It works... I think Gotta go test it again now. And ricky: I used timers because... I rarely ever use next. However, Billeh has taught me the way of "next" and I'm all good now... And it works! Uploading it now.