Jump to content

Recommended Posts

Posted

Want some sendkey with adobe reader and some other programs. Using Winactivate needs class name, tried to use imagename from taskmanager (Acrord32.exe) for adobe reader but not working

Posted (edited)

Hi,

Can you please at least make a proper english sentence?

Br, FireFox.

Edited by FireFox
Posted

Maybe you can use Opt("WinTitleMatchMode", 2) to match only the "Adobe Reader" string (it is at the end of the Window title).

If the process name is the only information you have, then you can use something like this :

$res = _WinGetFromProcess("notepad.exe")
MsgBox(0, "", "Window title for notepad : " & $res)

$res = _WinGetFromProcess("notepad.exe", 1)
MsgBox(0, "", "Window handle for notepad : " & $res)

; Returns the Windows Title or Handle, from a Process name or PID
; Process : ProcessName or PID
; iFlag : 0 = returns the title
;         1 = returns the handle
Func _WinGetFromProcess($Process, $iFlag = 0)
    Local $aProcessList = ProcessList($Process)
    
    Local $aWinList = WinList()

    For $i = 1 To $aWinList[0][0]
        If $aWinList[$i][0] <> "" And BitAND(WinGetState($aWinList[$i][1]), 2) Then
            $iPid = WinGetProcess($aWinList[$i][1])
            For $j = 1 To $aProcessList[0][0]
                If $aProcessList[$j][0] = $iPid OR $aProcessList[$j][1]= $iPid Then
                    If $iFlag Then
                        Return $aWinList[$i][1]
                    Else
                        Return $aWinList[$i][0]
                    EndIf
                EndIf
            Next
        EndIf
    Next
    
    Return 0
EndFunc
Posted

Thanks, for suggession specially firefox bro, the point is i am using net on mobile and it is difficult to concentrate on sentences while typing for me.Bytheway thanks all for suggessions.

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
×
×
  • Create New...