Sign in to follow this  
Followers 0
Mastering

Big Headache

13 posts in this topic

#1 ·  Posted (edited)

Sorry to distrub the peace with my stupidity but I'm having problem scripting something due to the fact I'm the newbie :o . My plan was to make an Auto-Key program but it kinda screwed up.

EDIT:

Ah I meant like when I open the program, its suppose to spam the letter "S" for 0.5 seconds, then continues to loop till the program is closed.

; ---------------------------------------------------------------

-------------

;

; AutoIt Version: 3.1.0

; Author: A.N.Other <myemail@nowhere.com>

;

; Script Function:

; Template AutoIt script.

;

; ---------------------------------------------------------------

-------------

; Script Start - Add your code below here

MsgBox(0, "Blah", "Starting...")

;Print all numbers from 1 to 10 except number 7

For $i = 1 to 2

If $i = 7 Then ContinueLoop

Send("{S $i}") ;

Next

;Example of using level is needed.

Anybody wanna help me add changes/give me some advice on what to add and such is greatly appreciated. I'm still browsing the tutorial but it drives me nuts lol. :geek:

Edited by Mastering

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Sorry to distrub the peace with my stupidity but I'm having problem scripting something due to the fact I'm the newbie :o . My plan was to make an Auto-Key program but it kinda screwed up.

Anybody wanna help me add changes/give me some advice on what to add and such is greatly appreciated. I'm still browsing the tutorial but it drives me nuts lol. :geek:

For $i = 1 to 10 ;starts the loop.
If $i = 7 then;If $i = 7 then, it will add 1 more to $i to make it skip it
$i += 1; adds 1 more
EndIf; closes the if statements
MsgBox(0, "", $i);message box with the variable $i
Next; continue's the loop
Edited by CHRIS95219

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

umm...

For $i = 1 to 2
If $i = 7 Then ContinueLoop
Send("{S $i}");
Next

how exactly is $i supposed to get to 7 if the max number is 2?

try

For $i = 1 to 10
If $i = 7 Then ContinueLoop
Send("{S " & $i & "}");
Next
Edited by cdkid

AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!

Share this post


Link to post
Share on other sites

Sorry to distrub the peace with my stupidity but I'm having problem scripting something due to the fact I'm the newbie :o . My plan was to make an Auto-Key program but it kinda screwed up.

Anybody wanna help me add changes/give me some advice on what to add and such is greatly appreciated. I'm still browsing the tutorial but it drives me nuts lol. :geek:

Well the first thing I see is that this will never get past "2":

; Print all numbers from 1 to 10 except number 7
For $i = 1 to 2
If $i = 7 Then ContinueLoop
Send("{S $i}");
Next

Should be:

; Print all numbers from 1 to 10 except number 7
For $i = 1 to 10
If $i = 7 Then ContinueLoop
Send($i); What were you trying to send with {S $i}???
Next

Share this post


Link to post
Share on other sites

For $i = 1 to 10;starts the loop.
If $i = 7 then;If $i = 7 then, it will add 1 more to $i to make it skip it
$i += 1; adds 1 more
EndIf; closes the if statements
MsgBox(0, "", $i);message box with the variable $i
Next; continue's the loop
This I believe would make it skip number 8. If not it still isn't needed, the continueloop works fine.

Share this post


Link to post
Share on other sites

I about forgot, when comparing a variable use two "==" like so:

; Print all numbers from 1 to 10 except number 7
For $i = 1 to 10
If $i == 7 Then ContinueLoop; notice two == for comparing the variable.
Send($i); What were you trying to send with {S $i}???
Next

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

This I believe would make it skip number 8. If not it still isn't needed, the continueloop works fine.

nope, u should try it.. it works perfect. :o

yeah, u can do it both ways, i just find it easier when writing alot fo code to do this, so u know exactly what it is doing.... just my opinion.

Edited by CHRIS95219

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

There's lots of ways to do it :o :

For $x = 8 To 10
    If $x == 8 Then
        For $i = 1 To 6
            Send($i)
        Next
    EndIf
    Send($x)
Next

Or the one I would probably do:

For $x = 1 To 10
    If $x <> 7 Then Send($x)
Next

Or

$x = 1
While $x <= 10
    If $x <> 7 Then Send($x)
    $x = $x + 1
WEnd

Or

$x = 0
While $x < 10
    $x = $x + 1
    If $x == 7 Then ContinueLoop
    Send($x)
WEnd

Or

$x = 1
Do
    If $x <> 7 Then Send($x)
    $x = $x + 1
Until $x > 10

Or

$x = 0
Do
    $x = $x + 1
    If $x == 7 Then ContinueLoop
    Send($x)
Until $x >= 10

Or Many others I'm sure!! :geek:

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

This is my favorite: :o

For $x = 8 To 10
    If $x == 8 Then
        For $i = 1 To 6
            Send($i)
        Next
    EndIf
    Send($x)
Next

Share this post


Link to post
Share on other sites

This is my favorite: :o

For $x = 8 To 10
    If $x == 8 Then
        For $i = 1 To 6
            Send($i)
        Next
    EndIf
    Send($x)
Next
Ha!!!, Now you know how I think on a regular basis! :geek:

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

how bout..

For $a = 1 to 10
    If $a == 7 Then
        $b = 10-7
        $total = $b * 2
        $sub = $total + 3
        $resultant = $sub -3 / $total
        $a += $resultant - 7.5
    EndIf
    MsgBox(0, "", $a)
Next

lol... im just really bored.

Edited by CHRIS95219

Share this post


Link to post
Share on other sites

these are the same....no???

For $a = 1 to 10
    If $a == 7 Then
        $b = 10-7
        $total = $b * 2
        $sub = $total + 3
        $resultant = $sub -3 / $total
        $a += $resultant - 7.5
    EndIf
    MsgBox(0, "", $a)
Next

For $a = 1 to 10
    If $a == 7 Then
        $a = $a + 1
    EndIf
    MsgBox(0, "", $a)
Next

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

these are the same....no???

For $a = 1 to 10
    If $a == 7 Then
        $b = 10-7
        $total = $b * 2
        $sub = $total + 3
        $resultant = $sub -3 / $total
        $a += $resultant - 7.5
    EndIf
    MsgBox(0, "", $a)
Next

For $a = 1 to 10
    If $a == 7 Then
        $a = $a + 1
    EndIf
    MsgBox(0, "", $a)
Next

8)

haha, lmao..... that was my point.

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