Sign in to follow this  
Followers 0
chandler8

Using a Handle - Solution

3 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  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

[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

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.

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