Jump to content

Recommended Posts

Posted

Hey everyone. I figured out how to get the focus on a window that you want using a handle.

Thanks everyone for your input. Tested it out tonight and it works great except if you click on another window the script starts to do things on that window. Oh well

#include <Array.au3>

Func _FileReadToArray($sFilePath, ByRef $aArray)
    Local $hFile
    $hFile = FileOpen($sFilePath, 0)
    If $hFile = -1 Then
        SetError(1)
        Return 0
    EndIf
    $aArray = StringSplit(StringStripCR( FileRead($hFile, FileGetSize($sFilePath))), @LF)
    FileClose($hFile)
    Return 1
EndFunc;==>_FileReadToArray

Local $filePath = @DesktopDir &'\Stocks.txt'
Local $aArray = ''
_FileReadToArray($filePath, $aArray)
Local $sArray = _SeperateEachWord($aArray); should have each 'word' now in an array



                Sleep(1000)
    $handle = WinGetHandle("Clearview Pro:")
    WinWaitActive($handle)

                For $x = 1 To UBound($sArray) - 1

    Sleep(2000)
    Send($sArray[$x])
    WinWaitActive($handle)
    Send("{Enter}")
    Sleep(2000)
    Send("cancel key will fire here")
    Send("{BackSpace 5}")
    
Next

Func _SeperateEachWord(ByRef $aArray, $dDelimeter = ' ')
    For $i = 1 To Ubound($aArray) - 1
        If $aArray[$i] <> '' Then 
            $SplitSpace = StringSplit($aArray[$i], $dDelimeter)
            For $x = 1 To UBound($SplitSpace) - 1
                $sArray = $sArray & $SplitSpace[$x] & Chr(01)
    
          Next
        EndIf
    Next
    Return StringSplit(StringTrimRight($sArray, 1), Chr(01))
EndFunc
  • Moderators
Posted (edited)

Do the input boxes that your sending the information to have ControlID's? If so you could replace Send with ControlSend()

Edit: *(sp)

Edited by SmOke_N

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.

Posted

Do the input boxes that your sending the information to have ControlID's? If so you could replace Send with ControlSend()

Edit: *(sp)

Thanks for that tip about ControlSend(). I tried it out and it works great. Sorry, if I wasn't clear with what I was trying to describe earlier.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...