Mateo Posted January 6, 2021 Share Posted January 6, 2021 Hi, Continuing with my previous questions, I try to get information about all the open windows, and I have a problem, applications like "Settings", "Music", "Calculator" and the like are displayed to me as ApplicationFrameHost.exe. Anyone have any idea how I find the real app he wanted? (I want to get the real list of apps, as it appears in the task manager (under "Apps")) (I tried to search a bit in forums that are not necessarily autoit's and could not find anything) thank you all 😃! Link to comment Share on other sites More sharing options...
caramen Posted January 6, 2021 Share Posted January 6, 2021 1 hour ago, Mateo said: Continuing with my previous questions, Please explain for people that are not aware of the first question. From what I understand maybe the next functions will help you : WinList () WinExists () My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
Mateo Posted January 6, 2021 Author Share Posted January 6, 2021 Sorry, I'm really sorry I did not explain myself properly. I meant this post (which is not what I asked for in the post, but the code appears in the post), where I try to take out the list of windows visible to the user (as it appears in the "Apps" task manager) Link to comment Share on other sites More sharing options...
Nine Posted January 6, 2021 Share Posted January 6, 2021 What code are you using to obtain such a result ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Mateo Posted January 14, 2021 Author Share Posted January 14, 2021 On 1/6/2021 at 2:50 PM, Nine said: What code are you using to obtain such a result ? Sorry for the late response, but I did not understand your question Link to comment Share on other sites More sharing options...
Mateo Posted January 14, 2021 Author Share Posted January 14, 2021 But by and large, regardless of my code, I just want to know what window is currently in focus for the user, and if it is one of the Windows applications (settings, calculator, weather, etc.) then the resulting process is ApplicationFrameHost.exe. I'm trying to find a workaround to know what the process really is running ... (maybe try to figure out how Windows manages it, because when it displays the list of "applications" that run (within the task manager) it displays them correctly, without ApplicationFrameHost.exe). Link to comment Share on other sites More sharing options...
Nine Posted January 14, 2021 Share Posted January 14, 2021 WinList does not give you the name of the process. So I repeat, show me the code that gives you the name of the process instead of the title of the window “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Mateo Posted January 14, 2021 Author Share Posted January 14, 2021 #include <Array.au3> #include <Process.au3> Local $aPrograms[0][2] Local $aWinList = WinList() For $i = 1 To $aWinList[0][0] If $aWinList[$i][0] <> "" And BitAND(WinGetState($aWinList[$i][1]), 2) Then ReDim $aPrograms[UBound($aPrograms) + 1][2] $aPrograms[UBound($aPrograms)-1][0] = $aWinList[$i][0] $aPrograms[UBound($aPrograms)-1][1] = _ProcessGetName(WinGetProcess($aWinList[$i][1])) ;here EndIf Next _ArrayDisplay($aPrograms) Link to comment Share on other sites More sharing options...
Nine Posted January 14, 2021 Share Posted January 14, 2021 So why do you change window's title (because this is what you want) to the unwanted process name ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Mateo Posted January 14, 2021 Author Share Posted January 14, 2021 I did not understand? I do not change any process name, just when I check what process is now in focus and open one of the Windows apps then it is displayed as "ApplicationFrameHost.exe". Local $sName = _ProcessGetName(WinGetProcess("[ACTIVE]")) ; ==> $sName = "ApplicationFrameHost.exe" Link to comment Share on other sites More sharing options...
Nine Posted January 14, 2021 Share Posted January 14, 2021 (edited) Sorry, I misread the code. You are replacing window handle with process name. Fine. But why window title is not enough for you ? You know that the window is Calculator or other tool. i do not understand what you need more. Ok maybe this is what you are looking for : #include <Array.au3> #include <Process.au3> Local $aPrograms[0][3] Local $aWinList = WinList() For $i = 1 To $aWinList[0][0] If $aWinList[$i][0] <> "" And BitAND(WinGetState($aWinList[$i][1]), 2) Then ReDim $aPrograms[UBound($aPrograms) + 1][3] $aPrograms[UBound($aPrograms)-1][0] = $aWinList[$i][0] $aPrograms[UBound($aPrograms)-1][1] = $aWinList[$i][1] $aPrograms[UBound($aPrograms)-1][2] = _ProcessGetName(WinGetProcess($aWinList[$i][1])) EndIf Next _ArrayDisplay($aPrograms) $hWnd = WinGetHandle("[ACTIVE]") ConsoleWrite ($hWnd & @CRLF) Local $ind = _ArraySearch($aPrograms, $hWnd, Default, Default, Default, 2, Default, 1) If Not @error Then MsgBox ($MB_SYSTEMMODAL,"","You are running " & $aPrograms[$ind][0]) Edited January 14, 2021 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Mateo Posted January 17, 2021 Author Share Posted January 17, 2021 Take a look, let's say at the Microsoft store, he's telling me I'm running this "ApplicationFrameHost.exe", but the process you see in Task Manager is a completely different process ... The thing is I need the process that really runs (ApplicationFrameHost.exe does not help me). I hope now my problem is clear. Thank you! Link to comment Share on other sites More sharing options...
Nine Posted January 17, 2021 Share Posted January 17, 2021 1 hour ago, Mateo said: I hope now my problem is clear. Yep, it is clear now. Search for UWP. At the moment I have no solution for you. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Nine Posted January 18, 2021 Share Posted January 18, 2021 You owe me a beer for this expandcollapse popup#include <Constants.au3> #include <Process.au3> #include <WinAPISysWin.au3> #include <WinAPIProc.au3> #include <Array.au3> Opt("MustDeclareVars", 1) Local $aPrograms[0][4] Local $aWinList = WinList() Local $iPID, $sName For $i = 1 To $aWinList[0][0] If $aWinList[$i][0] <> "" And BitAND(WinGetState($aWinList[$i][1]), 2) Then $iPID = WinGetProcess($aWinList[$i][1]) $sName = _ProcessGetName($iPID) If $sName = "ApplicationFrameHost.exe" Then $iPID = FindTrueApp($aWinList[$i][0], $iPID, $sName) If Not $iPID Then ContinueLoop EndIf _ArrayAdd($aPrograms, $aWinList[$i][0] & "|" & $aWinList[$i][1] & "|" & $iPID & "|" & $sName) EndIf Next _ArrayDisplay($aPrograms) Func FindTrueApp($sTitle, $iPID, ByRef $sProcess) Local Static $aList = _WinAPI_EnumWindows(True) Local $iTruePID For $i = 1 To $aList[0][0] If WinGetTitle($aList[$i][0]) = $sTitle Then $iTruePID = WinGetProcess($aList[$i][0]) If $iPID <> $iTruePID Then $sProcess = _WinAPI_GetProcessName($iTruePID) Return $iTruePID EndIf EndIf Next Return 0 EndFunc ;==>FindTrueApp Working nicely for me... ioa747 and argumentum 2 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
caramen Posted January 19, 2021 Share Posted January 19, 2021 I already asked @water but @Nine You helped me a looooooooot. I'm ok to send you a French wine bottle if you wish , or french beers, but maybe less interesting ? Pm me ! My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
Mateo Posted January 19, 2021 Author Share Posted January 19, 2021 14 hours ago, Nine said: You owe me a beer for this @Nine You're just amazing! It works great!! I'm now sending you 10 beers!!! Thank you very very very very much !!!! Mateo. Link to comment Share on other sites More sharing options...
Mateo Posted January 26, 2021 Author Share Posted January 26, 2021 Hi, @Nine, This solution works great, only unfortunately it fails to surpass OneNote for example (the app, not the software). I tried to solve it myself and I don't succeed (The problem is that the process that has the same title is this ApplicationFrameHost.exe...) Do you think this has a solution? Mateo. Link to comment Share on other sites More sharing options...
Nine Posted January 26, 2021 Share Posted January 26, 2021 Show info tool and as much information as you can get. Sorry but got broken CB... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Burgaud Posted February 5, 2021 Share Posted February 5, 2021 (edited) ok! I seem to have this ApplicationFrameHost shenanigan problem too... (reading, digesting the above....) ok ok... I think I have a grasp of the situation... will ask if I have further question... @Nine In your function shown below, you defined $aList as a local static: Func FindTrueApp($sTitle, $iPID, ByRef $sProcess) Local Static $aList = _WinAPI_EnumWindows(True) Why the need to define it as "Static" considering the function always assign values to $aList variable each time it is called? It does not need to retain previous values. Lastly, is ApplicationFrameHost.exe the only culprit? Should I do the FindTrueApp for all Window? Dan. Edited February 5, 2021 by Burgaud Link to comment Share on other sites More sharing options...
Nine Posted February 5, 2021 Share Posted February 5, 2021 1 hour ago, Burgaud said: Why the need to define it as "Static" considering the function always assign values to $aList variable each time it is called? There is no need to request a new list at every single UWP apps found by WinList. So I decided to keep the current list. If this snippet is called repeatedly in a loop, I would change it. FWIW, It is just a way for me to promote an under valuated feature of AutoIt. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now