Jump to content

Soundfile and Autoit?


 Share

Recommended Posts

Was wondering if Autoit can link a wav file, so when the wav file is played the mouse performes a click on a certian location on the desktop? The wav file is played in winamp.

Hi,

try this: For me it is window Nr.17 which shows the title which you can compare then do what you want:

;~ Return values
;~ [N][1] = 'Title of Window'
;~ [N][2] = 'Handle of Window'
;~ [N][3] = 'Text of Window'
;~ [N][4] = 'Window Pos X'
;~ [N][5] = 'Window Pos y'
;~ [N][6] = 'Window ClientSize Width
;~ [N][7] = 'Window ClientSize Height
;~ [N][8] = 'Window Class List

$aWinArray = _WinGetInfoByPID('winamp.exe')
If IsArray($aWinArray) Then
    For $i = 1 To UBound($aWinArray, 1) - 1
        MsgBox(64, 'Info:', 'The title of window ' & $i & ' is: ' & @CR & $aWinArray[$i][1] & @CR & @CR & _
        'The handle of window ' & $i & ' is: ' & @CR & $aWinArray[$i][2] & @CR & @CR & _
        'The text of window ' & $i & ' is: ' & @CR & $aWinArray[$i][3] & @CR & @CR & _
        'The X Screen Pos of window ' & $i & ' is: ' & @CR & $aWinArray[$i][4]  & @CR & @CR & _
        'The Y Screen Pos of window ' & $i & ' is: ' & @CR & $aWinArray[$i][5] & @CR & @CR & _
        'The Client Width of window ' & $i & ' is: ' & @CR & $aWinArray[$i][6]  & @CR & @CR & _
        'The Client Height of window ' & $i & ' is: ' & @CR & $aWinArray[$i][7]  & @CR & @CR & _
        'The Class List for window ' & $i & ' is: ' & @CR & $aWinArray[$i][8])
    Next
Else
    MsgBox(64, 'Info:', 'Executable Not Found')
EndIf

Func _WinGetInfoByPID($sExe)
    Local $aPList = ProcessList(), $iPID
    For $iiCount = 1 To $aPList[0][0]
        If $aPList[$iiCount][0] = $sExe Then
            $iPID &= $aPList[$iiCount][1] & Chr(01)
        EndIf
    Next
    $iPID = StringSplit($iPID, Chr(01))
    If $iPID = 0 Then Return SetError(1, 0, 0)
    Local $aStoreHwndAndText[2][9], $nCount = 1
    $OptWSC = Opt('WinSearchChildren', 1)
    $OptWDHT = Opt('WinDetectHiddenText', 1)
    Local $aWinList = WinList()
    For $iCount = 1 To $aWinList[0][0]
        For $xCount = 1 To $iPID[0]
            If WinGetProcess($aWinList[$iCount][1]) = $iPID[$xCount] And _
                $aWinList[$iCount][0] <> '' Then
                Local $aWinPos = WinGetPos($aWinList[$iCount][1])
                Local $aWinClient = WinGetClientSize($aWinList[$iCount][1])
                $nCount += 1
                ReDim $aStoreHwndAndText[$nCount][9]
                $aStoreHwndAndText[$nCount - 1][1] = $aWinList[$iCount][0]
                $aStoreHwndAndText[$nCount - 1][2] = $aWinList[$iCount][1]
                $aStoreHwndAndText[$nCount - 1][3] = WinGetText($aWinList[$iCount][1])
                $aStoreHwndAndText[$nCount - 1][4] = $aWinPos[0]
                $aStoreHwndAndText[$nCount - 1][5] = $aWinPos[1]
                $aStoreHwndAndText[$nCount - 1][6] = $aWinClient[0]
                $aStoreHwndAndText[$nCount - 1][7] = $aWinClient[1]
                $aStoreHwndAndText[$nCount - 1][8] = WinGetClassList($aWinList[$iCount][1])
            EndIf
        Next
    Next
    Opt('WinSearchChildren', $OptWSC)
    Opt('WinDetectHiddenText', $OptWDHT)
    If $nCount = 1 Then Return SetError(2, 0, 0)
    Return $aStoreHwndAndText
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

Hi,

try this: For me it is window Nr.17 which shows the title which you can compare then do what you want:

;~ Return values
;~ [N][1] = 'Title of Window'
;~ [N][2] = 'Handle of Window'
;~ [N][3] = 'Text of Window'
;~ [N][4] = 'Window Pos X'
;~ [N][5] = 'Window Pos y'
;~ [N][6] = 'Window ClientSize Width
;~ [N][7] = 'Window ClientSize Height
;~ [N][8] = 'Window Class List

$aWinArray = _WinGetInfoByPID('winamp.exe')
If IsArray($aWinArray) Then
    For $i = 1 To UBound($aWinArray, 1) - 1
        MsgBox(64, 'Info:', 'The title of window ' & $i & ' is: ' & @CR & $aWinArray[$i][1] & @CR & @CR & _
        'The handle of window ' & $i & ' is: ' & @CR & $aWinArray[$i][2] & @CR & @CR & _
        'The text of window ' & $i & ' is: ' & @CR & $aWinArray[$i][3] & @CR & @CR & _
        'The X Screen Pos of window ' & $i & ' is: ' & @CR & $aWinArray[$i][4]  & @CR & @CR & _
        'The Y Screen Pos of window ' & $i & ' is: ' & @CR & $aWinArray[$i][5] & @CR & @CR & _
        'The Client Width of window ' & $i & ' is: ' & @CR & $aWinArray[$i][6]  & @CR & @CR & _
        'The Client Height of window ' & $i & ' is: ' & @CR & $aWinArray[$i][7]  & @CR & @CR & _
        'The Class List for window ' & $i & ' is: ' & @CR & $aWinArray[$i][8])
    Next
Else
    MsgBox(64, 'Info:', 'Executable Not Found')
EndIf

Func _WinGetInfoByPID($sExe)
    Local $aPList = ProcessList(), $iPID
    For $iiCount = 1 To $aPList[0][0]
        If $aPList[$iiCount][0] = $sExe Then
            $iPID &= $aPList[$iiCount][1] & Chr(01)
        EndIf
    Next
    $iPID = StringSplit($iPID, Chr(01))
    If $iPID = 0 Then Return SetError(1, 0, 0)
    Local $aStoreHwndAndText[2][9], $nCount = 1
    $OptWSC = Opt('WinSearchChildren', 1)
    $OptWDHT = Opt('WinDetectHiddenText', 1)
    Local $aWinList = WinList()
    For $iCount = 1 To $aWinList[0][0]
        For $xCount = 1 To $iPID[0]
            If WinGetProcess($aWinList[$iCount][1]) = $iPID[$xCount] And _
                $aWinList[$iCount][0] <> '' Then
                Local $aWinPos = WinGetPos($aWinList[$iCount][1])
                Local $aWinClient = WinGetClientSize($aWinList[$iCount][1])
                $nCount += 1
                ReDim $aStoreHwndAndText[$nCount][9]
                $aStoreHwndAndText[$nCount - 1][1] = $aWinList[$iCount][0]
                $aStoreHwndAndText[$nCount - 1][2] = $aWinList[$iCount][1]
                $aStoreHwndAndText[$nCount - 1][3] = WinGetText($aWinList[$iCount][1])
                $aStoreHwndAndText[$nCount - 1][4] = $aWinPos[0]
                $aStoreHwndAndText[$nCount - 1][5] = $aWinPos[1]
                $aStoreHwndAndText[$nCount - 1][6] = $aWinClient[0]
                $aStoreHwndAndText[$nCount - 1][7] = $aWinClient[1]
                $aStoreHwndAndText[$nCount - 1][8] = WinGetClassList($aWinList[$iCount][1])
            EndIf
        Next
    Next
    Opt('WinSearchChildren', $OptWSC)
    Opt('WinDetectHiddenText', $OptWDHT)
    If $nCount = 1 Then Return SetError(2, 0, 0)
    Return $aStoreHwndAndText
EndFunc

SO long,

Mega

Yeah i found it was nr 15, so every time that info comes up i want the mouse to klick on a specific location how do i start the script? would appreciate some more help.
Link to comment
Share on other sites

  • Moderators

Plz help me. If the Title of window 9 is Hello i want the a Mouseclick ([, 342, 560 [, 2 [, 20]]] )

You don't know how to write the mouse click function?

Opt('MouseCoordMode', 2)
MouseClick(342, 560, 2, 20)
This will click the "Client" coordinates in the window, change the 2 to 1 if you want window coords.

Brackets in the parameters of a function are "optional", you don't put them actually in the function itself.

@thmeger, where did you find that function, I wrote that a while ago and don't remember posting it.

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,

try this:

Global $titel = "Y M C A"

_WinGetInfoByPID('winamp.exe', $titel)

Func _WinGetInfoByPID($sExe, $titel)
    Local $aPList = ProcessList(), $iPID
    For $iiCount = 1 To $aPList[0][0]
        If $aPList[$iiCount][0] = $sExe Then
            $iPID &= $aPList[$iiCount][1] & Chr(01)
        EndIf
    Next
    $iPID = StringSplit($iPID, Chr(01))
    If $iPID = 0 Then Return SetError(1, 0, 0)

    $OptWSC = Opt('WinSearchChildren', 1)
    $OptWDHT = Opt('WinDetectHiddenText', 1)
    Local $aWinList = WinList()
    For $iCount = 1 To $aWinList[0][0]
        For $xCount = 1 To $iPID[0]
            If WinGetProcess($aWinList[$iCount][1]) = $iPID[$xCount] And _
                    $aWinList[$iCount][0] <> '' Then
                If StringInStr($aWinList[$iCount][0], $titel) <> 0 Then
                    ; Do the things you want when found!
                    MsgBox(0, "", $aWinList[$iCount][0])
                EndIf
            EndIf
        Next
    Next
    Opt('WinSearchChildren', $OptWSC)
    Opt('WinDetectHiddenText', $OptWDHT)
EndFunc   ;==>_WinGetInfoByPID

@Ron: I copy the funcs you provide sometimes. ;)

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

Hi,

I thought you want to do something when winamp.exe plays a specific song? Change the title to the song and and then run the script while winamp plays the song.

So long,

Mega

Edited by th.meger

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

Damn jesus, try this. ;)

Opt("WinTitleMatchMode", 4)

Global $title = "Help"

While 1
    Sleep(200)
    check($title)
WEnd

Func check($title)
    $var = WinList()
    For $i = 1 To $var[0][0]
        ; Only display visble windows that have a title
        If $var[$i][0] <> "" And IsVisible($var[$i][1]) Then
            ;MsgBox(0, "Details", "Title=" & $var[$i][0] & @LF & "Handle=" & $var[$i][1])
            If StringInStr($var[$i][0], $title) <> 0 Then
                MsgBox(64, "", "FOUND!!! " & $title & @CRLF & "in Window " & @CRLF & "Title=" & $var[$i][0])
                MouseClick(342, 560, 2, 20)
                Exit (0)
            EndIf
        EndIf
    Next
EndFunc   ;==>check

Func IsVisible($handle)
    If BitAND(WinGetState($handle), 2) Then
        Return 1
    Else
        Return 0
    EndIf
EndFunc   ;==>IsVisible

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

Hi,

this is the line

Global $title = "Help"

you have to change to your title!

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

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