Jump to content

Adding to a word


Recommended Posts

My idea is for me to hit 1 and it to add to a variable "A", 2="B" 3="C" and so on. Then for it to parse it like

StringMid ( $string, 1, 1) (First character) until its read the whole thing. My problem is my Function to add the string doesnt work.

Func red ()
    Global $spot = $spot & "R"
    MsgBox ( 1, "Red", $spot )
    playback ()
EndFunc

When i hit 1, it records an R but then with i hit 2, its suppose to be RB but it returns B.

Link to comment
Share on other sites

  • Moderators

Care to share the rest of the functions to test? Your explination isn't very informative, and based on it, try this:

Global $spot = ''
red()
Func red()
    $spot = $spot & "R"
    MsgBox (1, "R", $spot )
    playback()
    MsgBox (1, "RB", $spot )
EndFunc

Func playback()
    $spot = $spot & 'B'
EndFunc

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.

Link to comment
Share on other sites

HI,

I dunno exactly what you want, but does this help?

HotKeySet("1", "a")
HotKeySet("2", "b")

Global $string = "Added : "

While 1
    ToolTip($string)
    sleep(50)
WEnd

Func a()
    $string &= 'a'
EndFunc

Func b()
        $string &= 'b'
EndFunc

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

  • Moderators

Re-Read it and maybe this is what your after

Global $spot = ''
Global $Array[10] = ['A','B','C','D','E','F','G','H','I','J']

While 1
    For $i_Count = 0 To 9
        If _IsPressed(30 + $i_Count) Then
            $spot &= $Array[$i_Count]
            Sleep(100)
        EndIf
    Next
    ToolTip($spot, 0, 0)
    Sleep(10)
WEnd

Func _IsPressed($v_R, $v_dll = 'user32.dll')
    $v_R = DllCall($v_dll, 'int', 'GetAsyncKeyState', 'int', '0x' & $v_R)
    Return (Not @error And BitAND($v_R[0], 0x8000) = 0x8000) * 1
EndFunc
GL

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.

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