Jump to content

StringSplit array typer!


wetwlly
 Share

Recommended Posts

#include <GuiConstants.au3>
$j = 1
; GUI
GuiCreate("Auto-Typer", 330, 160)

; INPUT
GuiCtrlCreateLabel("Text", 10, 10)
$input = GuiCtrlCreateInput("", 45, 10, 200, 20)

; INPUT2
GuiCtrlCreateLabel("Every", 10, 50)
$input2 = GuiCtrlCreateInput("1000", 45, 50, 100)
GuiCtrlCreateLabel("Miliseconds", 150, 50)

; INPUT3
GuiCtrlCreateLabel("Speed", 10, 80)
$input3 = GUICtrlCreateInput("100", 45, 80)

; START BUTTON
$Button_1   = GuiCtrlCreateButton("Start", 10, 110, 100)

; STOP BUTTON
$Button_2   = GuiCtrlCreateButton("Stop", 110, 110, 100)

; EXIT BUTTON
$Exit       = GUICtrlCreateButton("Exit", 210, 110, 100)
GUISetState()



While $j = 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $Exit
            Exit
        Case $msg = $Button_1 
            Do
                $text = GUICtrlRead($input,1) 
                $time = GUICtrlRead($input2,1) 
                $speed = GUICtrlRead($input3,1) 
                WinSetOnTop ("Auto-Typer", "", 1)
                WinActivate("Untitled")
                Opt("SendKeyDelay", $speed) 
                Sleep( $time )
 Local $iMax
 Local $i
 ; The string in data will be split into an array everywhere | is encountered
 Local $arr = StringSplit($text, "|")  
 If IsArray($arr) Then 
     Local $iMax = UBound($arr)
     For $i = 0 to $iMax - 1
         Send($arr[$i] & "{TAB}")
     Next
 EndIf
                
                
            Until $j=1
    EndSelect
WEnd

when i enter in a string of characters, it starts with how many variables there are as my first array..

example: a|b|c|d, it would type 4/5 out first then hit tab then a ,tab,b,tab,c,tab,d.

Link to comment
Share on other sites

Okay i figured all that out, but I am trying to figure out how to get the auto typer to convert a full state name ( example: California ) into the abbrevation ( CA ).

I am trying to create an array, but am just a little stuck.

Link to comment
Share on other sites

Hi,

this might gives you a hint:

#include <array.au3> ; only needed for _ArrayDisplay
;Fill in the values to look for change
Local $Wordslist[2] =["California", "Sacramento"]
;Fill in the changes. Value and change must be in the same array coordinate
Local $translated[2]=["CA", "Sac"]
;This is the array to check
Local $arfile [3] = ["Sacramento","California", "Washington"]
_Arraydisplay ($arfile, "Before replace")
For $i = 0 To UBound ($arfile) - 1
    For $j = 0 To UBound ($Wordslist) - 1
        $pattern = "((?i)\b" & $Wordslist [$j] & ")"
        $var = StringRegExpReplace ($arfile [$i], $pattern, $translated [$j])
        $arfile [$i] = $var
    Next
Next
_ArrayDisplay ($arfile, "After replace")

;-))

Stefan

Edited by 99ojo
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...