Jump to content

A few Questions


Maxvan1
 Share

Recommended Posts

1. How can I make somthing loop for a certain number of times? For example I want somthing to loop 400 times... Is the only way copy and paste x400?

2. All I want to do it make a hotkey to stop my script. Sounds easy, but I couldn't get it.

3. If there is a way to make it loop 400 times is it possable to make each of those 400 insert a value one larger then the loop before? For example, loop one would insert a 10, loop two would insert a 20, loop three would insert a 30, and so on... I dont think so, but I might as well ask. Right now I am use send(random(0,9,1)) it works, but it is random, and not efficient. What I would like is somthing like Send(LOOP1=10 LOOP2=20) so loops one inserts the 10 and loop 2 inserts the 20... It's kind of hard to explain, let me know if you dont understand.

Just for a reference here is my entire script (dont laugh, hehe, tests have worked so far, just working out the kinks now...)

HotKeySet("{P}", "Stop")

MouseMove(558, 67)

sleep(40)

MouseClick("")

sleep( 500 )

ControlSend ( "", "", "", "{DELETE}{DELETE}{DELETE}")

Send("PLACE URL OF SITE TRYING TO FIND") ;whole URL up until variable digits

send(random(5,6,1)) ;first of last three digits

send(random(0,9,1)) ;second of last three digits

send(random(0,9,1)) ;third of last three digits

send(".jpg") ;type of file you want to find

sleep(50)

ControlSend ( "", "", "", "{ENTER}")

sleep(3000)

$aPixelSearch = PixelSearch(944,144,975,151,0xffffff,3)

If IsArray($aPixelSearch) Then

Send ( "{PRINTSCREEN}","",)

MouseMove ( 659, 999)

Mouseclick("")

Sleep( 300 )

Send("{F11}")

sleep( 300 )

MouseClick("")

EndIf

Func Stop()

Exit

EndFunc

What that does is it clicks the adress bar, then it deletes it. It then types the adress that you want to go to, except the last three digits (line 8). Then it inputs 3 random digits and presses enter. Its used for finding valid adresses (like for viewing archived pictures, it just guesses the name, and if it is valid then it takes a screenshot and pastes it to photoshop.)

Let me know if anything is unclear, I will try to clear it up.

Link to comment
Share on other sites

1. How can I make somthing loop for a certain number of times? For example I want somthing to loop 400 times... Is the only way copy and paste x400?

[...etc...]

Let me know if anything is unclear, I will try to clear it up.

I think something that is unclear is just how much information gathering you did before making this post. Did you even try searching for the word "loop" in the helpfile or on these forums? Try reading up on "For...Next" in the help file. You might be surprised on how easy your task seems.
Link to comment
Share on other sites

Yet another hint.. this HotKeySet wont work.

HotKeySet("{P}", "Stop")

Curly brackets are for special characters only and isn't to be used for other keys than those listed on the Send-list.

If you drop the curly brackets however the hotkey still wont be be triggered by "P", because the "P" is uppercase

it also requires the user to press shift as well.

Link to comment
Share on other sites

Ok, I got the hotkey to work (thank you.)

I also searched for next loops... did google search, forum search, help search. I got it to input values 1-5 (just for a test) but I couldnt get it to do it each loop. It would just do it all at once. So it would be www.URL.com/12345 instead of www.url.com/1 then next loop is www.URL.com/2

Here is what I have for the loop...

While 1

MouseMove(558, 67)

sleep(40)

MouseClick("")

sleep( 500 )

ControlSend ( "", "", "", "{DELETE}{DELETE}{DELETE}")

Send("") ;whole URL up until variable digits

For $i = 5 to 1 Step 1

send($i)

Next

WEnd

I also tried to move the send($i) down under the next, but then it kept inputing zero.

Link to comment
Share on other sites

you wont get far with the code

For $i = 5 to 1 Step 1

Because, the way a For-Next loop works, is that it increments the reference variable ($i) by whatever Step you have specified each loop, and exits the loop once ($i) exceeds the second value specified (to 1). So the problem with this part of the code is that, logically, what you are telling the script to do is:

$i starts out equal to 5

If $i is smaller than 1, execute the code found withing the script

Increment $i by 1

return to the "For" statement, and repeat the previous steps

But, as you can see, $i starts out being greater than 1. The code won't be executed.

bigassmuffin gave a good example of how to rework your code. The For-Next loop is a good way of doing things too, but you'll need to do more experimenting to understand how it works first.

Edited by improbability_paradox
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...