guys,
how do i make a macro which makes the keyboard press 123456789 automatically in a loop till i stop it....
awaiting reply,
thx
123456789
Started by
aronincool
, Apr 15 2012 10:54 PM
20 replies to this topic
#1

Posted 15 April 2012  10:54 PM
here ya go
x := 1 Loop { Send {%x%} if (x == 10) x := 1 else x := x + 1 } return
#2

Posted 15 April 2012  11:32 PM
Could I get a script to calculate the 1 billion digits of π (pi)?
Awaiting answer, thnx
Awaiting answer, thnx
#3

Posted 16 April 2012  12:25 AM
Would not getting the exact value of pi be more desirable?
MsgBox pi = π
#4

Posted 16 April 2012  10:23 AM
Thank you! <In case I forget to say it.
Would not getting the exact value of pi be more desirable?
Loop { MsgBox, 4,, pi = π. Close enough? IfMsgBox, Yes Break } ExitApp
Here's an algorithm for you...I just don't know how to code it. It'd be interesting to see if another could.
pi = sqrt(6/1 + 6/2^2 + 6/3^2 + ...)
So loop that enough times and the square root of that series should nudge up pretty close to π. A billion digits? Can AHK handle that?
Here's another one:
pi = 3 + (1/(6 + 3^2/(6 + 5^2/ (6 + 7^2/(6 + 9^2/(6 + 11^2/(....
#5

Posted 16 April 2012  07:48 PM
Thank you! <In case I forget to say it.
<! m >http://www.optimnem.co.uk/pi.php<! m >
#6

Posted 16 April 2012  10:17 PM
Any code that I post will be for AHK Basic.
I'm not always right, but I still try to help.
I'm not always right, but I still try to help.
pi = sqrt(6/1 + 6/2^2 + 6/3^2 + ...)
pi := 6/1 Loop, % 1000000000  1 pi += 6/(A_Index^2) pi := sqrt(pi)
...?
#7

Posted 16 April 2012  11:34 PM
pi = sqrt(6/1 + 6/2^2 + 6/3^2 + ...)
pi := 6/1 Loop, % 1000000000  1 pi += 6/(A_Index^2) pi := sqrt(pi)
...?
Not right... that formula is wrong. This one works though 3+(1/(6+3**2/(6+5**2/(6+7**2..., but Autohotkey is not capable of making it for too long. My guess was to try and make it in parts, but I'm not in the mood to think about that right now.
#8

Posted 16 April 2012  11:44 PM
Let us not be lazy. Someday it might just kill us.
The first formula is right. It's Euler's solution to the Basel problem, solved for pi. Euler proved that the summation as n goes from 1 to infinity of 1/n^2 is pi^2/6. Multiplying through by 6 would give us that pi^2 = the summation as n goes from 1 to infinity of 6/n^2. Taking the square root of both sides would produce pi = the square root of (6/1 +6/2^2 + 6/3^2...). It's the code that "Guest" wrote that's wrong.pi = sqrt(6/1 + 6/2^2 + 6/3^2 + ...)
pi := 6/1 Loop, % 1000000000  1 pi += 6/(A_Index^2) pi := sqrt(pi)
...?
Not right... that formula is wrong. This one works though 3+(1/(6+3**2/(6+5**2/(6+7**2..., but Autohotkey is not capable of making it for too long. My guess was to try and make it in parts, but I'm not in the mood to think about that right now.
#9

Posted 17 April 2012  01:27 AM
Thank you! <In case I forget to say it.
How does that code differ from your posted algo (1st one)?
#10

Posted 17 April 2012  02:10 AM
That code is calculating a bunch of nested square roots rather than the square root of the sum.How does that code differ from your posted algo (1st one)?
Edit: The code below works pretty good. It produces 3.141018. I tried 100000 loops and it locked up on me.
Loop, 10000 { pi += 1/(A_Index**2) } pi := sqrt(6*pi) MsgBox, 4,, pi = %pi%...Close enough? IfMsgBox, Yes return
#11

Posted 17 April 2012  02:37 AM
Thank you! <In case I forget to say it.
Is there a limit on how many loops AHK will run?
#12

Posted 17 April 2012  06:49 PM
Thank you! <In case I forget to say it.
Well... Autohotkey just finished making 100000000 (yup 8 0's) and it return only 16 decimal places... Took over half a hour for that and returned this 3.1415926449823899. Anyone willing to try a greater amount of loops?
PS: I've used setformat for it to show 50 decimal places.
PS: I've used setformat for it to show 50 decimal places.
#13

Posted 17 April 2012  07:30 PM
Let us not be lazy. Someday it might just kill us.
No it's not....That code is calculating a bunch of nested square roots rather than the square root of the sum.
pi := 6/1 ; Start off as 6 Loop, % 1000000000  1 ; Loop 1 less than a billion pi += 6/(A_Index^2) ; Add up 6/(A_Index^2)... the loop stops here pi := sqrt(pi) ; Calc the final square root... square root is only calc'd once
#14

Posted 17 April 2012  11:35 PM
BTW, ^ is a bitwiseexclusiveor (^) in AHK, just in case that's trashing the formula.
#15

Posted 17 April 2012  11:43 PM