Sign in to follow this  
Followers 0
Maxvan1

A few Questions

7 posts in this topic

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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Another hint. Once you read up on for-next loops, consider making it loop "0 to 4000 step 10". Then, whatever variable you assign to the for-next loop can be used in your send commands. (that is, if you really want it to increment by 10 every loop)

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

$x = 0 ;will reset x to 0 every time its ran
$n = 0 ;will reset n to 0 every time its ran
While $x<400
$x = $x +1 ;adds 1 to the loop counter
$n = $n +10 ;adds 10 to the number counter
.
.
.
.
.
.
send($n)
Next $x
WEnd

The ...... lines indicate to put ur script there

Edited by bigassmuffin

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0