Jump to content

Using other programs while script runs?


 Share

Recommended Posts

Hey everyone....Here is some code below for a particular problem and the program works great. I have added ControlSend() to the code and it works great. However, when I attempt to open anything else on the computer the focus keeps going back to the window with the Control ID. Is there anything that I can attempt in my code to allow other programs that I open to run while my script runs. For example, when I have my script running, I open the "All Programs" menu and then it closes because the focus goes to my window that I have my script running on. Any ideas...

#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)
    ControlSend("Clearview Pro:", " ", 1001, $sArray[$x])
    WinWaitActive($handle)
    ControlSend("Clearview Pro:", " ", 1001, "{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
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...