Jump to content

Sending $Variable


Recommended Posts

The problem I am having is that when any of the variables $a, b, or c get >= 10, the script starts printing only the first digit. Any insight would be greatly appreciated. NOTE: I'm sure this is probably written horribly, I'm quite new to AutoIt and only know one other language (C++).

For $a=1 To 28
        Send("+i")
        Sleep(750)
        Send("{ENTER}{DOWN}{ENTER}")
        Sleep(750)
        Send("{" & $a & "}")
        Sleep(750)
        Send("{ENTER}")
        Sleep(750)
        For $b=1 To 20
            If $b>=2 Then
                Send("+i")
                Sleep(750)
                Send("{ENTER}{DOWN}{ENTER}")
                Sleep(750)
                Send("{" & $a & "}")
                Sleep(750)
                Send("{ENTER}")
                Sleep(750)
            EndIf
            Send("{ENTER}{DOWN}{ENTER}")
            Sleep(750)
            Send("{" & $b & "}")
            Sleep(750)
            Send("{ENTER}")
            Sleep(750)
            For $c=1 To 20
                if $c>=2 Then
                    Send("+i")
                    Sleep(750)
                    Send("{ENTER}{DOWN}{ENTER}")
                    Sleep(750)
                    Send("{" & $a & "}")
                    Sleep(750)
                    Send("{ENTER}")
                    Sleep(750)
                    Send("{ENTER}{DOWN}{ENTER}")
                    Sleep(750)
                    Send("{" & $b & "}")
                    Sleep(750)
                    Send("{ENTER}")
                    Sleep(750)
                EndIf
                Send("{ENTER}{DOWN}{ENTER}")
                Sleep(750)
                Send("{" & $c & "}")
                Sleep(750)
                Send("{ENTER}")
                Sleep(750)
                Send("{TAB}{TAB}{ENTER}")
                Sleep(750)
            Next
        Next
    Next
Link to comment
Share on other sites

I have no problem running this code - so maybe the fields you are entering the digits into, only excepts one char?

For $a=1 To 28
        ;Send("+i")
        ;Sleep(750)
        ;Send("{ENTER}{DOWN}{ENTER}")
        ;Sleep(750)
        ConsoleWrite("{" & $a & "}" & @CRLF)
        ;Sleep(750)
        ;Send("{ENTER}")
        ;Sleep(750)
        For $b=1 To 20
            If $b>=2 Then
                ;Send("+i")
                ;Sleep(750)
                ;Send("{ENTER}{DOWN}{ENTER}")
                ;Sleep(750)
                ConsoleWrite("{" & $a & "}" & @CRLF)
                ;Sleep(750)
                ;Send("{ENTER}")
                ;Sleep(750)
            EndIf
            ;Send("{ENTER}{DOWN}{ENTER}")
            ;Sleep(750)
            ConsoleWrite("{" & $b & "}" & @CRLF)
            ;Sleep(750)
            ;Send("{ENTER}")
            ;Sleep(750)
            For $c=1 To 20
                if $c>=2 Then
                    ;Send("+i")
                    ;Sleep(750)
                    ;Send("{ENTER}{DOWN}{ENTER}")
                    ;Sleep(750)
                    ConsoleWrite("{" & $a & "}" & @CRLF)
                    ;Sleep(750)
                    ;Send("{ENTER}")
                    ;Sleep(750)
                    ;Send("{ENTER}{DOWN}{ENTER}")
                    ;Sleep(750)
                    ConsoleWrite("{" & $b & "}" & @CRLF)
                    ;Sleep(750)
                    ;Send("{ENTER}")
                    ;Sleep(750)
                EndIf
                ;Send("{ENTER}{DOWN}{ENTER}")
                ;Sleep(750)
                ConsoleWrite("{" & $c & "}" & @CRLF)
                ;Sleep(750)
                ;Send("{ENTER}")
                ;Sleep(750)
                ;Send("{TAB}{TAB}{ENTER}")
                ;Sleep(750)
            Next
        Next
    Next

2¢

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

It definitely excepts more than one character :/

Maybe try it with ControlSend() and see if it works

2¢

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

Tried that as well, appreciate your input so far!

Other than the test I did, I am not sure I can give you anymore INPUT - sorry. Maybe, the application\form\whatever does not allow automation? I will have to leave it to the 'experts' to try ane figure it out, but your code looks like it should work.

2¢

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

Try this. You were using send incorrectly. There are no keys labeled 10 to 28, at least not on my keyboard.

For $a=1 To 28
        Send("+i")
        Sleep(750)
        Send("{ENTER}{DOWN}{ENTER}")
        Sleep(750)
        Send($a)
        Sleep(750)
        Send("{ENTER}")
        Sleep(750)
        For $b=1 To 20
            If $b>=2 Then
                Send("+i")
                Sleep(750)
                Send("{ENTER}{DOWN}{ENTER}")
                Sleep(750)
                Send($a)
                Sleep(750)
                Send("{ENTER}")
                Sleep(750)
            EndIf
            Send("{ENTER}{DOWN}{ENTER}")
            Sleep(750)
            Send($b)
                        Sleep(750)
            Send("{ENTER}")
            Sleep(750)
            For $c=1 To 20
                if $c>=2 Then
                    Send("+i")
                    Sleep(750)
                    Send("{ENTER}{DOWN}{ENTER}")
                    Sleep(750)
                    Send($a)
                    Sleep(750)
                    Send("{ENTER}")
                    Sleep(750)
                    Send("{ENTER}{DOWN}{ENTER}")
                    Sleep(750)
                    Send($b)
                    Sleep(750)
                    Send("{ENTER}")
                    Sleep(750)
                EndIf
                Send("{ENTER}{DOWN}{ENTER}")
                Sleep(750)
                Send($c)
                Sleep(750)
                Send("{ENTER}")
                Sleep(750)
                Send("{TAB}{TAB}{ENTER}")
                Sleep(750)
            Next
        Next
Next

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to comment
Share on other sites

That worked perfectly, thank you so much! It took me a while to figure out how to even send the variables from 1 to 9. I found the syntax particularly odd - probably because I was doing it wrong! I guess I overlooked the obvious in all my trial-and-error.

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...