Sign in to follow this  
Followers 0
aNewLyfe

Get All Auto-it Windows

16 posts in this topic

#1 ·  Posted (edited)

I want to get all open autoit windows on my computer, is there a way to do this ?

from different exes off course

i ve searched but nothing found sorry

Edited by mistakilla

:alien: ~ Every Living Thing is a Code Snippet of World Application ~ :alien:

Share this post


Link to post
Share on other sites



I want to get all open autoit windows on my computer, is there a way to do this ?

from different exes off course

i ve searched but nothing found sorry

The WinList() function gives you an array of all open windows and handlers. Unfortunately, nothing in AutoIt I know of actually can determine the "type" of program it is, only the name of the program. But maybe you can figure something out with WinList()

Share this post


Link to post
Share on other sites

The WinList() function gives you an array of all open windows and handlers. Unfortunately, nothing in AutoIt I know of actually can determine the "type" of program it is, only the name of the program. But maybe you can figure something out with WinList()

yea, iam diggin on it at the moment. I am also checking WinGetClass but nothing yet.

there is a way :) AutoItWinGetTitle but it only returns own scripts title, waiting helps :)


:alien: ~ Every Living Thing is a Code Snippet of World Application ~ :alien:

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Unfortunately, nothing in AutoIt I know of actually can determine the "type" of program it is, only the name of the program

You can always check the CLASS window:

$sAutoItWinList = _GetAutoItWinList()

ConsoleWrite($sAutoItWinList)

Func _GetAutoItWinList()
    Local $aWinList = WinList("[CLASS:AutoIt v3 GUI]")
    Local $sRet_List = ""
    
    For $i = 1 To UBound($aWinList)-1
        $sRet_List &= $aWinList[$i][0] & @CRLF
    Next
    
    Return StringStripWS($sRet_List, 3)
EndFunc
Edited by MrCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

You can always check the CLASS window:

$sAutoItWinList = _GetAutoItWinList()

ConsoleWrite($sAutoItWinList)

Func _GetAutoItWinList()
    Local $aWinList = WinList("[CLASS:AutoIt v3 GUI]")
    Local $sRet_List = ""
    
    For $i = 1 To UBound($aWinList)-1
        $sRet_List &= $aWinList[$i][0] & @CRLF
    Next
    
    Return StringStripWS($sRet_List, 3)
EndFunc
Thanks! you are the one :)

:alien: ~ Every Living Thing is a Code Snippet of World Application ~ :alien:

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

mm, is there a way to do this on processes instead of windows ?

Edited by mistakilla

:alien: ~ Every Living Thing is a Code Snippet of World Application ~ :alien:

Share this post


Link to post
Share on other sites

mm, is there also a way to do process like this ?

ProcessList("processName.exe")?

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.

Share this post


Link to post
Share on other sites

ProcessList("processName.exe")?

nop :)

i want to get a list of Auto-it v3 Processess running


:alien: ~ Every Living Thing is a Code Snippet of World Application ~ :alien:

Share this post


Link to post
Share on other sites

nop :)

i want to get a list of Auto-it v3 Processess running

You need to be MUCH more specific when asking a question then.

You have the list... go through the list, use WinGetProcess, that will return the PID, with that you can use _ProcessGetName


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.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

You need to be MUCH more specific when asking a question then.

You have the list... go through the list, use WinGetProcess, that will return the PID, with that you can use _ProcessGetName

thanks for your help Smoke_n

but i dont have the list. i wrote things that i trying to do at the first post, and just want to do same with processess nvm its not important, you r looking tight :) also i am not asking question, i am trying to form an opinion with help of you to straighten my au3script.

so, i want to recognize an Auto-it process from process name not from win title, there is also guiless auto it scripts around

Edited by mistakilla

:alien: ~ Every Living Thing is a Code Snippet of World Application ~ :alien:

Share this post


Link to post
Share on other sites

thanks for your help Smoke_n

but i dont have the list. i wrote things that i trying to do at the first post, and just want to do same with processess nvm its not important, you r looking tight :) also i am not asking question, i am trying to form an opinion with help of you to straighten my au3script.

so, i want to recognize an Auto-it process from process name not from win title, there is also guiless auto it scripts around

Processes can be named anything, the idea of finding one by it's name purely other than AutoIt3.exe (or wrapper.exe) is not going to happen... so mscreator provided the stepping stone to finding autoit processes being ran.

1. Winlist with autoits class name

2. Loop through ubound of winlist found

3. ProcessGetName(WinGetProcess($winlistarray[$loopnumber][1]))

How you display the information is up to you.... So, I'm not tight... just need to understand what someone want specifically rather than wasting my time coming up with something that isn't what they want or need.


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.

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

I think the only indication of AutoIt executable can be found in the file properties, e.g. «CompiledScript»...

$sAutoItProcList = _GetAutoItProcList()

ConsoleWrite($sAutoItProcList)

Func _GetAutoItProcList()
    Local $aProcList = ProcessList()
    Local $sRet_List = "", $sProc_Path = ""
    
    For $i = 1 To UBound($aProcList)-1
        $sProc_Path = _ProcessGetPath($aProcList[$i][1])
        
        If StringInStr(FileGetVersion($sProc_Path, "CompiledScript"), "AutoIt") Then $sRet_List &= $aProcList[$i][0] & @CRLF
    Next
    
    Return StringStripWS($sRet_List, 3)
EndFunc

Func _ProcessGetPath($vProcess)
    Local $iPID = ProcessExists($vProcess)
    If Not $iPID Then Return SetError(1, 0, -1)
    
    Local $aProc = DllCall('kernel32.dll', 'hwnd', 'OpenProcess', 'int', BitOR(0x0400, 0x0010), 'int', 0, 'int', $iPID)
    If Not IsArray($aProc) Or Not $aProc[0] Then Return SetError(2, 0, -1)
    
    Local $vStruct = DllStructCreate('int[1024]')
    
    Local $hPsapi_Dll = DllOpen('Psapi.dll')
    If $hPsapi_Dll = -1 Then $hPsapi_Dll = DllOpen(@SystemDir & '\Psapi.dll')
    If $hPsapi_Dll = -1 Then $hPsapi_Dll = DllOpen(@WindowsDir & '\Psapi.dll')
    If $hPsapi_Dll = -1 Then Return SetError(3, 0, '')
    
    DllCall($hPsapi_Dll, 'int', 'EnumProcessModules', _
        'hwnd', $aProc[0], _
        'ptr', DllStructGetPtr($vStruct), _
        'int', DllStructGetSize($vStruct), _
        'int_ptr', 0)
    Local $aRet = DllCall($hPsapi_Dll, 'int', 'GetModuleFileNameEx', _
        'hwnd', $aProc[0], _
        'int', DllStructGetData($vStruct, 1), _
        'str', '', _
        'int', 2048)
    
    DllClose($hPsapi_Dll)
    
    If Not IsArray($aRet) Or StringLen($aRet[3]) = 0 Then Return SetError(4, 0, '')
    Return $aRet[3]
EndFunc
Edited by MrCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

I think the only indication of AutoIt executable can be found in the file properties, e.g. «CompiledScript»...

$sAutoItProcList = _GetAutoItProcList()

ConsoleWrite($sAutoItProcList)

Func _GetAutoItProcList()
    Local $aProcList = ProcessList()
    Local $sRet_List = "", $Proc_Path = ""
    
    For $i = 1 To UBound($aProcList)-1
        $Proc_Path = _ProcessGetPath($aProcList[$i][1])
        
        If StringInStr(FileGetVersion($Proc_Path, "CompiledScript"), "AutoIt") Then $sRet_List &= $aProcList[$i][0] & @CRLF
    Next
    
    Return $sRet_List
EndFunc

Func _ProcessGetPath($vProcess)
    Local $iPID = ProcessExists($vProcess)
    If Not $iPID Then Return SetError(1, 0, -1)
    
    Local $aProc = DllCall('kernel32.dll', 'hwnd', 'OpenProcess', 'int', BitOR(0x0400, 0x0010), 'int', 0, 'int', $iPID)
    If Not IsArray($aProc) Or Not $aProc[0] Then Return SetError(2, 0, -1)
    
    Local $vStruct = DllStructCreate('int[1024]')
    
    Local $hPsapi_Dll = DllOpen('Psapi.dll')
    If $hPsapi_Dll = -1 Then $hPsapi_Dll = DllOpen(@SystemDir & '\Psapi.dll')
    If $hPsapi_Dll = -1 Then $hPsapi_Dll = DllOpen(@WindowsDir & '\Psapi.dll')
    If $hPsapi_Dll = -1 Then Return SetError(3, 0, '')
    
    DllCall($hPsapi_Dll, 'int', 'EnumProcessModules', _
        'hwnd', $aProc[0], _
        'ptr', DllStructGetPtr($vStruct), _
        'int', DllStructGetSize($vStruct), _
        'int_ptr', 0)
    Local $aRet = DllCall($hPsapi_Dll, 'int', 'GetModuleFileNameEx', _
        'hwnd', $aProc[0], _
        'int', DllStructGetData($vStruct, 1), _
        'str', '', _
        'int', 2048)
    
    DllClose($hPsapi_Dll)
    
    If Not IsArray($aRet) Or StringLen($aRet[3]) = 0 Then Return SetError(4, 0, '')
    Return $aRet[3]
EndFunc

Thanks again you are very smart! and you just gave me the idea :)

Read process File and the stringinstr :)

Thank you MrCreator, again

Edited by mistakilla

:alien: ~ Every Living Thing is a Code Snippet of World Application ~ :alien:

Share this post


Link to post
Share on other sites

Yu can do it with WinList. too, just use AutoIt v3 as Classname:

CODE
#include <Process.au3>

#include <Array.au3>

$Processes = _GetAutoItProcesses()

_ArrayDisplay($Processes)

;Parameters: [Optional:] $includemy -> include the Process of the executing Script

; Returns Array:

; [0][0] -> ProcessCount

; [$i][0] -> ProcessNmae

; [$i][1] -> PID

; Author: Prog@ndy

Func _GetAutoItProcesses($inlcudemy = True)

Local $aAutoItWinList = _GetAutoItWinList()

Local $Processes[1][2] = [[0]], $pid

For $i = 1 To $aAutoItWinList[0][0]

$pid = WinGetProcess($aAutoItWinList[$i][1])

If (Not $inlcudemy) And ($pid = @AutoItPID) Then ContinueLoop

$Processes[0][0] += 1

ReDim $Processes[$Processes[0][0]+1][2]

$Processes[$Processes[0][0]][1] = $pid

$Processes[$Processes[0][0]][0] = _ProcessGetName ( $Processes[$Processes[0][0]][1] )

Next

Return $Processes

EndFunc

Func _GetAutoItWinList()

Return WinList("[CLASS:AutoIt v3]")

EndFunc


*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

Yu can do it with WinList. too, just use AutoIt v3 as Classname:

CODE
#include <Process.au3>

#include <Array.au3>

$Processes = _GetAutoItProcesses()

_ArrayDisplay($Processes)

;Parameters: [Optional:] $includemy -> include the Process of the executing Script

; Returns Array:

; [0][0] -> ProcessCount

; [$i][0] -> ProcessNmae

; [$i][1] -> PID

; Author: Prog@ndy

Func _GetAutoItProcesses($inlcudemy = True)

Local $aAutoItWinList = _GetAutoItWinList()

Local $Processes[1][2] = [[0]], $pid

For $i = 1 To $aAutoItWinList[0][0]

$pid = WinGetProcess($aAutoItWinList[$i][1])

If (Not $inlcudemy) And ($pid = @AutoItPID) Then ContinueLoop

$Processes[0][0] += 1

ReDim $Processes[$Processes[0][0]+1][2]

$Processes[$Processes[0][0]][1] = $pid

$Processes[$Processes[0][0]][0] = _ProcessGetName ( $Processes[$Processes[0][0]][1] )

Next

Return $Processes

EndFunc

Func _GetAutoItWinList()

Return WinList("[CLASS:AutoIt v3]")

EndFunc

http://www.autoitscript.com/forum/index.ph...st&p=532202

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.

Share this post


Link to post
Share on other sites

I think the only indication of AutoIt executable can be found in the file properties, e.g. «CompiledScript»...

Mixed them to one function, and changed the name/purpose a little: _ProcessListEx - UDF :)

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

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